Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #16533
| From | lyubov78@gmail.com |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Animate parametric plot of two lists? |
| Date | 2014-02-08 08:50 +0000 |
| Message-ID | <ld4r4k$750$1@smc.vnet.net> (permalink) |
| References | <27402470.1247054225882.JavaMail.root@n11> <h340l6$ggq$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Thank you for interesting questions!!!
You wrote in the beginning: it's simple
to animate the parametric plot of them by using ParametricPlot inside
Animate.
But I cannot animate the NDSolve using ParametricPlot.
Can you please tell me why I get errors like "NDSolve::dsvar: 1.0011952113073699` cannot be used as a variable. ":
Animate[
ParametricPlot[
{Evaluate[{y[p], x[p]} /. sol =
NDSolve[...some equation type D[f1[x[p],y[p],p] = -D[x[p], p],
f2[x[p],y[p],p] = -D[y[p], p]
x[1] == -1, y[1] == -1}, {y[p], x[p]}, {p, 1, Tp}]]},
{p, 1, Tp}], {Tp, 1, 100}]
Thank you!
On Thursday, July 9, 2009 7:53:42 AM UTC+2, David Park wrote:
> I'm not certain which is better, to store a large number of complete plots,
> or to generate each one.
>
> Generating each of the plots, which seems to be rapid enough for me, could
> be done as follows.
>
> f[t_] := Cos[t]
> g[t_] := Sin[t]
>
> list1 = Table[f[t], {t, 0, 2 Pi, .1}];
> list2 = Table[g[t], {t, 0, 2 Pi, .1}];
>
> n = Length[list1];
> plotdat = Thread[{list1, list2}];
>
> Animate[
> Show[
> ListPlot[Take[plotdat, k],
> Joined -> True,
> PlotStyle -> {Red, Dashed},
> AspectRatio -> Automatic,
> PlotRange -> 1.2],
> ListPlot[Take[plotdat, k],
> PlotMarkers -> {Automatic, 12},
> AspectRatio -> Automatic,
> PlotRange -> 1.2]
> ],
> {k, 1, n, 1}]
>
> But not (for some reason that I don't understand) as follows:
>
> Animate[
> Show[
> ListPlot[Take[plotdat, k],
> PlotMarkers -> {Automatic, 12},
> AspectRatio -> Automatic,
> PlotRange -> 1.2],
> ListPlot[Take[plotdat, k],
> Joined -> True,
> PlotStyle -> {Red, Dashed},
> AspectRatio -> Automatic,
> PlotRange -> 1.2]
> ],
> {k, 1, n, 1}]
>
> But, as usual, I find it easier to do it with Presentations where the
> various uses of the options are untangled and the order doesn't matter.
>
> Needs["Presentations`Master`"]
>
> Animate[
> Draw2D[
> {ListDraw[Take[plotdat, k],
> PlotMarkers -> {Automatic, 12}],
> ListDraw[Take[plotdat, k],
> Joined -> True,
> PlotStyle -> {Red, Dashed}]},
> Axes -> True,
> PlotRange -> 1.2],
> {k, 1, n, 1}]
>
> If you wanted to pre-compute all of the frames, you could just pre-compute
> the primitives without generating the entire plots.
>
> Clear[frame]
> frame[k_]:={ListDraw[Take[plotdat,k],
> PlotMarkers->{Automatic,12}],
> ListDraw[Take[plotdat,k],
> Joined->True,
> PlotStyle->{Red,Dashed}]};
> framelist=Table[frame[k],{k,1,n}];
>
> Animate[
> Draw2D[
> {framelist[[k]]},
> PlotRange -> 1.2,
> Axes -> True],
> {k, 1, n, 1}]
>
>
> David Park
> djmpark@comcast.net
> http://home.comcast.net/~djmpark/
>
>
> From: Porscha Louise McRobbie [mailto:pmcrobbi@umich.edu]
>
> Hello,
>
> When I have explicit formulas for two functions of time, it's simple
> to animate the parametric plot of them by using ParametricPlot inside
> Animate.
>
> I'd like to create a similar animation now, but using two lists of
> numbers. Apparently there is no function such as ListParametricPlot.
>
> Below a roundabout way I found (I want to show both a dashed line and
> a point tracing out the curve in time). Is there a better way to do
> this? I'd like to be able to include many more frames, and this method
> seems inefficient.
>
> Any suggestion/help is appreciated.
>
> Porscha
>
>
>
> (*Animate a parametric plot from two lists*)
> In[1]:= f[t_] := Cos[t]
> In[2]:= g[t_] := Sin[t]
>
> In[27]:= list1 = Table[f[t], {t, 0, 2 Pi, .1}];
> In[28]:= list2 = Table[g[t], {t, 0, 2 Pi, .1}];
>
> In[29]:= n = Length[list1];
> In[30]:= plotdat = Thread[{list1, list2}];
> In[31]:= frame = ConstantArray[0.0, n];
>
> In[32]:= Do[
> frame[[j]] =
> Show[ListLinePlot[plotdat[[1 ;; j]], PlotStyle -> {Red, Dashed},
> PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}}],
> ListPlot[plotdat[[1 ;; j]],
> PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}},
> PlotMarkers -> {Automatic, 12}]], {j, 1, n}]
>
> In[33]:= ListAnimate[frame]
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Animate parametric plot of two lists? lyubov78@gmail.com - 2014-02-08 08:50 +0000
csiph-web