필터 지우기
필터 지우기

plot y(i)

조회 수: 3 (최근 30일)
mouna
mouna 2011년 5월 13일
[EDIT: 20110513 13:39 CDT - reformat - WDR]
hi,
i have this sum:
for i=2:200
y=y+i;
how i can use plot to trace y=f(i)
thanks in advance

답변 (1개)

Walter Roberson
Walter Roberson 2011년 5월 13일
y = cumsum(2:200);
plot(y)
Or, using the for loop
x = 2:200;
numx = length(x);
y = zeros(numx,1);
ty = 0;
for i = 1:numx
ty = ty + x(i);
y(i) = ty;
end
plot(y)
  댓글 수: 6
Jan
Jan 2011년 5월 17일
plot(y1); hold('on'); plot(y2); plot(y3)
Walter Roberson
Walter Roberson 2011년 5월 17일
Or,
plot(x,y1,x,y2,x,y3)

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

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by