Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Plotting Accumulator' topicStudent Support Forum > General > "Plotting Accumulator"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Michael
07/29/12 10:43am

For your specific question, FTW has a closed-form formula, StepSize * t = t. Plot gives a good picture (as a continuous line though).

StepSize = 1;
Plot[StepSize * t, {t, 0, 200}]

Here are some other ways to do it:

ListPlot[Range[0 StepSize, 200 StepSize, StepSize],
DataRange -> {0, 200}]

ListPlot[Accumulate[Table[StepSize, {t, 0, 200}]],
DataRange -> {0, 200}]

Somehow I wonder if your specific question was a simple example of what you wanted to do. If your step size varies, then here are a couple of ways to plot the accumulation.

step[t_] := 1/(1 + t);
ListPlot[Accumulate[Table[step[t], {t, 0, 200}]],
DataRange -> {0, 200}]

ListPlot[Table[Sum[step[s], {s, 0, t}], {t, 0, 200}],
DataRange -> {0, 200}]

Finally, if you want to plot a function of the accumulated values, here is one way. The first Table below lets x range over the accumulated steps (Accumulate[..]) and passes the points {x, f[x]} to ListPlot to be plotted.

f[x_] := x^2;
ListPlot[Table[{x, f[x]}, {x,
Accumulate[Table[step[t], {t, 0, 200}]]}], DataRange -> {0, 200}]

URL: ,

Subject (listing for 'Plotting Accumulator')
Author Date Posted
Plotting Accumulator newbee 07/27/12 07:45am
Re: Plotting Accumulator Bill Simpson 07/28/12 2:58pm
Re: Plotting Accumulator Michael 07/29/12 10:43am
< Previous CommentHelp | Reply To Comment | Reply To Topic