Optimization Toolbox
  Go to function:
    Search    Help Desk 
fminbnd    Examples   See Also

Find the 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

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 to fminbnd are included below for fun, options, exitflag, and output.

fun
The function to be minimized. fun takes a scalar x and returns a scalar value f of the objective function evaluated at x. You can specify fun to be an inline object. For example,

    x = fminbnd(inline('sin(x*x)'),x0)
    
Alternatively, fun can be a string containing the name of a function (an M-file, a built-in function, or a MEX-file). If fun='myfun' then the M-file function myfun.m would have the form

    function f = myfun(x)
    f = ...            % Compute function value at x
    
options
Optimization parameter options. You can set or change the values of these parameters using the optimset function. fminbnd uses these options structure fields:

exitflag
Describes the exit condition:

output
A structure whose fields contain information about the optimization:

Examples

A minimum of sin(x) occurs at

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:

This generates the solution

The value at the minimum is

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.



[ Previous | Help Desk | Next ]