This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

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.


Create or edit optimization options structure


options = optimset('param1',value1,'param2',value2,...)
options = optimset
options = optimset(optimfun)
options = optimset(oldopts,'param1',value1,...)
options = optimset(oldopts,newopts)


The function optimset creates an options structure that you can pass as an input argument to the following four MATLAB® optimization functions:

You can use the options structure to change the default parameters for these functions.


If you have an Optimization Toolbox™ license, you can also use optimset to create an expanded options structure containing additional options specifically designed for the functions provided in that toolbox. For more information about these additional options, see the reference page for the enhanced Optimization Toolbox optimset function.

options = optimset('param1',value1,'param2',value2,...) creates an optimization options structure called options, in which the specified parameters (param) have specified values. Any unspecified parameters are set to [] (parameters with value [] indicate to use the default value for that parameter when options is passed to the optimization function). It is sufficient to type only enough leading characters to define the parameter name uniquely. Case is ignored for parameter names.

optimset with no input or output arguments displays a complete list of parameters with their valid values.

options = optimset (with no input arguments) creates an options structure options where all fields are set to [].

options = optimset(optimfun) creates an options structure options with all parameter names and default values relevant to the optimization function optimfun.

options = optimset(oldopts,'param1',value1,...) creates a copy of oldopts, modifying the specified parameters with the specified values.

options = optimset(oldopts,newopts) combines an existing options structure oldopts with a new options structure newopts. Any parameters in newopts with nonempty values overwrite the corresponding old parameters in oldopts.


The following table lists the available options for the MATLAB optimization functions.






'off' | 'iter' | {'final'} | 'notify'

Level of display. 'off' displays no output; 'iter' displays output at each iteration (not available for lsqnonneg); 'final' displays just the final output; 'notify' displays output only if the function does not converge.

fminbnd, fminsearch,fzero, lsqnonneg


{'off'} | 'on'

Check whether objective function values are valid. 'on' displays an error when the objective function returns a value that is complex or NaN. 'off' displays no error.

fminbnd, fminsearch,fzero


positive integer

Maximum number of function evaluations allowed.

fminbnd, fminsearch


positive integer

Maximum number of iterations allowed.

fminbnd, fminsearch


function | {[]}

User-defined function that an optimization function calls at each iteration. See Output Functions.

fminbnd, fminsearch,fzero


function | {[]}

User-defined or built-in plot function that an optimization function calls at each iteration. Built-in functions:

  • @optimplotx plots the current point

  • @optimplotfval plots the function value

  • @optimplotfunccount plots the function count (not available for fzero)

See Plot Functions.

fminbnd, fminsearch,fzero


positive scalar

Termination tolerance on the function value. See Tolerances and Stopping Criteria.



positive scalar

Termination tolerance on x, the current point. See Tolerances and Stopping Criteria.

fminbnd, fminsearch,fzero, lsqnonneg


This statement creates an optimization options structure called options in which the Display parameter is set to 'iter' and the TolFun parameter is set to 1e-8.

options = optimset('Display','iter','TolFun',1e-8)

This statement makes a copy of the options structure called options, changing the value of the TolX parameter and storing new values in optnew.

optnew = optimset(options,'TolX',1e-4);

This statement returns an optimization options structure that contains all the parameter names and default values relevant to the function fminbnd.


Extended Capabilities

Introduced before R2006a