Clear Filters
Clear Filters

nonlinear optimization with fminunc

2 views (last 30 days)
sami
sami on 12 Feb 2013
i want to do a nonlinear optimization with the command 'fminunc' but i get the following error :
Local minimum possible.
fminunc stopped because the size of the current step is less than the default value of the step size tolerance.
Optimization stopped because the norm of the current step, 5.960464e-007, is less than options.TolX = 1.000000e-006.
Optimization Metric Options relative norm(step) = 5.96e-007 TolX = 1e-006 (default)
can someone explain what this means?

Answers (2)

Sean de Wolski
Sean de Wolski on 12 Feb 2013
That's not an error!
x = linspace(0,2,100);
y1 = (10*(x-1)).^2;
y3 = 1./x;
plot(x,y1,'b-',x,y3,'r-',1,y1(50),'b*',1,y3(50),'r*')
If we look at the blue line and the blue star at x=1, the blue line has hit a minimum, i.e. it starts to go up, the sign of the gradient has changed. With the red line, we have not hit a minimum, the line still appears to be decreasing. But now the amount that it is decreasing by is below some predefined tolerance (fed as an option to fminunc() ). The blue line shows what happens with an exit flag of 1, and the red line show it with an exitflag of 3.

Alan Weiss
Alan Weiss on 13 Feb 2013
Edited: Alan Weiss on 13 Feb 2013
For more information on exit messages, see the documentation.
Alan Weiss
MATLAB mathematical toolbox documentation

Community Treasure Hunt

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

Start Hunting!