How would I rewrite this loop to work?

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

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 23 de Mzo. de 2020

0 votos

Hint:
need to be "T=T+1;"
To plot to a different figure, run figure() first.

3 comentarios

Chas Seldon
Chas Seldon el 23 de Mzo. de 2020
thank you
Chas Seldon
Chas Seldon el 23 de Mzo. de 2020
Is it possible to plot them on the same graph?
Fangjun Jiang
Fangjun Jiang el 23 de Mzo. de 2020
use "hold on"

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Mzo. de 2020

Comentada:

el 23 de Mzo. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by