Home » Space Flight/Orbital Mechanics » Orbital elements from the state vector

# Orbital elements from the state vector

Six orbital elements are: Specific angular momentum. Inclination. Right ascension (RA) of the ascending node. Eccentricity. Argument of perigee. True anomaly.

```clear all;
clc;
% Lets consider following example
% Given the state vector
R = [ -6132 -3380 2472];    %[km]
V = [-3.369 6.628 2.433];   %[km/s]
mu = 398600;                % Earth’s gravitational parameter [km^3/s^2]
r = norm(R);                % Radial distance
v = norm(V);                % Speed
vr = R*V'/r;                % Radial velocity
H = cross(R,V);             % Specific angular omentum
h = norm(H);                % Magnitude of the specifi c angular momentum
i = acos(H(3)/h)*180/pi;    % Inclination
K =[0 0 1];
N =cross(K,H);              % Node line vector
n = norm(N);                % Magnitude of N
% Right ascension of the ascending node
if(N(2) >= 0)
RAAN = acos(N(1)/n)*180/pi;
else
RAAN = 360 - acos(N(1)/n)*180/pi;
end
ev = 1/mu*((v^2-mu/r)*R-r*vr*V);    % Eccentricity vector
e  = norm(ev);                      % Eccentricity
% Argument of perigee,
if(ev(3) >= 0)
omega = acos(N*ev'/(n*e))*180/pi;
else
omega = 360 - acos(N*ev'/(n*e))*180/pi;
end
% True anomaly
if(vr >= 0)
theta = acos(ev*R'/(r*e))*180/pi;
else
theta = 360 - acos(ev*R'/(r*e))*180/pi;
end

OE = [h i RAAN e omega theta];
fprintf('h [km^2/s]    i [deg]     RAAN [deg]  e    omega[deg]   theta [deg] \n');
fprintf('%4.2f     %4.2f       %4.2f     %4.4f    %4.2f    %4.2f  \n',OE);```
```h [km^2/s]    i [deg]     RAAN [deg]  e    omega[deg]   theta [deg]
57932.08     153.91       255.01     0.1579    17.23    31.97```