for x=1:10
a=2*x
b=3*x^2
plot(a,b)
end
But the figure cannot be plotted. What should i write for the codes?

댓글 수: 1

Stephen23
Stephen23 2018년 3월 1일
@Chen Ji: do you want the points to be joined by a line?

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

답변 (1개)

Stephen23
Stephen23 2018년 3월 1일
편집: Stephen23 2018년 3월 1일

0 개 추천

figure()
hold on
for ...
...
plot(a,b,'*')
end
But I would not recommend doing this: the simpler MATLAB solution would be to write vectorized code:
X = 1:10;
A = 2*X;
B = 3*X.^2;
plot(A,B,'-*')

태그

질문:

2018년 3월 1일

댓글:

2020년 10월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by