Pass an empty matrix for tol or trace to use the default value, for example: fzero(' fun ',x,P1) For the purposes of this command, zeros are considered to be points where the function actually crosses, not just touches, the x-axis.Ī string containing the name of a file in which an arbitrary function of one variable is defined. Provides for additional arguments passed to the function fun(x,P1,P2.). z = fzero(' fun',x,tol,trace)ĭisplays information at each iteration.
Returns an answer accurate to within a relative error of tol. In this case, the search terminates when the search interval is expanded until an Inf, NaN, or complex value is found. If no such interval is found, NaN is returned. fzero looks for an interval containing a sign change for fun and containing x. Where x is a scalar value, uses x as a starting point. Calling fzero with an interval guarantees fzero will return a value near a point where fun changes sign. Where x is a vector of length 2, assumes x is an interval where the sign of f(x(1)) differs from the sign of f(x(2)).
The value returned is near a point where fun changes sign, or NaN if the search fails. fun is a string containing the name of a real-valued function of a single real variable. Fzero (MATLAB Function Reference) MATLAB Function Reference