LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best Poly Fit Coefficients do not agree with Best Poly Fit 2

Solved!
Go to solution

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.Smiley Embarassed

 

Sasa

 

 

 

0 Kudos
Message 1 of 9
(3,366 Views)

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

0 Kudos
Message 2 of 9
(3,340 Views)

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.

0 Kudos
Message 3 of 9
(3,300 Views)

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)

0 Kudos
Message 4 of 9
(3,292 Views)

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

0 Kudos
Message 5 of 9
(3,280 Views)

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

0 Kudos
Message 6 of 9
(3,258 Views)

I notice that and correct it, still doesn't work.

 

Thanks anyway,

 

 

0 Kudos
Message 7 of 9
(3,226 Views)

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

0 Kudos
Message 8 of 9
(3,210 Views)
Solution
Accepted by topic author sasko

You are right, It works !!

 

I correct error from 11 to 1, but also algorythm must be "Givens" and then match.

 

THANKS !!!

0 Kudos
Message 9 of 9
(3,201 Views)