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

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2020년 3월 23일

0 개 추천

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

댓글 수: 3

Chas Seldon
Chas Seldon 2020년 3월 23일
thank you
Chas Seldon
Chas Seldon 2020년 3월 23일
Is it possible to plot them on the same graph?
Fangjun Jiang
Fangjun Jiang 2020년 3월 23일
use "hold on"

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2020년 3월 23일

댓글:

2020년 3월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by