LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linear Fit Settings

Solved!
Go to solution

Hello everyone

 

I am using Linear Fit.vi to calculate Slope. Are there guidelines to make the right choice for "weight", "tolerance" and "method" taking into consideration the kind of data?

 

Thanks.

 

Dan07.

0 Kudos
Message 1 of 4
(2,925 Views)

Hi dan07,

 

The linear fit help page gives some guidelines with weight and tolerance being of data type double and method being of data type U16. It also states that Weight should be the same size as Y etc.

 

Hope this answers your question and advises a little!

 

Tori

Tori
Student
0 Kudos
Message 2 of 4
(2,911 Views)
Solution
Accepted by topic author dan07

Don't wire the weight unless you have additional information about the data. For example if you know the standard deviation of each point because it is derived from several measurements, or if there is a known relation between x and the noise in the data. For example if certain points have a larger error, you could downweight them accordingly. (common is weight = 1/variance, see also).

 

 The method is not a plain U16 but an enum, to get a correctly typed input simply right-click the terminal and "create control" or "create constant".

 

Tolerance is only used for the iterative methods (least absolute residual, bisquare). These are most useful if you have outliers in the data. Just try a few values over a few orders of magnitude and see how the results vary.

 

For regular use, only wire the x and y arrays and leave everything else at the default. 

Message 3 of 4
(2,899 Views)

Altenbach

 

Thanks for helping. I followed you advice and used the Linear Fit at default settings, just wiring X and Y. Worked fine!

 

Dan07

0 Kudos
Message 4 of 4
(2,879 Views)