astrodynx.coe2rv#
- astrodynx.coe2rv(p, e, incl, raan, argp, true_anom, mu=1)[source]#
Transfer classical orbital elements to position and velocity vectors.
- Parameters:
p (
ArrayLike) – Semiparameter of the orbit.e (
ArrayLike) – Eccentricity of the orbit; shape broadcast-compatible with p.incl (
ArrayLike) – Inclination of the orbit; shape broadcast-compatible with p and e.raan (
ArrayLike) – Right ascension of the ascending node; shape broadcast-compatible with p, e, and incl.argp (
ArrayLike) – Argument of periapsis; shape broadcast-compatible with p, e, incl, and raan.true_anom (
ArrayLike) – True anomaly; shape broadcast-compatible with p, e, incl, raan, and argp.mu (
ArrayLike) – Gravitational parameter of the central body; shape broadcast-compatible with p, e, incl, raan, argp, and true_anom.
- Return type:
- Returns:
The position and velocity vectors of the object in the two-body system.
- Notes
The position and velocity vectors are calculated using the following equations:
\[\begin{split} \begin{aligned} \boldsymbol{r} &= \boldsymbol{R}_z(-\Omega) \boldsymbol{R}_x(-i) \boldsymbol{R}_z(-\omega) \boldsymbol{r}_{pf} \\ \boldsymbol{v} &= \boldsymbol{R}_z(-\Omega) \boldsymbol{R}_x(-i) \boldsymbol{R}_z(-\omega) \boldsymbol{v}_{pf} \end{aligned} \end{split}\]where \(\boldsymbol{R}_z\) and \(\boldsymbol{R}_x\) are the rotation matrices about the z-axis and x-axis. And, \boldsymbol{r}_{pf} and \boldsymbol{v}_{pf} are the position and velocity vectors in the perifocal frame:\[\begin{split} \begin{aligned} \boldsymbol{r}_{pf} &= \frac{p}{1 + e \cos(f)} \begin{bmatrix} \cos(f) \\ \sin(f) \\ 0 \end{bmatrix} \\ \boldsymbol{v}_{pf} &= \sqrt{\frac{\mu}{p}} \begin{bmatrix} -\sin(f) \\ e + \cos(f) \\ 0 \end{bmatrix} \end{aligned} \end{split}\]where \(p\) is the semiparameter, \(e\) is the eccentricity, \(f\) is the true anomaly, and \(\mu\) is the gravitational parameter.- References
Vallado, 2013, pp.119.
- Examples
A simple example:
>>> import jax.numpy as jnp >>> import astrodynx as adx >>> p = 1.0 >>> e = 0.0 >>> incl = 0.0 >>> raan = 0.0 >>> argp = 0.0 >>> true_anom = 0.0 >>> mu = 1.0 >>> adx.coe2rv(p, e, incl, raan, argp, true_anom, mu) (Array([1., 0., 0.], dtype=float32, weak_type=True), Array([0., 1., 0.], dtype=float32, weak_type=True))
With broadcasting, you can calculate the position and velocity vectors for multiple sets of orbital elements:
>>> mu = jnp.array([398600,398600.4418]) >>> p =jnp.array([16056.196688409433,11067.79]) >>> e = jnp.array([1.4,0.83285]) >>> incl = jnp.array([jnp.deg2rad(30),jnp.deg2rad(87.87)]) >>> raan = jnp.array([jnp.deg2rad(40),jnp.deg2rad(227.89)]) >>> argp = jnp.array([jnp.deg2rad(60),jnp.deg2rad(53.38)]) >>> true_anom = jnp.array([jnp.deg2rad(30),jnp.deg2rad(92.335)]) >>> pos_vec, vel_vec = adx.coe2rv(p, e, incl, raan, argp, true_anom, mu) >>> assert jnp.allclose(pos_vec[0], jnp.array([-4039.8965, 4814.5605, 3628.625])) >>> assert jnp.allclose(vel_vec[0], jnp.array([-10.385988, -4.771922, 1.7438745])) >>> assert jnp.allclose(pos_vec[1], jnp.array([6525.3677, 6861.5317, 6449.117])) >>> assert jnp.allclose(vel_vec[1], jnp.array([4.902279, 5.5331397, -1.9757109]))