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: 

Can I fit a polynomial curve with an order greater than 89?

The maximum order that the polynomial fit allows seems to be 89. The curve that is produced doesn't fit my data very well. Is it possible to increase the order?
0 Kudos
Message 1 of 9
(2,996 Views)
There cannot possibly be a plausible theoretical model that would justify such a high order, so I assuming you just want to draw a smoother curve to show general trends in your data.

Some simple smoothing or low pass filtering, etc. should do just fine.
0 Kudos
Message 2 of 9
(2,996 Views)
If you just need a smooth curve that passes through all your points, consider a spline. I can send you an example.
0 Kudos
Message 3 of 9
(2,996 Views)
Thanks for your replies. I have included a plot of my data. There are 801 data points. When following each curve from right to left, after the curve begins to drop off, there is a bump. A polynomial curve fit of order 89 does not include this bump. A cubic spline is a good idea, but I think that it will have the same erratic behaviour as the linear spline already in use.
0 Kudos
Message 4 of 9
(2,996 Views)
OK, this looks like real data that possibly could be described by some simple theoretical model and you definitely don't need more than a handful of parameters once you have the right formula.

Is there some theory? What is the measurement?

Could you attach a file containing the raw data in five columns:

x, y(white), y(red), y(green), y(yellow)

and I'll try to play with it a bit.

Once you have a simple model, you just use the levenberg-Marquardt nlin fit to get the theoretical curves AND the interesting parameters. You definitely don't want a high-order polynominal fit or spline.
0 Kudos
Message 5 of 9
(2,996 Views)
I am currently working on the mathematical model. The problem is, I don't know what is causing the bump exactly; I stumbled onto it by accident and have since been trying to figure it out. The reason that I wanted to fit a curve to it was so that I could compute the derivative of the curve and more accurately describe where the bump starts (I have been doing it by eye). Do you know if there is a good online tutorial on how to use the Levenberg-Marquardt nlin fit? Thanks.
0 Kudos
Message 6 of 9
(2,996 Views)
I don't particularly like the shipped "Nonlinear Levenberg-Maquardt fit.vi" and have modified it heavily for my personal use, but there is an example on how to use it shipped with LabVIEW.

Also, from your graph it seems that the x-axis is not linear. Could you post the original data?

Your noise is much higher frequency than the details of the graph and you should be able to eliminate the noise with some simple filtering.
0 Kudos
Message 8 of 9
(2,996 Views)
Just a comment: it seems that the scale is not linear and there is much more data points in the beginning of the curve than in the bump itself. That might explain why the fit doesn't succeed to follow the bump: the bump data points don't weight enough in the minimization e.g. they do not contribute significantly in the mean squared error from the fit. Try to weight the points properly before the fit.


LabVIEW, C'est LabVIEW

0 Kudos
Message 7 of 9
(2,996 Views)
Thanks again for your help. What I have decided to do is use a fifteen point linear regression every eight data points to help with the visualization. This method should suffice for what I need the fit for. Thanks again.
0 Kudos
Message 9 of 9
(2,996 Views)