Any automatic curve fitting tool/function for fitting complex nonlinear curves?

I require an automatic curve fit function which gives me an equation of fit and the error values(Rsquare, RMSE etc.) for nonlinear one dim. data which I can use in my function. I dont need a GUI based manual fitting.

 Accepted Answer

So far the best solution to the question is using sin and gauss functions either directly or using cftool.

More Answers (1)

There is LSQCURVEFIT if you have the optimization toolbox. It gives you the norm of the residuals. Not sure how you want to define RMSE without knowing the true curve.

3 Comments

Hi Matt, Thanks for yours. I saw lsqcurvefit. It asks two more inputs (function, x0) along with x, y. My requirement is that given a data y plotted against x, I want the equation of the (best fit curve). Best fitting can be checked with least square method. However How to get the equation is the issue. I tried spline, cpaps and spaps functions. My data is of size 51x1 double (both x & y), By simply typing spline(x,y) I get coefs of orde 50x4, which can help me get my eqn. How do I form equation from these coefficients? What is form of the equation? Also is there any other way to fit smooth splines(any other function) which will give me a best to my data with the equation? please help
No, I think you've got the issue wrong. In order to do a meaningful least squares fit, you have to start with an equation of a desired from and then find the parameters of that equation that best fit your data. You can't do a fit first and decide on the equation later.
I doubt that the SPLINE commands are doing what you expect. Note that pp=spline(x,y) will produce a curve passing through ALL your data points, even the outliers that you presumably want your fit to ignore. The equation that the pp output corresponds to is a piecewise polynomial. The way pp represents it is described in
doc mkpp
Normally, you wouldn't work with this equation explicitly. You would use the PPVAL command to evaluate spline at different points.
Splines can best fit my curve. However splines wont give me an equation. I could do it with sin8 and gauss8 functions. Thanks for yours.

Sign in to comment.

Categories

Asked:

on 23 Jan 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!