How can I use TolFun to stop iteration when resnorm less than it?

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.

 Risposta accettata

Have a look at Tolerances and Stopping Criteria in the documentation.
HTH,
Arnaud

2 Commenti

Thank you Arnaud,
It's clear now why it is like that. My further question is that, is there some other way to stop iteration based on the value of f(x)?
Best Regards,
Apri
Not that I know of, sorry.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by