MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: listplot and plot of the same function display in different scale...


"sean kim" wrote

>solution = NDSolve[{y'[t] == -y[t], y[0] == 1}, {y},
>{t, 0, 7}];
>
>g0 = Plot[Evaluate[y[t] /. solution], {t, 0, 7},
>DisplayFunction -> Identity];

This plots y vs t in [0,7]

>g1 = ListPlot[Flatten[Table[
>        Evaluate[y[t]/.solution],
>{t, 0, 7, 0.05}]],PlotStyle -> PointSize[0.015],
>DisplayFunction -> Identity];

This plots y vs {1,2,3,4,5,...,(7-0)/0.05}

That is your problem.
To fix it, specifiy the t coordinate in the list of points:

g1 = ListPlot[Flatten[Table[
        { t , Evaluate[y[t]/.solution] },
{t, 0, 7, 0.05}]],PlotStyle -> PointSize[0.015],
DisplayFunction -> Identity];

cheers,
Peltio
invalid address in reply-to. crafty demunging required to mail me.


  • Prev by Date: Re: Regression with missing values
  • Next by Date: Re: Creating a Moving Average Function
  • Previous by thread: Re: listplot and plot of the same function display in different scale...
  • Next by thread: Re: listplot and plot of the same function display in different scale...