LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

poor polynomial fit with LabVIEW but good with Origin

I am using general polynomial fit function to fit scattered data. But it gives very poor result. However Origin gives good fitting results with the same data and same order(6).

Why?

Attached are the snapshots and VI. Thanks.

 

WT

LabVIEW2013(32it) and Win10(64bit)

0 Kudos
Message 1 of 7
(769 Views)

Hi WT,

 

this is what I get when I run your VI in LV2016:

Very similar to Origin…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(750 Views)

Thanks. This is what I get at another computer(LV2013 and LV2019).  I ever got the same result as you sometimes with the same data set. Very strange!

poor fitting.PNG

0 Kudos
Message 3 of 7
(711 Views)

I used MathScript polyfit function (green line). You can seeLV_Polynomial-MS_polyfit.PNG the difference.

0 Kudos
Message 4 of 7
(701 Views)

It looks like you're accidentally changing your hidden "method" control to "Bisquare". If I change to Bisquare I get this:

 

BertMcMahan_0-1689779895938.png

 

With "Least Square" and "Least Absolute Residual", I get the expected fit:

BertMcMahan_1-1689779928074.png

 

0 Kudos
Message 5 of 7
(687 Views)

Thanks.

It's weird! 

I set the Least Square method and also tried the other two methods.

With the method of Least Absolute Residual, if you run several times, you will get three kind of results.

Something goes wrong with my computer?

Least Absolute Residual1.PNGLeast Absolute Residual2.PNGLeast Absolute Residual3.PNG

0 Kudos
Message 6 of 7
(673 Views)

Solved.

Except the algorithm of SVD* (default), all other algorithms work well.

 

Thanks.Least Square-except SVD.PNG 

Message 7 of 7
(668 Views)