Filter löschen
Filter löschen

plot y(i)

3 Ansichten (letzte 30 Tage)
mouna
mouna am 13 Mai 2011
[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

Antworten (1)

Walter Roberson
Walter Roberson am 13 Mai 2011
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 Kommentare
Jan
Jan am 17 Mai 2011
plot(y1); hold('on'); plot(y2); plot(y3)
Walter Roberson
Walter Roberson am 17 Mai 2011
Or,
plot(x,y1,x,y2,x,y3)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by