| Optimization Toolbox | Search  Help Desk |
| fminbnd | Examples See Also |
Find the minimum of a function of one variable on a fixed interval

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 the 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.
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.
Arguments
The arguments passed into the function are described in Table 1-1. The arguments returned by the function are described in Table 1-2. Details relevant tofminbnd are included below for fun, options, exitflag, and output.Examples
A minimum of sin(x) occurs atx = fminbnd('sin',0,2*pi)
x =
4.7124
The value of the function at the minimum is
y = sin(x)
y =
-1.0000
To find the minimum of the function

function f = myfun(x) f = (x-3).^2 - 1;Next, call an optimization routine:
x = fminbnd('myfun',0,5)
This generates the solution
x =
3
The value at the minimum is
y = f(x)
y =
-1
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
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.