Clear Filters
Clear Filters

iter-detailed’ option with fminsearch

8 views (last 30 days)
Sandro Navarro
Sandro Navarro on 16 Feb 2015
Answered: Stephen23 on 16 Feb 2015
Hello, I am trying to find the minimum of a certain function f by using the command fminsearch in MATLAB and I would like to know if there is any way to have the algorithm tell me in each iteration which is the value of the variable used to evaluate the function f, as well as the value of f itself. I know that the latter can be achieved by using the ’iter-detailed’ option, but it still doesn’t give me the value of the variable used in each iteration. I leave my command setting below just in case. options = optimset(’disp’,’iter-detailed’,’MaxFunEvals’,1000,’TolX’,1e-9); MIN = fminsearch(@f,[0.1,0.2,0.09],[ ],[ ],options); ; Thanks in advance

Answers (1)

Stephen23 on 16 Feb 2015
The current version of MATLAB (2014b) does not list iter-detailed as an option for fminsearch , only iter. And the documentation states that that option iter displays the following for fminsearch: Iteration, Func-count, min f(x) and Procedure. Sorry, no x or f(x).
But you could display this information yourself if you write your own OutputFunction. When you supply its handle in the options structure it is called on every iteration with the current values. You can then print, display or store these values in whatever way you wish.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!