MathGroup Archive 2012

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

Search the Archive

Re: What is best trick to eliminate flicker in simulation animation?

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

On 7/19/2012 2:59 AM, Nasser M. Abbasi wrote:

Opps, I seem to have pasted an older cell somehow. Please
ignore last code, here it is again (was missing 2 lines, do
not know how this happened).

thanks,
--Nasser

-----------------------
ClearAll["`*"];
g=9.8; m=30; f=1; L0=4;
k=m*(2*Pi*f)^2;

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.};
sol=First@NDSolve[Flatten@{eq1,eq2,eq3,eq4,ic},{x1,x2,x3,x4},{t,0,10}];

x=x1/.sol;
theta=x3/.sol;

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]
--------------------------




  • Prev by Date: Solving Third Order differential equation using Mathematica.
  • Next by Date: can one make local symbol in a pure function?
  • Previous by thread: What is best trick to eliminate flicker in simulation animation?
  • Next by thread: Re: What is best trick to eliminate flicker in simulation animation?