Optimization Toolbox | ![]() ![]() |
Find a minimum of a function of one variable on a fixed interval
where x, x1, and x2 are scalars and f(x) is a function that returns a scalar.
Syntax
x = fminbnd(fun,x1,x2) x = fminbnd(fun,x1,x2,options) x = fminbnd(fun,x1,x2,options,P1,P2,...) [x,fval] = fminbnd(...) [x,fval,exitflag] = fminbnd(...) [x,fval,exitflag,output] = fminbnd(...)
Description
fminbnd
finds a minimum of a function of one variable within a fixed interval.
x = fminbnd(fun,x1,x2)
returns a value x
that is a local minimizer of the scalar valued function that is described in fun
in the interval x1 <= x <= x2
.
x = fminbnd(fun,x1,x2,options)
minimizes with the optimization parameters specified in the structure options
. Use optimset
to set these parameters.
x = fminbnd(fun,x1,x2,options,P1,P2,...)
provides for additional arguments, P1
, P2
, etc., which are passed to the objective function, fun
. Use options=[]
as a placeholder if no options are set.
[x,fval] = fminbnd(...)
returns the value of the objective function computed in fun
at the solution x
.
[x,fval,exitflag] = fminbnd(...)
returns a value exitflag
that describes the exit condition of fminbnd
.
[x,fval,exitflag,output] = fminbnd(...)
returns a structure output
that contains information about the optimization.
Input Arguments
Function Arguments contains general descriptions of arguments passed in to fminbnd
. This section provides function-specific details for fun
and options
:
fun |
The function to be minimized. fun is a function that accepts a scalar x and returns a scalar f , the objective function evaluated at x . The function fun can be specified as a function handle.where myfun is a MATLAB function such asfun can also be an inline object. |
options |
Options provides the function-specific details for the options parameters. |
Output Arguments
Function Arguments contains general descriptions of arguments returned by fminbnd
. This section provides function-specific details for exitflag
and output
:
Options
Optimization options parameters used by fminbnd
. You can use optimset
to set or change the values of these fields in the parameters structure, options
. See Optimization Parameters, for detailed information:
Examples
The value of the function at the minimum is
To find the minimum of the function
on the interval (0,5), first write an M-file.
Next, call an optimization routine.
Algorithm
fminbnd
is an M-file. The algorithm is based on Golden Section search and parabolic interpolation. A Fortran program implementing the same algorithm is given in [1].
Limitations
The function to be minimized must be continuous. fminbnd
may only give local solutions.
fminbnd
often exhibits slow convergence when the solution is on a boundary of the interval. In such a case, fmincon
often gives faster and more accurate solutions.
fminbnd
only handles real variables.
See Also
@
(function_handle
), fminsearch
, fmincon
, fminunc
, optimset
, inline
References
[1] Forsythe, G.E., M.A. Malcolm, and C.B. Moler, Computer Methods for Mathematical Computations, Prentice Hall, 1976.
![]() | fgoalattain | fmincon | ![]() |