how to plot points in a loop?
이전 댓글 표시
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
2018년 3월 1일
@Chen Ji: do you want the points to be joined by a line?
답변 (1개)
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,'-*')
댓글 수: 1
Austin Selvog
2020년 10월 29일
This also does not work
카테고리
도움말 센터 및 File Exchange에서 Frequency-Domain Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!