optimplotfval

Optimization plot function: objective value at each iteration.

Category: Other public functions: optimfun

Syntax

optimset('PlotFcns', @optimplotfval)

Selects the plot for use with solvers such as fminsearch.

Description

Passed in the PlotFcns option, it plots the current best objective value against the iteration number. A curve that flattens shows that the search is converging, while one that keeps falling suggests it has not finished. It is meant to be called by the solver, not directly.

Example

Watch convergence

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

In the app, the plot of the objective value is drawn below the code.

See also

optimplotfunccount optimplotx optimset fminsearch