why i am getting a blank graph
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Shahrukh s
le 15 Juil 2020
Réponse apportée : Walter Roberson
le 15 Juil 2020
omega_bar = (0:0.01:5)';
n_omega_bar = size(omega_bar,1);
for i = 1:n_omega_bar
OMG = omega_bar(i,1);
Y_bar = (OMG.^2)/(1-OMG.^2)
end
figure(1)
plot(omega_bar,abs(Y_bar(1,:)),'o')
xlim([0 5])
ylim([0 8*1e14]);
0 commentaires
Réponse acceptée
Walter Roberson
le 15 Juil 2020
Y_bar = (OMG.^2)/(1-OMG.^2)
That overwrites all of Y_bar each time. You need
Y_bar(1,i) = (OMG.^2)/(1-OMG.^2)
But your code could be simplified:
Y_bar = omega_bar.^2 ./ (1-omega_bar.^2);
No loop is needed.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!