continuous plot of minimization results

Hello,
I'd like to run the fminsearch solver for a couple of times and plot the progress of the minimization (the residual terms) incessantly:
options=optimset('PlotFcns',@plot_optim_out,'MaxIter',100);
for i=1:5
[x_iter,~,~,output]=fminsearch(fun,x_iter,options);
ii=ii+output.iterations;
end
function [stop] = plot_optim_out(~,optimValues,~)
global P_diff; global P_hom; global P_c1;
i=optimValues.iteration+evalin('base','ii');
stop = false;
hold on;
plot(i,P_diff/P_c1,'b*',i,P_hom/P_c1,'go');
set(gca,'yscale','log');
drawnow;
end
The plot continues to count, but the axis refreshes, so the plot "forgets" the previous data points. Does anybody have an idea why?
Regards

답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

질문:

2019년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by