On looping over drawnow
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
the cyclist
il 4 Ott 2017
Nothing in your for loop depends on the loop variable ii, so why would you expect the plot to change?
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!