optimset
Creates or updates an options struct for the optimization and root-finding solvers.
Category: Mathematics > Optimization
Syntax
options = optimset('name1', value1, 'name2', value2)
Creates a struct with the given options set and all the others empty.
options = optimset(oldopts, 'name', value)
Copies oldopts and changes the given options.
options = optimset(oldopts, newopts)
Merges two structs: non-empty fields of newopts replace those of oldopts.
Description
Options that are not set stay as [], which tells each solver to use its own default. Names are matched without regard to letter case, and a unique abbreviation is accepted. Pass the result as the last argument of fzero, fminbnd or fminsearch.
Input arguments
'Display'- Output level:
'off','iter','final'or'notify'. 'TolX'- Tolerance on the position of the answer.
'TolFun'- Tolerance on the function value.
'MaxIter'- Maximum number of iterations.
'MaxFunEvals'- Maximum number of function evaluations.
Output arguments
options- Struct with the fields
Display,FunValCheck,MaxFunEvals,MaxIter,OutputFcn,PlotFcns,TolFunandTolX.
Example
Tightening the tolerance
o = optimset('TolX', 1e-8, 'Display', 'off')
x = fzero(@(x) x^3 - 2, [0 3], o);
fprintf('%.8f\n', x)
Output
o = struct with fields:
Display: 'off'
FunValCheck: []
MaxFunEvals: []
MaxIter: []
OutputFcn: []
PlotFcns: []
TolFun: []
TolX: 1.0000e-08
1.25992105
Notes
MatLivre implements the general-purpose options only. The result is the same struct as for the base solvers, with the eight fields listed above.