From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multivariable least square fitting

Can Labview, specifically General LS linear Fit VI do the following fitting?

I have x, y, P as independent variables, and fit a curve B to a function of :

 

B = b0 +b1*x +b2* y +b3 *P + b4 *x^2 + b5*y^2 + b6 * P^2 + b7* x*y + b8*x*P + b9 * y*P;

 

There are 12 data points to get 10 coefficients, b0-b9.

 

I'd appreciate any comments. Thanks,

0 Kudos
Message 1 of 5
(3,567 Views)

The equation for B is non-linear. Have you tried the Nonlinear Curve Fit.vi?  Using a VI for the function usually gives better performance than the formula mode.  Read the detailed help for Nonlinear Curve Fit.vi for information on how to create the function VI.

 

Lynn

0 Kudos
Message 2 of 5
(3,546 Views)

Thanks Lynn,

Isn't the formula I try to fit falling into linear least square fitting category? but eitherway, will the non-linear least square fitting vi work for this problem?

0 Kudos
Message 3 of 5
(3,491 Views)

Perhaps a more serious concern is that with 12 data points and 10 coefficients, your system has only two degrees of freedom.  The variance of the esitimates of your coefficients is likely to be so large as to be statistically meaningless.  Can you either use a simpler model (with fewer parameters) or (a lot) more data?

 

BS

 

 

0 Kudos
Message 4 of 5
(3,473 Views)

You have three independent variables (x,y,P), one dependent variable (B), 10 linear coefficients, and 12 datapoints B(x,y,P) in 3D.

All coeefficinets are linear, so all you need to do is setup the H matrix and B vector according to your data, then use general linear fit.

 

How does the data look like? What does it represent? Can you attach a typical dataset?

 

Note: Since you call it "general LS linear fit", you must have an older LabVIEW version, but it is the same as "general linear fit" I mentioned above. It should be able to handle this problem easily. Have you tried?

0 Kudos
Message 5 of 5
(3,460 Views)