Assignment 1
Assignment 1
[][
x
10157768.1264
m
y 6475997.0091 m
z
24 21205.9518
m
X= =
x
1099.2953996 m/s
y
3455.1059240 m/s
z
4355.0978095 m/s
The process to achieve this is detailed by the sequential computation of the items described below. The software of
choice is MATLAB, where a script has been written that includes the following procedure.
For ease of computation, we separate the state-vector into radial distance and velocity vectors and calculate their
magnitudes.
[]
x
2
2
2
r = y r = r r = x + y + z
V=
z
[]
x
V
= x2 + y 2 + z 2
y V = V
z
With these values we proceed to calculate various Kepler elements. We begin with the semi-major axis, which requires the
gravitational parameter, , of the central body. The central body is assumed to be Earth, which according to reference
textbook Orbit & Constellation Design & Management has a value of 398600.441*10003 m3s-2.
2 1
2 V
a=
SemiMajor Axis
r
h =r
V Angular MomentumVector
h= h h = h2x +h2y + h2z Angular Momentum Magnitude
h
V r
e =
Eccentricity Vector
r
e= e e = e 2x +e 2y +e 2z Eccentricity Magnitude
h
i=cos1 z Orbit Inclination
h
0
h
N= 0
Vector the Ascending Node
h
1
N xy = N 2x + N 2y Magnitude of Vector the Ascending Node
N y Nz
=atan 2
,
Ascension of the Ascending Node
N xy N xy
( )
[]()
(
At this point, the argument of pericenter, and the true, eccentric, and mean anomalies are left. However, in order to ensure their
orientation is correct the inclusion of a conditional is required. To set up the conditional, a series of unit vectors are determined
first.
^
N=
N
Unit VectorVector the Ascending Node
N
N
e
Unit Vector Eccentricity Vector
e e
r
r^ =
Unit VectorRadial Distance Vector
r r
e^ =
Argument of Pericenter
1
^)
if only if ( ^
N e ) h>0 then=cos ( e^ N
1
otherwise =cos ( e^ ^
N)
True Anomaly
0 then=cos1 ( r^ e^ )
if only if ( e r ) h>
otherwise =cos1 ( r^ e^ )
We then calculate both the eccentric and mean anomalies.
Eccentric Anomaly
( 2 ) 1e
1+ e ]
At a first glance, this would conclude the process. However, given that convention requires that angles be given as positive
values that open counter-clockwise within a right-handed frame, additional conditionals must be established.
i degrees =
180
i
radians
degrees =
degrees =
180
180
degrees =
radians
radians
Edegrees =
180
E
radians
180
radians
M degrees =
180
M
radians
Now we could say that the MATLAB script could be used for our problem. However, we would be unable to verify the validity
of our results. Fortunately, we have a set of two state-vectors in both Cartesian components and Kepler elements.
International Space Station on June 12, 2014, 12:00:00 hrs [NASA, 2014]
6787746.891
m
51.68714486
127.5486706
74.21987137
0.000731104
24.10027677
24.08317766
24.06608426
[][
x
y
z
x
y
z
[]
a
e
2700816.14
m
3314092.80
m
i
5266346.42
m
=
yields
=
5168.606550 m/ s
5597.546618 m/ s
868.878445 m/ s
E
M
[]
MATLAB script produces the following results, presented in image form for sake of transparency:
7096137.00
0.0011219
m
92.0316
296.1384
120.6878
239.5437
239.5991
239.6546
[]
a
e
x
3126974.99
m
y 6374445.74 m
i
z
28673.59
m
=
yields
=
x
254.91197 m/ s
y
83.30107 m/ s
z
7485.70674 m/ s
E
M
[][
[]
3
MATLAB script produces the following results, presented in image form for sake of transparency:
We can now proceed to convert the given Cartesian components to Kepler elements.
12164958.9354
m
52.6776704353
318.666326139
151.433761697
0.0138695262694
222.912676818
223.4565352
224.00310927
[]
a
e
x
10157768.1264 m
y 6475997.0091 m
i
z
24 21205.9518
m
=
yields
=
x
1099.2953996 m/ s
y
3455.1059240 m/ s
z
4355.0978095 m/ s
E
M
[][
[]
12269687.5912
m
109.823277603
134.625563565
0.004932091570
106.380426142
301.149932402
a
e
i
[]
[ ]
Unlike the the conversion from Cartesian to Kepler, where we started by separating the state-vector, here we convert the given
angles from degrees to radians.
i radians=
180
i
degrees
radians =
radians =
180
degrees
180
180
radians =
degrees
degrees
M radians=
180
M
degrees
With all initial values in the adequate units, we proceed to determine the eccentric and true anomalies. In order to determine the
true anomaly, we must first determine the eccentric anomaly. However, since the eccentric anomaly is a transcendental function,
we must use an iterative scheme. For ease of use, we will implement the Newton-Raphson method, shown below. This scheme is
expected to converge within a few iterations. However, to insure convergence it was set to complete 1000 iterations.
E j+1=E j +
M E j + esin E j
, E0=M NewtonRaphson Scheme for Eccentric Anomaly
1ecos E j
With the eccentric anomaly we can then proceed to to determine the true anomaly, which will allow us to use the Kepler
equations and determine the intermediate values that are transformed to Cartesian components. However, we must first re-orient
the eccentric anomaly to be a positive value. We also do this with the true anomaly once determined.
=2 tan1 tan
1+ e
( E2 ) 1e
]True Anomaly
p=a(1e 2 ) SemiParameter
r=a (1e cos E ) Radial Magnitude Perifocus
Various of the following equations, vectors, and matrices were taken from the reference textbook Orbit & Constellation Design
& Management, p. 109.
[ ]
cos
r =r sin Decompositionof Radius Perifocus
0
v = / p Velocity Magnitude
[ ]
sin
v =v e +cos Decomposition of Velocity
0
cos cos
cos sin
(sin cos cos i )
( sin sin cos i)
sin sin i
sin cos
sin sin
( + cos cos cos i )
(+cos sin cos i)
cos
sin i
[]
[]
[]
x
y
R
z
X = = Recompositionof StateVector
x
V
y
z
[]
Now we could say that the MATLAB script could be used for our problem. However, we would be unable to verify the validity
of our results. Fortunately, we have a set of two state-vectors in both Cartesian components and Kepler elements.
International Space Station on June 12, 2014, 12:00:00 hrs [NASA, 2014]
6787746.891
[]
m
51.68714486
127.5486706
74.21987137
0.000731104
24.10027677
24.08317766
24.06608426
a
e
x
2700816.14
m
i
y
3314092.80
m
z
5266346.42
m
= yields =
x
5168.606550 m/ s
y 5597.546618 m/ s
z
868.878445 m/ s
E
M
[]
[][
MATLAB script produces the following results, presented in image form for sake of transparency:
7096137.00
0.0011219
[]
m
92.0316
296.1384
120.6878
239.5437
239.5991
239.6546
a
e
x
3126974.99
m
i
y 6374445.74 m
z
28673.59
m
= yields =
x
254.91197 m/s
y
83.30107 m/s
z
7485.70674
m/s
E
M
[]
[][
MATLAB script produces the following results, presented in image form for sake of transparency:
We can now proceed to convert the given Kepler elements to Cartesian components.
12269687.5912
0.004932091570
m
109.823277603
134.625563565
106.380426142
301.149932402
3696459.0385 m
8069268.4989
m
8426536.5582
m
=
3884.8809086 m/s
2064.8291662 m/s
3646.3408583 m/s
[ ] [][
a
x
e
y
i = yields z
x
y
z
M
[ ]
References
MGOD Lecture Slides - ae4-878.basics.v4-19_untilsheet34, as presented on November 11, 2015
Orbit & Constellation Design & Management, 2009 printing
%%Validationdata1
%StatevectorInternationalSpaceStationonJune12,2014,12:00:00hrs[NASA,2014]:
%metersandmeterspersecond
%x=2700816.14
%y=3314092.80
%z=5266346.42
%xdot=5168.606550
%ydot=5597.546618
%zdot=868.878445
%metersanddegrees
%a=6787746.891
%e=0.000731104
%i=51.68714486
%RAoAN=127.5486706
%omega=74.21987137
%theta=24.10027677
%E=24.08317766
%M=24.06608426
%%Validationdata2
%StatevectorCryosat2onJune13,2014,14:59:21hrs[NORAD,2014]
%metersandmeterspersecond
%x=3126974.99
%y=6374445.74
%z=28673.59
%xdot=254.91197
%ydot=83.30107
%zdot=7485.70674
%metersanddegrees
%a=7096137.00
%e=0.0011219
%i=92.0316
%RAoAN=296.1384
%omega=120.6878
%theta=239.5437
%E=239.5991
%M=239.6546
%%Validationdata3
%StatevectorfromBasics1.1
%metersandmeterspersecond
%x=8751268.4691
%y=7041314.6869
%z=4846546.9938
%xdot=332.2601039
%ydot=2977.0815768
%zdot=4869.8462227
%metersanddegrees
%a=12273086.181
%e=0.00502216669373
%i=109.818773825
%RAoAN=132.23369779
%omega=105.066732987
%theta=50.0279913486
%E=49.8078265679
%M=49.5880196898
%%Validationdata4
%StatevectorfromBasics1.2
%metersandmeterspersecond
%x=5760654.2301
%y=4856967.4882
%z=9627444.8622
%xdot=4187.6612514
%ydot=3797.5451854
%zdot=683.61512604
%metersanddegrees
%a=12158817.9615
%e=0.014074320051
%i=52.666016957
%RAoAN=323.089150643
%omega=148.382589129
%M=112.192638384
%%Basics2.1CartesiancomponentstoKeplerelements
%StatevectormustbegiveninbasicSIunits
%metersandmeterspersecond
x=10157768.1264;%m
y=6475997.0091;%m
z=2421205.9518;%m
xdot=1099.2953996;%m/s
ydot=3455.1059240;%m/s
zdot=4355.0978095;%m/s
%GravitationalParameterforEarth,takenfromOCDM
mu=398600.441*1000^3;%m3/s2
%RadialvectorfromcenteroftheEarth
r=[xyz];
%Velocityvector
V=[xdotydotzdot];
%RadialdistancefromthecenteroftheEarth
rmag=sqrt(sum(r.*r));
%Velocitymagnitude
Vmag=sqrt(sum(V.*V));
%SemimajorAxis
a=1/(2/rmagVmag^2/mu);
%AngularMomentumVector
h=cross(r,V);
%EccentricityVector
e=cross(V,h)/mur/rmag;
%Eccentricitymagnitude
emag=sqrt(sum(e.*e));
%OrbitInclination
i=acos(h(3)/sqrt(sum(h.*h)));
%VectortotheAscendingNode
N=cross([0;0;1],h)/sqrt(sum(h.*h));
Nxy=sqrt(N(1)^2+N(2)^2);
10
%RightAscensionoftheAscendingNode
ifatan2(N(2)/Nxy,N(1)/Nxy)<0
RAoAN=2*pi+atan2(N(2)/Nxy,N(1)/Nxy);
else
RAoAN=atan2(N(2)/Nxy,N(1)/Nxy);
end
11
%UnitVectors
Ntilde=N/sqrt(sum(N.*N));
etilde=e/sqrt(sum(e.*e));
rtilde=r/sqrt(sum(r.*r));
%OrientationofUnitVectors
ifcross(Ntilde,e).*h>0
signomega=1;
else
signomega=1;
end
ifcross(e,r).*h>0
signtheta=1;
else
signtheta=1;
end
%ArgumentofPericenter
omega=signomega*acos(etilde/Ntilde);
%TrueAnomaly
theta=signtheta*acos(rtilde/etilde);
%EccentricAnomaly
E=2*atan(tan(theta/2)*sqrt((1emag)/(1+emag)));
%MeanAnomaly
M=Eemag*sin(E);
%ConversionofTrueAnomalytoapositivevalue
iftheta<0
theta=2*pi+theta;
else
theta;
end
%ConversionofEccentricAnomalytoapositivevalue
ifE<0
E=2*pi+E;
else
E
end
%ConversionofMeanAnomalytoapositivevalue
ifM<0
M=2*pi+M;
else
M
end
%Setuptheresults'display
variables=['a=';'e=';'i=';'RAoAN=';'omega=';'theta=';'E=';'M=
'];
unitsrad=['m';'';'rad';'rad';'rad';'rad';'rad';'rad'];
unitsdeg=['m';'';'deg';'deg';'deg';'deg';'deg';'deg'];
valuesrad=[a;emag;i;RAoAN;omega;theta;E;M];
valuesdeg=[a;emag;i*180/pi;rad2deg(RAoAN);rad2deg(omega);rad2deg(theta);rad2deg(E);rad2deg(M)];
%DisplayResults
results_rad=[variablesnum2str(valuesrad)unitsrad]%Anglesinradians
results_deg=[variablesnum2str(valuesdeg)unitsdeg]%Anglesindegrees
formatlong
closeall,clearall,clc
%%Validationdata1
%StatevectorInternationalSpaceStationonJune12,2014,12:00:00hrs[NASA,2014]:
%metersandmeterspersecond
%x=2700816.14
%y=3314092.80
%z=5266346.42
%xdot=5168.606550
%ydot=5597.546618
%zdot=868.878445
%metersanddegrees
%a=6787746.891
%e=0.000731104
%i=51.68714486
%RAoAN=127.5486706
%omega=74.21987137
%theta=24.10027677
%E=24.08317766
%M=24.06608426
%%Validationdata2
%StatevectorCryosat2onJune13,2014,14:59:21hrs[NORAD,2014]
%metersandmeterspersecond
%x=3126974.99
%y=6374445.74
%z=28673.59
%xdot=254.91197
%ydot=83.30107
%zdot=7485.70674
%metersanddegrees
%a=7096137.00
%e=0.0011219
%i=92.0316
%RAoAN=296.1384
%omega=120.6878
%theta=239.5437
%E=239.5991
%M=239.6546
%%Validationdata3
%StatevectorfromBasics1.1
%metersandmeterspersecond
%x=8751268.4691
%y=7041314.6869
%z=4846546.9938
%xdot=332.2601039
%ydot=2977.0815768
%zdot=4869.8462227
%metersanddegrees
%a=12273086.181
%e=0.00502216669373
%i=109.818773825
%RAoAN=132.23369779
%omega=105.066732987
%theta=50.0279913486
%E=49.8078265679
13
%M=49.5880196898
14
%%Validationdata4
%StatevectorfromBasics1.2
%metersandmeterspersecond
%x=5760654.2301
%y=4856967.4882
%z=9627444.8622
%xdot=4187.6612514
%ydot=3797.5451854
%zdot=683.61512604
%metersanddegrees
%a=12158817.9615
%e=0.014074320051
%i=52.666016957
%RAoAN=323.089150643
%omega=148.382589129
%M=112.192638384
%%Basics2.2KeplerelementstoCartesiancomponents
%Elementsmustbegiveninmetersanddegrees
%metersanddegrees
%a=12269687.5912;%mSemimajorAxis
%e=0.004932091570;%OrbitEccentricity
%i=109.823277603;%degOrbitInclination
%RAoAN=134.625563565;%degRightAscensionoftheAscendingNode
%omega=106.380426142;%degArgumentofPericenter
%M=301.149932402;%degMeanAnomaly
%ConversionofangleKeplerelementstoradians
i=deg2rad(i);%rad
RAoAN=deg2rad(RAoAN);%rad
omega=deg2rad(omega);%rad
M=deg2rad(M);%rad
%GravitationalParameterforEarth,takenfromOCDM
mu=398600.441*1000^3;%m3/s2
%ThissectiondeterminesthevalueoftheEccentricAnomalybymeansofan
%iterativeschemeknownasNewtonRaphson.Sinceforellipticalorbitsit
%isexpectedtoconvergewithinarelativelylownumberofiterationsif
%theinitialguessissettobeequaltotheMeanAnomaly,thecounter'j'
%isimplementedwithanarbitrarynumber.Thetotalmagnitudeofthe
%counterissetmuchlargerthanexpectedinordertoensuretheconvergence.
E=M;
j=0;
whilej<1000
E=E+(ME+e*sin(E))/(1e*cos(E));
j=j+1;
end
%ConversionofEccentricAnomalytoapositivevalue
ifE<0
E=2*pi+E;
else
E;
end
%TrueAnomaly
15
theta=2*atan(sqrt((1+e)/(1e))*tan(E/2));
%ConversionofTrueAnomalytoapositivevalue
iftheta<0
theta=2*pi+theta;
else
theta;
end
%Semiparameter
p=a*(1e^2);
16
%AngularMomentum
H=sqrt(mu*p);
%Radiusfromtheperifocus
r=a*(1e*cos(E));
%DecompositionofRadiusfromtheperifocus
R=[r*cos(theta);r*sin(theta);0];
%VelocityMagnitude(OCDMp.109)
v=sqrt(mu/p);
%DecompositionofVelocityMagnitude(OCDMp.109)
V=v*[sin(theta);(e+cos(theta));0];
%CoordinateTransformationmatrix(OCDMp.109)
Cpfint(1,1)=cos(RAoAN)*cos(omega)sin(RAoAN)*sin(omega)*cos(i);
Cpfint(1,2)=cos(RAoAN)*sin(omega)sin(RAoAN)*cos(omega)*cos(i);
Cpfint(1,3)=sin(omega)*sin(i);
Cpfint(2,1)=sin(RAoAN)*cos(omega)+cos(RAoAN)*sin(omega)*cos(i);
Cpfint(2,2)=sin(RAoAN)*sin(omega)+cos(RAoAN)*cos(omega)*cos(i);
Cpfint(2,3)=cos(RAoAN)*sin(i);
Cpfint(3,1)=sin(omega)*sin(i);
Cpfint(3,2)=cos(omega)*sin(i);
Cpfint(3,3)=cos(i);
%TransformationofRadiusfromtheperifocustoCartesianComponents(OCDMp.109)
X=Cpfint*R;
%VelocitycomponentsofRadiusfromtheperifocustoCartesianComponents(OCDMp.109)
Xdot=Cpfint*V;
%Setuptheresults'display
variables=['x=';'y=';'z=';'xdot=';'ydot=';'zdot='];
units=['m';'m';'m';'m/s';'m/s';'m/s'];
values=[X(1);X(2);X(3);Xdot(1);Xdot(2);Xdot(3)];
%DisplayResults
results=[variablesnum2str(values)units]
17