LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Robust nonlinear curve fitting

I am looking for a way to perform a robust curve fit on nonlinear data with outliers.  The bisquare method in the "Linear Fit.vi" included in Labview 8.2 provides exactly what I'm looking for, but it only works for linear fits.  Any ideas for how I can extend the linear model to higher-order curves?
0 Kudos
Message 1 of 7
(3,573 Views)
What is your model?  If you need to use the Nonlinear Curve Fit.vi it may be possible to create a loop around it and implement the re-weighting on the outside.  It is simpler to implement Least Absolute Residual, but Bi-Square should also be possible.  Please, tell us more about your application.

-Jim
0 Kudos
Message 2 of 7
(3,561 Views)
Try the "Polynomial Fit.vi". 
0 Kudos
Message 3 of 7
(3,559 Views)
I have tried the polynomial fit vi, but as far as I can tell it doesn't have an option for a robust fitting method (like the bisquare).  So outliers in my data make the least squares fit unusable.

DSPGuy, I thought I would start with a simple quadratic model.  Your suggestion is a good one but I am not familiar enough with the bisquare algorithm for generating weights, nor am I a master programmer (I'm just a humble mechanical engineer).  I found some info from the Matlab website (http://www.mathworks.com/access/helpdesk_r13/help/toolbox/curvefit/ch_fitt5.html#40710) about robust fitting, but I couldn't follow everything so I will have to check out some of the sources in the bibliography section.
0 Kudos
Message 4 of 7
(3,546 Views)
Since Least Absolute Residual is a little easier I wrote a quick implementation around the polyfit VI.  Not well tested, but it should give you a starting point if you choose to go forward with the bi-square.  Attached is the re-weighting wrapper and a really simple test.  This was quick so please overlook the construction debris.

-Jim
Download All
0 Kudos
Message 5 of 7
(3,540 Views)
Thank you so much for the quick response and help, Jim.  I will try this out when I have some time (it may be a couple of days).  Thanks!
0 Kudos
Message 6 of 7
(3,534 Views)
The book Numerical Recipes in C, 2nd ed. by Press et. al. has a good section on robust fitting.  LabVIEW has all the tools to implement the methods.  I typically use a Lorentzian distribution and the downhill simplex minimizer.  It is much slower than least squares, but the answer is a lot more solid.  I have used it many times over the years.  Unfortunately, I do not have code, since the last time I used it I was working for a different company.  Let me know if you would like me to try to throw something together.
0 Kudos
Message 7 of 7
(3,509 Views)