11-10-2014 05:32 AM
HEllo,
I have dataset with 9 points and would like to fit or solve linear equation with 9 coeffcient. The model -equation is following
Z= a0+a1*x+a2*y+a3*x^2+a4*x*y*+a5*y^2+a6*x^2*y+a7*x*y^2+a8*x^2*y^2; eq total 9 coefficient.
When I build matrix H and send data to "General Linear Fit" it returns coeffcients and best fit. Best fit works well but I dont know how to interpret a coeficients.
All this mathematics work well when function is polynom of second order, eg when it has coeffcient a0 to a5.
Thanks in advance.
Sasa
Solved! Go to Solution.
11-10-2014 10:07 AM
General Linear Fit is designed to fit a function Y of one variable, X. You are trying to fit a function Z of two variables, X and Y. I'm pretty sure that this particular VI is not appropriate, as it stands, for this task.
As for the question about interpreting the coefficients, notice that the inputs to GLF are an array of "outputs" (Y) and a 2-D array representing the outputs of the fitting functions f0(X), f1(X), ... fn(X) for each "input" (X). The coefficients are simply the "weights" of the fitting functions f(X) that "best fit" the observed responses (Y) over the range of inputs (X). That is, if you wanted to graph the response, you would compute Y = a0*f0(X) + a1*f1(X) + ... + an*fn(X), where the vector Y is the best-fit estimate for the input vector X.
BS
11-11-2014 02:02 AM
As I said in my previous post it works perfectly when function has a 6 coefficieints. When I increase the number of coefficients it stop to work.
11-11-2014 02:52 AM
Please also attach the two missing subVIs so we can actually run the VI.
(I don't understand your use of the sequence structure. Seems unecessary. Also I don't understand why you write to the GL as well to a signaling property of the same indicator. Seems redundant and also pointless since you don't even have an event structure. Delete the property node. What was your reasoning for the selected algorithm? Where is the data with 9 points? I only see 6 points in the disconnected array control while the other array controls is empty)
11-11-2014 03:05 AM
I figure out now, that I attach a wrong code. SORRY
The attached is correct and it works well when I use only 6 coefficients eq when I remove inputs p6,p7 and p8 on first build array (yellow loop).
S
11-11-2014 11:30 AM
Seems to be a problem in your array of 1's being used as your a0 ... a8 in constructing the H matrix. Look at index 7. The value is 11.
-Jim
11-12-2014 02:00 AM
I notice that and correct it, still doesn't work.
Thanks anyway,
11-12-2014 08:31 AM
When I run this with a correct H matrix for the 6-term model the "result" output agrees with the 9-term model "result" t0 4 significant digits. It might help if you could describe what agreement you are looking for.
-Jim
11-12-2014 09:14 AM
You are right, It works !!
I correct error from 11 to 1, but also algorythm must be "Givens" and then match.
THANKS !!!