MathGroup Archive 2004

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51662] Re: listplot and plot of the same function display in different scale...
  • From: "Peltio" <peltio at twilight.zone>
  • Date: Wed, 27 Oct 2004 23:44:25 -0400 (EDT)
  • References: <clneqo$ocd$1@smc.vnet.net>
  • Reply-to: "Peltio" <peltioNOSP at Mdespammed.com.invalid>
  • Sender: owner-wri-mathgroup at wolfram.com

"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...