View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Convert Keplerian Orbital Elements to a State Vector

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

4.0 | 4 ratings Rate this file 48 Downloads (last 30 days) File Size: 4.03 KB File ID: #35455 Version: 1.2
image thumbnail

Convert Keplerian Orbital Elements to a State Vector


Darin Koblick (view profile)


04 Mar 2012 (Updated )

Convert orbital elements to a state vector, or a state vector back to orbital elements.

| Watch this File

File Information

Most readily available Keplerian orbital element conversion utilities do not address circular or parabolic orbits. This set of routines will address the complete spectrum of orbits from a circular equatorial orbit to a retrograde hyperbolic orbit without error. All functionality is vectorized for computational efficiency.

Example Function Call One:
>> [r_ECI v_ECEF] = orb2rv(p,e,i,O,o,nu);

p = semilatus rectum (km) [1 x N]
e = Eccentricity [1 x N]
i = Inclination (rad) [1 x N]
O = Right Ascension of the Ascending Node (rad) [1 x N]
o = Argument of Perigee (rad) [1 x N]
nu = True Anomaly (rad) [1 x N]

Example Function Call Two:
>>[a,e,i,O,o,nu] = rv2orb(r_ECI,v_ECI)

r = Position State Vector in km (ECI) [3 x N]
v = Velocity State Vector in km/s (ECI) [3 x N]

For those orbits which are equatorial or circular, the following full form function calls are necessary:

Convert state vector to full set of orbital elements:
>>[a,e,i,O,o,nu,truLon,argLat,lonPer,p] = rv2orb(r_ECI,v_ECI);

Convert full set of orbital elements back to a state vector:
>>[r_ECI,v_ECI] = orb2rv(p,e,i,O,o,nu,truLon,argLat,lonPer);

truLon = True Longitude (rad) [1 x N]
argLat = Argument of Latitude (rad) [1 x N]

Required Products MATLAB
MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
24 Oct 2016 Mehmet Mahmudoglu

Possibly mu is 3.986004418*10^14; Standard Gravitational Parameter for Earth
μ=3.986004418⋅10^14 m3/s2

21 Oct 2016 Mehmet Mahmudoglu  
23 Jun 2016 Hayden

Hayden (view profile)

Good, but getConst() is not a function in Octave, so have to replace it with the numerical value of mu.

25 Apr 2012 vlas

vlas (view profile)

oops, forgot the comment, here it goes:
was about to write eci conversion functions myself, glad i've found these ones first!

Comment only
25 Apr 2012 vlas

vlas (view profile)

12 Dec 2013 1.2

Updated outputs for orbital parameters when state vector is circular and equatorial.

Contact us