MATLAB: Problem with nonlinear curve fitting – lsqcurvefit


I'm trying to fit a nonlinear curve with constrains, so I use lsqcurvefit to get the parameters of my function. After applying lsqcurvefit I obtain this output:
Local minimum possible.
So I use MultiStart in order to get the global minimum, but it is not able to obtain the parameters of the function. In this case the output is:
MultiStart encountered failures in the user provided functions. All 100 local solver runs failed in a user supplied function
Searching on Matlab answers I came across this post
They suggest patternsearch in situations where an objective function has many local minima. However, it is not clear how to use pattern search to fit a nonlinear curve.
How can I obtain an optimal fitting? How can I use pattern search when fitting a nonlinear curve?
Any help will be appreciated. Thanks!

Best Answer

Hi Alex, this link may help you get started:
Using optimization routines in MATLAB are very similar across functions. The idea in fitting a curve is to set up an error function usually sum of squared errors, and ask the optimization tool (your choice) to minimize it.
x = patternsearch(@err,x0)