Re: Animate parametric plot of two lists?
- To: mathgroup at smc.vnet.net
- Subject: [mg132313] Re: Animate parametric plot of two lists?
- From: lyubov78 at gmail.com
- Date: Sat, 8 Feb 2014 04:01:49 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <h31upo$bss$1@smc.vnet.net>
Hola! Dear Porscha! You wrote "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." But I cannot manage it, Mathematica always gives error when I want to animate the solution of differential equation, which depends on p and the ParametricPlot which depends on p also: Animate[ParametricPlot[{Evaluate[{y[p], x[p]} /. sol = NDSolve[...some big equation...], x[1] == -1, y[1] == -1}, {y[p], x[p]}, {p, 1, Tp}]]}, {p, 1, Tp}], {Tp, 1, 100}] Thank you!!! On Wednesday, July 8, 2009 1:09:44 PM UTC+2, Porscha Louise McRobbie wrote: > 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]