From: neworder on
I'm trying to use fzero(f, x, options) to find a zero of a function and limit the maximal number of iterations. I set 'MaxIter' option to 500, however, fzero seems to ignore this and iterates until it diverges to infinity.

This link: http://programming.itags.org/matlab/46258/ seems to indicate that maxIter doesn't work. How can I get it to work properly? (or limit the number of iterations in some other way)
From: Alan Weiss on
On 6/23/2010 1:29 PM, neworder wrote:
> I'm trying to use fzero(f, x, options) to find a zero of a function and limit the maximal number of iterations. I set 'MaxIter' option to 500, however, fzero seems to ignore this and iterates until it diverges to infinity.
>
> This link: http://programming.itags.org/matlab/46258/ seems to indicate that maxIter doesn't work. How can I get it to work properly? (or limit the number of iterations in some other way)
The documentation for fzero
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/fzero.html
clearly states that the only options fzero uses are Display,
FunValCheck, OutputFcn, PlotFcns, and TolX.

To stop fzero under conditions you set, use an output function. See
http://www.mathworks.com/access/helpdesk/help/techdoc/math/bsgpq6p-23.html

Alan Weiss
MATLAB mathematical toolbox documentation