ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linear fit

Solved!
Go to solution

Capture.PNGsnip.pngIn this simple vi I expected intersect to be 1 and slope to be 2.
What am I doing wrong?

0 Kudos
Message 1 of 5
(3,600 Views)
Solution
Accepted by topic author Michael.Koppelgaard

Hi Michael,

 

either the implementation changed from LV2011 to your LV2015 - or you did some wiring wrong (which I can't check right now):

check.png

The error is with your array indexes! Arrays start at index 0 - but your FP elements show only elements starting from index 1!

You should have noted you get an array with 4 elements as "best fit", while you think you only input arrays with 3 elements!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,589 Views)

Michael.Koppelgard>> The index on your Y and X arrays are set to 1, you are not seeing the first element in the arrays! Remove the first elements and it will work.

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

Capture.PNG

A "0" was hidden i the start of each array 🙂

 

 

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

Hej Michæl,

 

    Normalt sætter man ikke sig selv som.... oops sorry wrong language 🙂

 

    You normally don't put your self as the solution author so you should probably give both GerdW and perhult credit for the solution.

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