Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Find minimum of single-variable function on fixed interval

`fminbnd`

is a one-dimensional minimizer
that finds a minimum for a problem specified by

$$\underset{x}{\mathrm{min}}f(x)\text{suchthat}{x}_{1}x{x}_{2}.$$

*x*, *x*_{1},
and *x*_{2} are finite scalars,
and *f*(*x*) is a function that
returns a scalar.

`x = fminbnd(fun,x1,x2)`

`x = fminbnd(fun,x1,x2,options)`

`x = fminbnd(problem)`

```
[x,fval]
= fminbnd(___)
```

```
[x,fval,exitflag]
= fminbnd(___)
```

```
[x,fval,exitflag,output]
= fminbnd(___)
```

finds
the minimum for `x`

= fminbnd(`problem`

)`problem`

, where `problem`

is
a structure.

Create `problem`

by exporting a problem from
Optimization app, as described in Exporting Your Work.

The function to be minimized must be continuous.

`fminbnd`

might only give local solutions.`fminbnd`

can exhibit 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`

is a function file. The algorithm
is based on golden section search and parabolic interpolation. Unless
the left endpoint *x*_{1} is
very close to the right endpoint *x*_{2}, `fminbnd`

never
evaluates `fun`

at the endpoints, so `fun`

need
only be defined for *x* in the interval *x*_{1} < *x* < *x*_{2}.

If the minimum actually occurs at *x*_{1} or *x*_{2}, `fminbnd`

returns
a point `x`

in the interior of the interval (*x*_{1},*x*_{2})
that is close to the minimizer. In this case, the distance of `x`

from
the minimizer is no more than 2*`(TolX + 3*abs(x)*sqrt(eps))`

. See [1] or [2] for details about
the algorithm.

[1] Forsythe, G. E., M. A. Malcolm, and C.
B. Moler. *Computer Methods for Mathematical Computations*.
Englewood Cliffs, NJ: Prentice Hall, 1976.

[2] Brent, Richard. P. *Algorithms
for Minimization without Derivatives*. Englewood Cliffs,
NJ: Prentice-Hall, 1973.

`fmincon`

| `fminsearch`

| `optimset`

| `optimtool`

- Create Function Handle (MATLAB)
- Anonymous Functions (MATLAB)