Optimization Toolbox    
fminbnd

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

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.
  • x = fminbnd(@myfun,x1,x2)
    
where myfun is a MATLAB function such as
  • function f = myfun(x)
    f = ...         % Compute function value at x.
    
fun can also be an inline object.
  • x = fminbnd(inline('sin(x*x)'),x1,x2);
    
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:

exitflag
Describes the exit condition:

> 0
The function converged to a solution x.

0
The maximum number of function evaluations or iterations was exceeded.

< 0
The function did not converge to a solution.
output
Structure containing information about the optimization. The fields of the structure are:

iterations
Number of iterations taken.

funcCount
Number of function evaluations.

algorithm
Algorithm used.

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:

Display
Level of display. 'off' displays no output; 'iter' displays output at each iteration; 'final' displays just the final output; 'notify' (default) dislays output only if the function does not converge.
MaxFunEvals
Maximum number of function evaluations allowed.
MaxIter
Maximum number of iterations allowed.
TolX
Termination tolerance on x.

Examples

A minimum of 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

@ (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