exit flags for lsqnonlin

7 views (last 30 days)
David
David on 24 Oct 2013
Edited: Matt J on 24 Oct 2013
Can anyone explain to me the difference between exitflags 1, 2 and 3 in lsqnonlin? I think my confusion here stems from the vague ways tolFun and tolX are described in the help files, but I'm not sure if there's more to my confusion.
Thanks,
David
  1 Comment
dpb
dpb on 24 Oct 2013
For default of trust-region-reflective option it's in snls.m and the pertinent tests are--
if ((optnrm < tol1) && (posdef == 1) )
ex = 1; EXITFLAG = 1;
...
elseif (nrmsx < .9*delta) && (ratio > .25) && (diff < tol1*(1+abs(oval)))
ex = 2; EXITFLAG = 3;
...
elseif (iter > 1) && (nrmsx < tol2),
ex = 3; EXITFLAG = 2;
...
I didn't dig thru the lower levels where some of these are defined...it certainly isn't clear from the doc's just what the difference is in any meaningful fashion, agreed...

Sign in to comment.

Accepted Answer

Matt J
Matt J on 24 Oct 2013
Edited: Matt J on 24 Oct 2013
exitflag=1 means that the first order optimality measure was smaller than what the code thinks is significant.
exitflag=2 means that the change in x at the last iteration was smaller than what you consider significant, as expressed through your choice of TolX.
exitflag=3 means the change in the objective function components were smaller than what you consider significant, as expressed through your choice of TolFun.

More Answers (0)

Categories

Find more on Get Started with Optimization Toolbox 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!