|
| From: | Kevin H. Hobbs |
| Subject: | [Help-gsl] LinAlg SV Doc? |
| Date: | Tue, 16 Feb 2010 14:27:15 -0500 |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc11 Thunderbird/3.0.1 |
I'm fairly new to using the linear algebra routines so this may be
obvious to everybody else but :
In gsl_linalg_SV_solve how long should b and x be?
Could an example be added for this section?
I believe the length of b must be M and the length of x must be N but I
get really confused here, mostly around :
is M the number of samples or the number of parameters (below)?
I will gladly contribute the function I am working on now as an example.
My problem of the moment is to find the best fitting plane for sets of 7
dimensional points, though 3-D will be enough to get me started.
I have a set of 9 points from f(x,y)=z, and I want to find the best
fitting plane, ax + by + c = z, though these points.
My points are :
f(1, 1) = 2
f(1, 2) = 2.11
f(1, 3) = 3.21
f(2, 1) = 3.97
f(2, 2) = 3.76
f(2, 3) = 4.01
f(3, 1) = 3.40
f(3, 2) = 5.47
f(3, 3) = 4.35
When I put these into the equation for a plane this becomes :
1a + 1b + 1c = 2
1a + 2b + 1c = 2.11
1a + 3b + 1c = 3.21
2a + 1b + 1c = 3.97
2a + 2b + 1c = 3.76
2a + 3b + 1c = 4.01
3a + 1b + 1c = 3.40
3a + 2b + 1c = 5.47
3a + 3b + 1c = 4.35
Then I create the matrix A and the vectors x and b for the linear system
Ax = b (I know x and b are getting confused):
1 1 1 2.00
1 2 1 2.11
1 3 1 3.21
2 1 1 3.97
A = 2 2 1 b = 3.76 x = a b c
2 3 1 4.01
3 1 1 3.40
3 2 1 5.47
3 3 1 4.35
The output I get from the attached program is :
0.983333 0.366667 0.886667
which puts a nice plane through my points.
Do I have my Ms and Ns in the right places?
find_interpolation_parameters.h
Description: Text Data
find_interpolation_parameters_SVD.c
Description: Text Data
interp_test.c
Description: Text Data
signature.asc
Description: OpenPGP digital signature
| [Prev in Thread] | Current Thread | [Next in Thread] |