LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linear fit outputs an empty array

Solved!
Go to solution

Hi am trying to linear Fit a XY graph.

 

The inputs of the XY graph are the Y components of two waveforms. When the two waveforms are plotted against eachother i should see a linear fit, and i do (see picture).

 

I am trying to linear fit the XY graph by using the linear fit.vi. When doing so the output of the linear fit is an empty array (see probes). My input data into the linear are of the same length so i dont understand what i am doing wrong.

Download All
0 Kudos
Message 1 of 7
(160 Views)

Hi Ulas,

 

two suggestions:

  1. check the error output of the LinearFit function
  2. attach your VI with some example data embedded when you want more help!
Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 2 of 7
(152 Views)

Are your X arrays and Y arrays the same length?

Message 3 of 7
(138 Views)

The error message i receive is 

−20068 Input parameters has at least one element that is Inf, NaN, DBL_MAX, or DBL_MIN

 

The reason why i hadnt added the VI is because it is large, however i have added it to this message. 

0 Kudos
Message 4 of 7
(132 Views)

Yes they are both 1971 elements long

0 Kudos
Message 5 of 7
(131 Views)
Solution
Accepted by topic author Ulas

You're running your data through a normalize, then you normalize it to between 0 and 1 with some math, then run it through a log function before the linear fit. 

 

This means that you're guaranteed at least one zero value pre-log, and ln(0) produces an illegal value, which is the cause of the error you stated.

 

 

Message 6 of 7
(105 Views)

Thank you this was actually a really easy solution. Should have been able to think of it myself.

 

Thank you for the help

0 Kudos
Message 7 of 7
(50 Views)