# optimset

Specify optimization function options.

## Syntax

options = optimset('option1', value1, 'option2', value2, ...)

## Inputs

`optionN`- The name of option N.
`valueN`- The value of option N.

## Outputs

- options
- A struct containing the options.

## Examples

`options = optimset('MaxIter', 200, 'Display', 'iter')`

```
options = struct [
Display: iter
MaxIter: 200
]
```

`options = optimset('Jacobian', 'on')`

```
options = struct [
Jacobian: on
]
```

## Comments

For fminbnd, the only available tolerance option is: TolX.

For fmincon, the available tolerance options are: MaxFail, TolX, TolCon, and TolKKT.

For fminunc, the available tolerance options are: TolFun and TolX.

For fminsearch, the only available tolerance option is: TolX.

For fsolve, the available tolerance options are: TolFun and TolX.

For fzero, the only available tolerance option is: TolX.

For lsqcurvefit, the available tolerance options are: TolFun and TolX.

The solver functions terminate the first time that any of the convergence tolerance criteria are met.

The default value for MaxFail is 20,000.

The default value for MaxFunEvals is 1,000,000.

The default value for MaxIter is 400.

The default value for TolCon is 0.5.

The default value for TolFun is 1.0e-7.

The default value for TolKKT is 1.0e-4.

The default value for TolX is 1.0e-7.

TolX, when used with fmincon, sets the convergence criteria relative to the design variable bounds. The TolX value is applied to the interval sizes as a scale factor. For all other functions, TolX sets the convergence criteria relative to the design variable magnitudes.

TolCon only applies when fmincon cannot find a feasible solution. In such cases, the function will return the best infeasible solution found within the allowed violation, along with a warning. The algorithm does not attempt to minimize the utilized violation. The TolCon value is applied as a percent of the constraint bound, with an absolute minimum of 1.0e-4 applied when the bound is zero or near zero.

TolKKT sets the convergence criterion for the optimal relationship between the gradients of the objective and constraint functions, which is an equation involving Lagrange multipliers.