| MATLAB Function Reference | Search  Help Desk |
| fmin | Examples See Also |
Minimize a function of one variable
NOTE
The name of this function has been changed to fminbnd in Release 11 (MATLAB 5.3). While fmin is supported in Release 11, it will be removed in a future release so please begin using fminbnd.
Syntax
x = fmin('fun',x1,x2)
x = fmin('fun',x1,x2,options)
x = fmin('fun',x1,x2,options,P1,P2, ...)
[x,options] = fmin(...)
Description
x = fmin('fun',x1,x2)
returns a value of x which is a local minimizer of fun(x) in the interval
.
x = fmin('fun',x1,x2,options)
does the same as the above, but uses options control parameters.
x = fmin('fun',x1,x2,options,P1,P2,...)
does the same as the above, but passes arguments to the objective function, fun(x,P1,P2,...). Pass an empty matrix for options to use the default value.
[x,options] = fmin(...)
returns, in options(10), a count of the number of steps taken.
Arguments
Examples
fmin('cos',3,4) computes
to a few decimal places.
fmin('cos',3,4,[1,1.e-12]) displays the steps taken to compute
to 12 decimal places.
To find the minimum of the function
on the interval (0,2), write an M-file called f.m.
function y = f(x) y = x.^3-2*x-5;Then invoke
fmin with
x = fmin('f', 0, 2)
The result is
x =
0.8165
The value of the function at the minimum is
y = f(x)
y =
-6.0887
Algorithm
The algorithm is based on golden section search and parabolic interpolation. A Fortran program implementing the same algorithms is given in [1].See Also
fmins Minimize a function of several variables
fzeroZero of a function of one variable
foptions in the Optimization Toolbox (or type help foptions).
References
[1] Forsythe, G. E., M. A. Malcolm, and C. B. Moler, Computer Methods for Mathematical Computations, Prentice-Hall, 1976.