# fminbnd

Find the minimum of a univariate real function within an interval.

## Syntax

x = fminbnd(@func,interval)

x = fminbnd(@func,interval,options)

[x,fval,info,output] = fminbnd(...)

## Inputs

`func`- The function to minimize.
`interval`- A two-element vector containing the interval on which to minimize.
`options`- A struct containing option settings.

## Outputs

- x
- The location of the function minimum.
- fval
- The minimum of the function.
- info
- The convergence status flag.
- info = 1
- Function value converged to within tolX.
- info = 0
- Reached maximum number of iterations or function calls.

- output
- A struct containing iteration details. The members are as follows:
- iterations
- The number of iterations.
- nfev
- The number of function evaluations.
- xiter
- The function values of the interval end points at each iteration.
- fvaliter
- The interval end points at each iteration.

## Examples

```
function y = func(x)
y = -log(x) / x;
end
interval = [1, 6];
[x,fval] = fminbnd(@func, interval)
```

```
x = 2.71828183
fval = -0.367879441
```

```
function y = func(x, offset)
y = -log(x) / x + offset;
end
handle = @(x) func(x, 2);
[x,fval] = fminbnd(handle, interval)
```

```
x = 2.71828183
fval = 1.63212056
```

## Comments

fminbnd implements Brent's method for minimization without derivatives.

Options for convergence tolerance controls are specified with optimset.

To pass additional parameters to a function argument, use an anonymous function.

- MaxIter: 400
- MaxFunEvals: 1,000,000
- TolX: 1.0e-7