Levenberg-Marquardt not an option for LSQNONLIN
2 views (last 30 days)
Show older comments
hi, I am trying to find the optimum parameters to fit a data to another.Since I have many input parameters, and when using the trust-region-reflective (default) algorithm in LSQNONLIN, the warning told me to use Levenberg-Marquardt because there must be as many equations as variables. When I am setting up the "options", my code is
%%%% options=optimoptions('lsqnonlin','Levenberg-Marquardt',.005);
and the error message is that "Levenberg-Marquardt" is not an option for LSQNONLIN. Then I tried
%%%options={'levenberg-marquardt',1e-2,'Jacobian'};
there was no error message, but there was a warning
"Warning: Struct field assignment overwrites a value with class "cell". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details.".
And it used trust-region-reflective algorithm again. The output of lsqnonlin didn't give me a global min, it stopped after several iterations as the step size is less than the tolerance. I don't think it used the levenberg-marquardt. What was wrong? Thank you!
0 Comments
Accepted Answer
Alan Weiss
on 18 May 2015
What you should do depends on your MATLAB version. For R2014b or later, use the InitDamping option to pass Levenberg-Marquardt parameters. As the R2014b Release Notes describe, you set:
options = optimoptions(@lsqnonlin,'Algorithm','levenberg-marquardt','InitDamping',0.1);
But for earlier releases, use optimset instead of optimoptions:
options = optimset('Algorithm',{'levenberg-marquardt',0.1});
This works for R2008b and later.
Alan Weiss
MATLAB mathematical toolbox documentation
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!