FUNCTION REFERENCE
fzero
Root of a scalar function.
Root of a scalar function.
Syntax
x = fzero(fun, x0)Syntax
x = fzero(fun, x0, options)Syntax
[x, fval, exitflag, output] = fzero(fun, x0, options, p1, ...)x0 is a starting point or an interval [a b] whose end values differ in sign.
From a starting point x, fzero tries x - dx and x + dx (dx = x/50, or 1/50
when x is 0, times sqrt(2) each step) until the sign changes, then uses
Brent's method with tolerance TolX (default eps).
options is an optimset or optimoptions structure (or [] for defaults) supporting
TolX, MaxIter, MaxFunEvals, Display, OutputFcn, PlotFcns, and FunValCheck.
exitflag is 1 on convergence, 0 on MaxIter/MaxFunEvals, -1 if stopped by OutputFcn,
-3/-4/-6 if the sign-change search fails, and -5 when |f(x)| grew while the
interval shrank (a pole, such as tan near pi/2).
fun is a function handle, such as @(x) x.^2 - a (variables like a are the
values they had when the handle was made) or @cos, or a function name as text.
Example
fzero('cos', 1) % 1.5708Example
a = 2; fzero(@(x) x^2 - a, 1) % 1.4142Example
fzero(@(x, c) x^2 - c, 1, [], 3) % 1.7321Differences from MATLAB: none known.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.