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: 

Linear fit not working as expected?

Solved!
Go to solution

Hi,

 

I'm using the NI_AALPro.lvlib:Linear Fit.vi on an array of vertically stacked points. However, the result makes absolutely no sense, the fitted line doesn't represent the input data.

 

But if I rotate the points by 1 degree, the fit seems to work...

Why is that and is there a function or a way to properly fit the points regarding their orientation?

 

Thanks in advance!

 

I have attached:

  • The VI itself
  • A screenshot of the VI
  • The test image (no rotation)
  • The test image (rotated 1 degree)
  • A screenshot of the fitting result (no rotation)
  • A screenshot of the fitting result (rotated 1 degree)

VI screenshot.PNG

 

Download All
0 Kudos
Message 1 of 22
(3,672 Views)
0 Kudos
Message 2 of 22
(3,669 Views)

Hi optimus,

 

can you attach your VI with a typical set of "blob coordinates" made default in the indicator?

 

What's the point of the FOR loop? Why not use simple math:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 22
(3,643 Views)

Thanks for your quick reply! I adjusted the VI, it seems I thought a bit too complicated.

I included the blob coordinates (in the 1600x1200 px image) as a constant.

 

VI screenshot_new.PNG

0 Kudos
Message 4 of 22
(3,628 Views)

Unfortunately you did not attach the VI according to your image.

Please attach your VI with that "blob coordinates" constant!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 22
(3,619 Views)

Sorry, my mistake. I'll upload it shortly

 

I adjusted the file paths, you might need to update them with the location of the test picture I uploaded if you want to use that.

Thanks again!

0 Kudos
Message 6 of 22
(3,510 Views)

Sorry, my mistake, here it is:

 

0 Kudos
Message 7 of 22
(3,576 Views)

Hi Optimus,

 

using a XY graph the interpolation looks quite ok. See attachment…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 22
(3,565 Views)

Hm, yes it does. But why is it so weird in case of my blobs?

0 Kudos
Message 9 of 22
(3,558 Views)

Hi optimus,

 

I thought that "blob coordinates" constant were real blob coordinates?

Why should it display different on your IMAQ indicator than on my XY graph?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 22
(3,553 Views)