# Keplerian Orbital Elements ↔ Cartesian ECEI with WGS84 Corrections

I'm trying to write code to go back and forth between equatorial KOE (Keplerian Orbital Elements) and ECEI (Cartesian).

ECEI→KOE I found here: How to programmatically calculate orbital elements using position/velocity vectors?

KOE→ECEI I found on the Wikipedia page for the Orbital Elements which has the equations for x,y of the ellipse which can then be passed through a DCM transform from the orbital plane to the ECEI system.

So this is all well-and-good for a spherical earth. However, the purpose of this is to replace my RK4 integration which takes WGS84 into account with KOE parameters for performance.

I'd greatly appreciate any pointers leading to a method to account for a non-spherical earth.

• Keplerian elliptical orbits are predicated on the assumption of an ideal point-source mass, which creates a spherically-symmetric gravitational field. The WGS84 uses the asymmetric field defined by the EGM96 gravitational model which results in (slightly) non-Keplerian orbits, with orbital elements that evolve over time. Sep 27 '15 at 19:07
• They evolve with time? Does this imply that gravity is not rotationally-symmetric about the z-axis? Sep 28 '15 at 1:32
• The potential field of non-homogenous masses such as Earth are typically described as a linear combination of a series of spherical harmonic functions. See: en.wikipedia.org/wiki/Geopotential_model Sep 28 '15 at 4:44
• I'm thinking about "... the purpose of this is to replace my RK4 integration which takes WGS84 into account with KOE parameters for performance." and wondering how this could improve performance. When you say "...KOE→ECEI I found on the Wikipedia page for the Orbital Elements which has the equations for x,y of the ellipse." are these $x(t)$ and $y(t)$ using some approximation or series solution? I don't know which Wikipedia article you are referring to. Something like that would be faster than a cartesian RK for a given accuracy mostly because it assumes a pure $1/r$ potential.
– uhoh
Dec 8 '16 at 10:15
• Are you asking for something that has the speed benefits of a 2D planar pure $1/r$ potential solution (or approximation) but incorporates the lumpy 3D $(r, \theta, \phi)$ gravity model? There may be some intriguing analytical approximations for a few higher order terms (e.g. $J_2, J_4$) but for the full "lumpy earth", maybe not, since computers were coming along nicely by the time satellites could spatially resolve the Earths gravity field with higher accuracy. It's possible, some people just like math! Am I understanding your question correctly?
– uhoh
Dec 8 '16 at 10:21