0

Have used the below code to animate a plot for motion of a spherical pendulum

    sol = Flatten[
   NDSolve[{theta''[t] == phi'[t]^2 Cos[theta[t]] - 
        g/l Sin[theta[t]], phi''[t] == (-2 phi'[t] theta'[t] Cos[theta[t]])/
        Sin[theta[t]], theta[0] == Pi/2, theta'[0] == 
       0, phi[0] == Pi/2, phi'[0] == 1} /. {g -> 9.81, 
      l -> 1}, {theta, phi}, {t, 0, 30}]];
x[t_] := Evaluate[(Sin[theta[t]] Cos[phi[t]]) /. sol]
y[t_] := Evaluate[(Sin[theta[t]] Sin[phi[t]]) /. sol]
z[t_] := -Evaluate[Cos[theta[t]] /. sol]
ParametricPlot3D[{x[t], y[t], z[t]}, {t, 0, 30}]
Animate[ParametricPlot3D[{x[t], y[t], z[t]}, {t, 0, n}], {n, 0.1, 30, 
  0.01}]

but at around 10 seconds in the lines start to wiggle and aren't smooth, is there a way to fix this? Thanks. screenshot of wiggly lines

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Marky
  • 1

0 Answers0