# Matlab's command counterpart in MMA

Matlab has a command that when is used in fminsearch shows the value of the function which we want to minimize and so gives a trend of values calculated for the minimum. It is something like this for a specific problem:

What is the equivalent command in MMA?

Try something like this:

Let's make up a "slow to evaluate" function to minimize:

f[x_] := (Pause[0.5]; x^4 - x^2)


Some setup:

values = {};
Dynamic@ListPlot[values, PlotRange -> All, Frame -> True]


Now run FindMinimum and watch the function values decrease in real time:

FindMinimum[f[x], {x, 1}, StepMonitor :> AppendTo[values, f[x]]]

• Sometimes it crashes. MMA asks me to either disable dynamic updating or wait for it to work. – MOON Nov 1 '14 at 21:35