On looping over drawnow
5 ビュー (過去 30 日間)
古いコメントを表示
clear
C1 = 20000;
C2 = linspace(0,26,5500);
k1 = 0.5;
k2 = 5;
n1 = 0;
n2 = 0;
nm = 0;
D = -1;
O = 1;
gam = 0.01;
alph = 0;
for ii=1:length(C2)
w = linspace(-10,10,5500);
k1eff = k1.*(1+C2);
TA = w./(k1eff./2);
TB = w./(gam./2);
Y1 = (-2.*1i.*sqrt(C1))./(sqrt(gam).*((1+C2).*(1-1i.*TA).*(1-1i.*TB)+C1));
Y2 = (-2.*sqrt(C1.*C2))./(sqrt(gam).*((1+C2).*(1-1i.*TA).*(1-1i.*TB)+C1));
Y3 = (2.*(1+C2).*(1-1i.*TA))./(sqrt(gam).*((1+C2).*(1-1i.*TA).*(1-1i.*TB)+C1));
AY1 = abs(Y1).^2;
AY2 = abs(Y2).^2;
AY3 = abs(Y3).^2;
Sbb = 2*pi.*(AY1.*(n1 + 0.5) + AY2.*(n2 + 0.5) + AY3.*(nm + 0.5));
figure(1)
plot(TB,Sbb)
drawnow limitrate
%ylim([0,30])
set(gca,'FontSize',13)
xlabel('\Theta_B')
ylabel('S_{bb}')
%ylim([0,5])
end
I am trying to plot my Sbb as a function of TB for each step of the loop. Upon executing the code above however I see a curve with two peaks with different heights but the graph isn't changing over time. Much help would be appreciated. Thank you in advance.
0 件のコメント
採用された回答
the cyclist
2017 年 10 月 4 日
Nothing in your for loop depends on the loop variable ii, so why would you expect the plot to change?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!