Slow/jerky animations inside manipulate (more details)
- To: mathgroup at smc.vnet.net
- Subject: [mg100635] Slow/jerky animations inside manipulate (more details)
- From: Porscha Louise McRobbie <pmcrobbi at umich.edu>
- Date: Wed, 10 Jun 2009 05:31:54 -0400 (EDT)
As several people have kindly pointed out, my first post was a bit too vague (my first time with Mathgroup). I am adding more specific details here. Thanks! ------Original post: "Slow/jerky animations inside manipulate" --------- I have an Animate command (I'm using GraphicsRow to show two side-by-side synchronized animations) inside of Manipulate. The resulting animations play very fast and are jerky. I can adjust the play speed using AnimationRate, but it must be slowed down by a ridiculous amount in order to look smooth. I've tried adjusting the RefreshRate, as wellas making time a slider variable and animating from within the Manipulate control panel,both with little success. How can I create smooth animations, appropriate for class demonstrations? ------------------------------------------------------------------------- -----Additional Comments------------------------------------------------- My plots are actually simple. I am, however, solving an ODE inside of the Manipulate/Animate commands. I've played around with the NDSolve options thinking it might make things faster, but again no success. Basically I just want two sliders to choose initial conditions for the ODEs, then animate the results. Inside Manipulate, I solve the following ODEs, where the initial conditions q0,p0 are the slider variables: sols = First@NDSolve[{q'[t] == p[t], p'[t] == 2 A De (Exp[-2 A (q[t] - xe)] - Exp[-A (q[t] - xe)]), q[0] == q0, p[0] == p0}, {q, p}, {t,0, 100}]; Inside Animate, I have two plots (tp is the animation variable): 1. Plot solution q(tp) vs. tp, as well as a circle that moves along as the curve is being traced out: p1 = Graphics[{ Point[{tp, Evaluate[q[tp] /. sols]}]}]; p2 = Quiet@Plot[Evaluate[q[T1] /. sols], {T1, 0, tp}, PerformanceGoal->"Speed"]; FIRSTplot = Show[p1, p2]; 2. Plot a static background curve "Staticplot" (computed outside Animate), with a circle moving on it. The equation for the background curve is: f(q)=De(1+Exp[-2 A (q-xe)]-2 Exp[-A (q-xe)]) The coordinates for Point below are {q,f(q)}. p7 = Graphics[{Point[{Evaluate[q[tp] /. sols], De (1 + Exp[-2 A (Evaluate[q[tp] /. sols] - xe)] - 2 Exp[-A (Evaluate[q[tp] /. sols] - xe)]) }] }]; SECONDplot=Show[Staticplot,p7]; ------------------------------------------------------------------------- Thanks again for any help.