x = fzero(fun,x0) tries
to find a point x where fun(x) = 0. This solution is where fun(x) changes
sign—fzero cannot find a root of a function
such as x^2.

[x,fval,exitflag,output]
= fzero(___) returns fun(x) in
the fval output, exitflag encoding
the reason fzero stopped, and an output structure
containing information on the solution process.

Initial value, specified as a real scalar or a 2-element real
vector.

Scalar — fzero begins at x0 and
tries to locate a point x1 where fun(x1) has
the opposite sign of fun(x0). Then fzero iteratively
shrinks the interval where fun changes sign to
reach a solution.

2-element vector — fzero checks
that fun(x0(1)) and fun(x0(2)) have
opposite signs, and errors if they do not. It then iteratively shrinks
the interval where fun changes sign to reach a
solution. An interval x0 must be finite; it cannot
contain ±Inf.

Tip
Calling fzero with an interval (x0 with
two elements) is often faster than calling it with a scalar x0.

Options for solution process, specified as a structure. Create
or modify the options structure using optimset. fzero uses
these options structure fields.

Display

Level of display:

'off' displays no output.

'iter' displays output at each
iteration.

'final' displays just the final
output.

'notify' (default) displays output
only if the function does not converge.

FunValCheck

Check whether objective function
values are valid.

'on' displays an error when the
objective function returns a value that is complex, Inf,
or NaN.

The default, 'off', displays no
error.

OutputFcn

Specify one or more user-defined
functions that an optimization function calls at each iteration, either
as a function handle or as a cell array of function handles. The default
is none ([]). See Output Functions.

PlotFcns

Plot various measures of progress
while the algorithm executes. Select from predefined plots or write
your own. Pass a function handle or a cell array of function handles.
The default is none ([]).

@optimplotx plots the current point.

@optimplotfval plots the function
value.

For information on writing a custom plot function,
see Plot Functions.

TolX

Termination tolerance on x,
a positive scalar. The default is eps, 2.2204e–16.

The fzero command
is a function file. The algorithm, created by T. Dekker,
uses a combination of bisection, secant, and inverse quadratic interpolation
methods. An Algol 60 version, with some improvements, is given in [1]. A Fortran version, upon which fzero is
based, is in [2].

References

[1] Brent, R., Algorithms for
Minimization Without Derivatives, Prentice-Hall, 1973.

[2] Forsythe, G. E., M. A. Malcolm, and C.
B. Moler, Computer Methods for Mathematical Computations,
Prentice-Hall, 1976.