| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Optimization Toolbox |
| Contents | Index |
| Learn more about Optimization Toolbox |
| On this page… |
|---|
You can select a plot function to easily plot various measures of progress while the algorithm executes. Each plot selected draws a separate axis in the figure window. If available for the solver selected, the Stop button in the Run solver and view results window to interrupt a running solver. You can select a predefined plot function from the Optimization Tool, or you can select Custom function to write your own. Plot functions not relevant to the solver selected are grayed out. The following lists the available plot functions:
Current point — Select to show a bar plot of the point at the current iteration.
Function count — Select to plot the number of function evaluations at each iteration.
Function value — Select to plot the function value at each iteration.
Norm of residuals — Select to show a bar plot of the current norm of residuals at the current iteration.
Max constraint — Select to plot the maximum constraint violation value at each iteration.
Current step — Select to plot the algorithm step size at each iteration.
First order optimality — Select to plot the violation of the optimality conditions for the solver at each iteration.
Custom function — Enter your own plot function as a function handle. To provide more than one plot function use a cell array, for example, by typing:
{@plotfcn,@plotfcn2}Write custom plot functions with the same syntax as output functions. For information, see Output Function.

The graphic above shows the plot functions available for the default fmincon solver.
Output function is a function or collection of functions the algorithm calls at each iteration. Through an output function you can observe optimization quantities such as function values, gradient values, and current iteration. Specify no output function, a single output function using a function handle, or multiple output functions. To provide more than one output function use a cell array of function handles in the Custom function field, for example by typing:
{@outputfcn,@outputfcn2}For more information on writing an output function, see Output Function.

Select Level of display to specify the amount of information displayed when you run the algorithm. Choose from the following; depending on the solver, only some may be available:
off (default) — Display no output.
final — Display the reason for stopping at the end of the run.
final with detailed message — Display the detailed reason for stopping at the end of the run.
notify — Display output only if the function does not converge.
notify with detailed message — Display a detailed output only if the function does not converge.
iterative — Display information at each iteration of the algorithm and the reason for stopping at the end of the run.
iterative with detailed message — Display information at each iteration of the algorithm and the detailed reason for stopping at the end of the run.
See Enhanced Exit Messages for information on detailed messages.
Set Node interval, with the bintprog solver selected, to specify the interval of explored nodes you want to display output for. Note that integer feasible solution nodes are always shown.
Selecting Show diagnostics lists problem information and options that have changed from the defaults.
The graphic below shows the display options.

![]() | Running a Problem in the Optimization Tool | Getting Help in the Optimization Tool | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |