Zeroes

In general it is hard to determine the zeroes of functions exactly. However, they can be approximated numerically. The function $ f(x) = x^3-x^2 -3\arctan(x)+1$ has three zeroes on the whole real line.
The first zero is on the interval [-2,-1], and the signs of the function values $ f(-2)$ and $ f(-1)$ are different. Use the command fzero:
>> fzero(@f,[-2,-1])

ans =
    -1.2780

>> fzero(@f(x),[-2,-1])

ans =
    -1.2780
So it is possible to use either `f' or `f(x)'.
>> f(ans)

ans =
    -4.4409e-016
You can see from the last output that MATLAB has found an approximation for the zero.

Remark: When fzero does not find a zero of a function $ f$ , this does not mean the function does not have a zero. When the wrong interval is selected, the function is discontinuous or does not cross $ f(x)=0$ , no zero can be found, although it may exist. This can be the case, for example, when searching for a zero of $ f=x^2$ . Note that in this case the zero of the function is identical to its minimum.



Previous      Next      Up      Contents


Esteur 2010-03-22