How can I use TolFun to stop iteration when resnorm less than it?
Show older comments
Hi,
I am using lsqcurvefit to do parameter estimation. I do not need to have a very small resnorm at the end. So if the resnorm is already less than my tolerance, it is more than enough for me.
So, e.g., I set TolFun to 1e-2:
optionsLSQ = optimset('Display','Iter','TolFun',1e-2);
[ki,resnorm] = lsqcurvefit(@funObj,ki,tdata,xdata,lb,[],optionsLSQ);
And this is what I get:
Norm of First-order
Iteration Func-count f(x) step optimality CG-iterations
0 3 0.113218 0.311
1 6 0.00709841 0.237501 0.0365 0
2 9 0.00463864 0.0462264 0.00193 0
Optimization terminated: first-order optimality less than OPTIONS.TolFun,
and no negative/zero curvature detected in trust region model.
As you can see, at iteration 1, f(x)<0.01, and yet the iteration does not stop. What should I do to make it stop right after f(x)<TolFun?
Thank you in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Nonlinear Least Squares (Curve Fitting) 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!