MATLAB: How to improve convergence in Fitting the data with Curve Fitting Toolbox

"doesconvergeconvergencecurvecurve fittingCurve Fitting Toolboxfitfittingimproveimprovingnot

I am looking for suggestions to improve fitting performance using Curve Fitting Toolbox.

Best Answer

There are a plethora of issues that influence curve fitting.
1. The most notable is selection of model, either from our curve-fitting library or the user's custom equations. We suggest trying different models to fit the data.
2. Some preprocessing of data prior to fitting curve is helpful. This may include:
- Transforming the response data.
- Removing Infs, NaNs, and outliers.
3. The fitting process is more likely to converge if you supply as much information as possible about the coefficients being estimated:
- Make intelligent guesses as starting values. If you have an idea about the likely coefficient values, then use those as starting values.
- In absence of knowledge of starting values, try a variety of different starting values.
- Try restraining the parameters. For example if you know a parameter has to be positive, placing its lower bound at 0 may lead the iterative process toward a solution that it might not find otherwise.
4. There are various fitting options that you can adjust:
- Try different algorithms.
- Increase the number of iterations or function evaluations allowed.
- Reduce the convergence tolerance.
5. Try also sub-setting the data and fitting different subsets of data separately.
6. Another strategy is to fit a term at a time. So say you think your model is
y = c+ a*exp(b*x) + d*sin(f*x);
Then you might want to fit
y = c + a*exp(b*x)
and then use the resulting coefficients for a, b, and c as starting points when fitting the whole equation
y = c+ a*exp(b*x) + d*sin(f*x);