lsqcurvefit.m ... how to find intermediate steps?
Show older comments
Hi
I'm fitting using lsqcurvefit and the OUTPUT structure tells me there are 4 steps with 20 function evaluations before the stopping criteria is reached. Is there any way to find the parameter values at each of these steps?
My goal is to plot each fit to demonstrate the improvement between model and data.
Regards, Michael
Answers (2)
Sean de Wolski
on 31 Oct 2012
1 vote
You could have your objective function print to a text file explicitly or keep a persistent variable around that stores the intermediate steps.
4 Comments
I don't think either solution will work well unless you want to save the result of every single call to your objective function, because it's only through the workspace of the objective function that you would have access to the output.
If you only want the results of a complete iteration, or certain key points of the algorithm, you're better off using OutputFcn.
Sean de Wolski
on 31 Oct 2012
@Matt: Isn't that what he wants?
Sean de Wolski
on 31 Oct 2012
Ahh.. quite possibly, yeah.
No, it's not true that you can't store intermediate output to a matrix using an OutputFcn. The following example shows how to do this
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!