I am running an animation of a satellite in an elliptic orbit (defined by a parametric equation for $x$ and $y$ as a function of $t$) and want to make sure the spacecraft is traveling at the right speeds at different points in its orbit. That is, it should go slower at is apoapsis and much faster at its periapsis. I can easily calculate the tangential speed of the satellite using this equation:
$v=\sqrt{GM(\cfrac{2}{r}-\cfrac{1}{a})}$
How do I convert this to the angular speed of the satellite at this point?
I've done extensive research (hours and hours) but haven't found anything of value. The closest thing was this expression of Kepler's Third Law:
$\cfrac{dA}{dt}=\cfrac{1}{2}r^2\omega$
Since $\cfrac{dA}{dt}$ is a rate (area swept out per second) I rewrote this equation as
$\cfrac{A}{P}=\cfrac{1}{2}r^2\omega$
where $A$ is the area of the elliptic orbit (given by $A=\pi ab$ where $a$ and $b$ are the semi-major and semi-minor axes of the ellipse, respectively), and $P$ is the period of the elliptic orbit (given by $P=2 \pi \sqrt{\cfrac{a^3}{GM}}$). Solving this for $\omega$ yields:
$\omega=\cfrac{2A}{Pr^2}$
For each time step in my simulation I use the satellite's current position in this equation to compute $\omega$ and then use the result to update the current $\theta$. This updated $\theta$ is then plugged into the parametric equation mentioned above to get the satellite's $x$ and $y$ position.
I can't find my mistake anywhere and would really appreciate it if someone could point it out to me.