In general also extrema cannot be determined exactly. In principle (the locations of) extrema can be approximated numerically.
From the graph, you can read the approximate location of the extrema of $ f(x)$ . There is a minimum in the interval [0,2] which can be determined with the command fminbnd:
>> x1 = fminbnd(@f,0,2)

x1 =

>> x1 = fminbnd(@f(x),0,2)

x1 =

>> f(x1)

ans =
So the function $ f(x)$ has a minimum at $ x = 1.0878$ with value -1.3784. Again, it is possible to use `f' or `f(x)'.
The function $ f(x)$ has a maximum on the interval [-1,0]. Unfortunately, MATLAB does not have a function that can give the location of the maximum directly. However, the location of a maximum of $ f(x)$ is the same as the location of a minimum of $ -f(x)$ .
The following commands will now be clear.
>> x2 = fminbnd(@(x)-f(x),-1,0)

x2 =

>> f(x2)

ans =
The function $ f(x)$ has a maximum at $ x = -0.5902$ a with value 2.0456.
With fminbnd, the location of one minimum in the indicated interval is approximated. You have to calculate the value of the minimum yourself. The precision with which the locations of extrema are calculated, can be adapted.

Previous      Next      Up      Contents

Esteur 2010-03-22