LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Polynomial fitting for scatter plot

Solved!
Go to solution

Hi all, 

 

I was wondering if there is any way to generate a polynomial fit to a scatter plot just like in excel. The data I am trying to fit has several y values for each x value. 

 

 

Thanks

Krish

0 Kudos
Message 1 of 6
(2,863 Views)

The general polynomial fit tools allow duplicate x values, so there should be no problem at all. What have you tried?

 

(You could also average all y values for each x and weight the averaged point according to the number of original observations.)

 

Please attach a small VI containing your typical data.

0 Kudos
Message 2 of 6
(2,857 Views)

Hi altenbach,

 

I did try the VI that you suggested but the first and the last points of the fitting is connected leading to a cyclic plot.

 

The data and a sample VI is attached. 

 

Thanks alot for your reply and help

Download All
0 Kudos
Message 3 of 6
(2,824 Views)
Solution
Accepted by topic author Krishandan

You need to sort the data by X. Here is how it could be done. See if this works for you. (currently you are trying to fit data that zigzags all over the plot area.)

 

Message 4 of 6
(2,814 Views)

That works perfectly. Thanks alot

0 Kudos
Message 5 of 6
(2,761 Views)

Well, my "solution" above is a bit misleading, because the polynomial fit of course does NOT depend on the x ordering. If the x-values are scranbled as in your case, a maybe better solution would be to simply create a linear x-ramp over the data range and use polynomial evaluation to calculate a smooth best fit line. This has also the advantage tha a smooth curve is generated even if the data points are sometimes far apart.

 

Here is one possible modification to show the technique.

 

0 Kudos
Message 6 of 6
(2,730 Views)