I would like to animate a spring pendulum. Below is my piece of code. The Lagrangian and equations are correct, in which I am sure, but the animation looks terrible and non-realistic.
Could someone help me with plotting the solution of my system of ODEs? Did I make a mistake in replacing the generalised coordinates to the Cartesian ones?
Clear[s, ϕ, t];
sol = First[
NDSolve[{4 s''[t] + s[t]/2 + 9.81*Sin[ϕ[t]] -
2 (1 + s[t]) ϕ'[t]^2 == 0,
2 ϕ''[t] (1 + s[t])^2 + 4 ϕ'[t] (1 + s[t]) s'[t] +
9.81 (1 + s[t]) Cos[ϕ[t]] == 0,
s[0] == 1/5, ϕ[0] == 1,
s'[0] == 0, ϕ'[0] == 0}, {s, ϕ}, {t, 10}]];
x[t_] := Evaluate[(1 + s[t]) Cos[-ϕ[t]] /. sol]
y[t_] := Evaluate[-(1 + s[t]) Sin[-ϕ[t]] /. sol]
frames = Table[
Graphics[{Gray, Thick, Line[{{0, 0}, {x[t], y[t]}, {x[t], y[t]}}],
Darker[Blue], Disk[{0, 0}, .1], Darker[Red],
Disk[{x[t], y[t]}, .1], Disk[{x[t], y[t]}, .1]},
PlotRange -> {{-2.5, 2.5}, {-2.5, 2.5}}], {t, 0, 10, .1}];
ListAnimate[frames]