optimplotfunccount

Optimization plot function: bar chart of the function evaluation count.

Category: Other public functions: optimfun

Syntax

optimset('PlotFcns', @optimplotfunccount)

Selects the plot for use with solvers such as fminsearch.

Description

Passed in the PlotFcns option, it is called by the solver at each iteration and draws a bar with the number of times the objective function has been evaluated so far. It is a quick way to see how costly a minimization is. It is meant to be called by the solver, not directly.

Example

Count evaluations

opts = optimset('PlotFcns', @optimplotfunccount);
x = fminsearch(@(x) (x - 1)^2, 0, opts);

In the app, the bar chart is drawn below the code.

See also

optimplotfval optimplotx optimset fminsearch