LoneJoe
03-14-2007, 04:18 PM
Hi,
I am trying to use the methods described in 15.4 General Least Squares, so create a polynomial best fit equation based on X and Y data.
Keeping it simple, I am using only four data points, and checking the answers with Excel. For example:
X, Y
1, -0.7
2, -8.6
3, -20.9
4, -35.8
The answer should be y = 0.3x^3 - 4x^2 + 2x +1; and therefore I would expect my array pointed to by the 'a' function in the svdfit function should return 0.3, -4, 2, and 1.
Well, beyond my expections, I am not getting anywhere.
The function requires a 'basis function'. What is that?
Is there a different function I should be calling? For example, I can understand defining the matrix scratch pad areas (as opposed to having them dynamically created in the function); but is there something else I should do?
Does anyone have an simple X,Y example that I can see and build from?
I am trying to use the methods described in 15.4 General Least Squares, so create a polynomial best fit equation based on X and Y data.
Keeping it simple, I am using only four data points, and checking the answers with Excel. For example:
X, Y
1, -0.7
2, -8.6
3, -20.9
4, -35.8
The answer should be y = 0.3x^3 - 4x^2 + 2x +1; and therefore I would expect my array pointed to by the 'a' function in the svdfit function should return 0.3, -4, 2, and 1.
Well, beyond my expections, I am not getting anywhere.
The function requires a 'basis function'. What is that?
Is there a different function I should be calling? For example, I can understand defining the matrix scratch pad areas (as opposed to having them dynamically created in the function); but is there something else I should do?
Does anyone have an simple X,Y example that I can see and build from?