Show figure for each simulation when running a loop

14 ビュー (過去 30 日間)
Haoyi Luo
Haoyi Luo 2018 年 9 月 14 日
コメント済み: Haoyi Luo 2018 年 9 月 14 日
I want to see the figure for each simulation when I run the loop. The code is like this:
function[theta_hat_opt]=OptimalOmega(d)
...
[v,loc]=min(DOD(:));
[x,y,z]=ind2sub(size(DOD),loc);
dod=zeros(1,S);
for s=1:S
dod(1,s)=DOD(:,:,s);
end
theta_hat_opt=0.1+(z-1)*0.01,
X=0.1:0.01:0.8;
Y=dod;
A=plot(X,Y)
I want to show both the figure and value by calling this function -
M=500;
theta_hat_opt=zeros(1,M);
for m=1:M
theta_hat_opt(1,m)=OptimalOmega(0.01);
end
How can I do this?
Many thanks!

回答 (1 件)

KSSV
KSSV 2018 年 9 月 14 日
編集済み: KSSV 2018 年 9 月 14 日
After plot use drawnow. To show up a text use text.
for i = 1:100
x = rand(10,1) ;
plot(x)
text(05,0.5,num2str(mean(x)))
drawnow
end
  1 件のコメント
Haoyi Luo
Haoyi Luo 2018 年 9 月 14 日
Thank you very much. It still does not work in my context. :(

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by