display parameter values at each iteration in the optimization

Hello all,
I use "fminsearch" for optimization. I want to display or save the parameter values (x values) at each iteration. Setting 'display' 'iter' in the options only shows the function values. I was wondering how can I display or save the x values at each iteration?
I appreciate your help.
Best, Mona

댓글 수: 1

hi,I think we have the same problem in the filed of optimization in current study,shall we change our MSN to communicate freely and quickly?
My ID:
disini@live.cn
thank you

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2012년 2월 7일
편집: John Kelly 2015년 3월 2일

0 개 추천

Use an OutputFcn in the options structure.

추가 답변 (1개)

Sheng Liu
Sheng Liu 2012년 3월 6일
I rewrite the example in the help page of outputFcn,like this:
function [x fval] = myproblem1(x0) options = optimset('OutputFcn', @myoutput,'Display','iter');
[x fval] = fminsearch(@objfun, x0,options);
function stop = myoutput(x,~,state)
stop = false;
if state == 'iter'
disp([' x = ',num2str(x)]);
end
end
function z = objfun(x)
z = exp(x(1))*(4*x(1)^2+2*x(2)^2+x(1)*x(2)+2*x(2));
end
end
wish it helpful for you!

댓글 수: 1

hi sheng i want to minimise a system with 2 delays a help please

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

질문:

2012년 2월 6일

편집:

2015년 3월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by