How would I rewrite this loop to work?

1 vue (au cours des 30 derniers jours)
Chas Seldon
Chas Seldon le 23 Mar 2020
Commenté : Fangjun Jiang le 23 Mar 2020
I want this loop to plot three curves for T = 0,1 and 2. I keep getting error messages.
T = 0;
X2 = [0:0.1:2];
Y2 = [0:0.1:2];
while T <=2
Y2 = T.^2.*log(X2);
plot(Y2)
T + 1;
end

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 23 Mar 2020
Hint:
need to be "T=T+1;"
To plot to a different figure, run figure() first.
  3 commentaires
Chas Seldon
Chas Seldon le 23 Mar 2020
Is it possible to plot them on the same graph?
Fangjun Jiang
Fangjun Jiang le 23 Mar 2020
use "hold on"

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by