What is best trick to eliminate flicker in simulation animation?

• To: mathgroup at smc.vnet.net
• Subject: [mg127356] What is best trick to eliminate flicker in simulation animation?
• From: "Nasser M. Abbasi" <nma at 12000.org>
• Date: Fri, 20 Jul 2012 03:47:52 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net

```For sometime, I have been trying to find what is the best
way to improve the flicker I get when doing animation in
Mathematica.

In other tools, one can do what is called double buffering
to help with this.

This problem shows up whenever I plot result of simulation.

I want to plot say an object as it moves, and I see that
annoying flicker (it might be called with some other names).

To see what I mean, I wrote this toy example, which is animation
of a spring pendulum that swings. If you look at the pendulum
itself, near the bottom end, you can see it is hard on the eye
to look at since it is not smooth as it moves.

One way to improve this is to slow the animation using
the menu buttons. But I'd like to run the animation fast,
and at the same time reduce this effect.

May be there are some hidden options one can use to help
with this problem? I am using 8.04 on windows.

-------------------------------
g=9.8; m=30; f=1; L0=4; (*L0 is initial length of pendulum*)
k=m*(2*Pi*f)^2; (*spring stiffness*)

(* state space 4 equations, position, speed,angle, omega *)
eq1=x1'[t]==x2[t];
eq2=x2'[t]==x1[t]*x4[t]^2-g*Cos[x3[t]]-(k/m)*(x1[t]-L0);
eq3=x3'[t]==x4[t];
eq4=x4'[t]==-(g/x1[t])Sin[x3[t]]-2*x2[t]*x4[t]/x1[t];

ic={x1[0]==L0,x2[0]==0.,x3[0]==Pi/4.,x4[0]==0.};

(*solve numerially since non-linear, use 10 seconds*)
sol=First@NDSolve[Flatten@{eq1,eq2,eq3,eq4,ic},{x1,x2,x3,x4},{t,0,10}];

Animate[
Graphics[{Red,Line[{{0,0},{x[t]*Sin[theta[t]],-x[t]*Cos[theta[t]]}}]},

PlotRange->{{-L0,L0},{-1.4L0,L0/2}},
ImageSize->300,
Frame->True,
Axes->False],
{t,0,10,.1},AnimationRunning->False]
----------------------------

thanks,
--Nasser

```

• Prev by Date: Re: Plotting: how does one reverse the time axis tick mark values?
• Next by Date: Re: Sending an interrupt to the frontend?
• Previous by thread: Re: No CCompiler found - MinGW-x64
• Next by thread: Re: What is best trick to eliminate flicker in simulation animation?