Re: Pls, I need some help on fzero's optimset settings.



KYing wrote:


I was trying to optimize a large program, and is resorting to the
use
of optimizing its smaller components to solve the problem,
involving
the use of the function "FZERO".

I am testing it using the examples given in the 'fzero' and
'optimset" HELP description embedded in the MATLAB program, which
is:


%--------------------------------------------------------%
x = fzero(@cos,[1 2])

%--------------------------------------------------------%

I wanted to set the max no. of iteration and max no. of function
evaluations settings for the function itself using the following
codes:

%--------------------------------------------------------%
options=optimset('TolX', 1E-07,
'MaxFunEvals',3,'MaxIter',2,'Display','iter');
[x,fval,exitflag,output] = fzero(@cos,[1 2], options)

%which returns me the output as followed:

x =

1.5708

fval =

1.0218e-009

exitflag =

1

output =

intervaliterations: 0
iterations: 4
funcCount: 6
algorithm: 'bisection, interpolation'
message: 'Zero found in the interval [1, 2]'

%--------------------------------------------------------%

Why is the iteration no. bigger than the one i set(i set it 2 and
it
gave me 4 iterations), the same case goes to the no. function
evaluations?

Please kindy assist me on this issue. Thank you very much!!

A bit of a hurry don't you think? At least
from your second post in the middle of the
night here in the US on a saturday. Relax.
Put down that third cup of coffee. ;-)

A quick check with the debugger shows that
fzero does not actually seem to ever check
either MaxIter or MaxFunEvals during its
iterations.

I'll enter this as a bug. Sigh.

John
.