Académique Documents
Professionnel Documents
Culture Documents
Assignment 1
September 5, 2017
1 Question 1
Assume eccentricity (e) = ( 0.01, 0.1, 0.2, 0.4, 0.6, 0.9 )
Develop a code to solve Kepler equation in whichever language you are comfortable
with.
Answer
To solve the Kepler Equation. A general function was used to solve the Kepler equation
using Newton Raphson method. Now to find the values of Eccentric Anomaly as the Mean
Anomaly changes from [0, 360] degrees.
M = E e sin(E) (1)
We cannot solve this transcendental equation directly for E. However, an accurate solution
requires an iterative, trial and error procedure.
Using MATLAB, a general function was written to compute the root using Newton Raphson
method. This code was used to solve the Kepler Equation for different values of Eccentricity
as mentioned in the question. The following were the plots obtained.
Observations
The monotonic increasing relationship between mean anamaly and eccentric anamaly
can be seen from the plot.
As the eccentricity is increased the deviation of eccentric anamaly from mean anamaly
can be seen from Fig(1).
We know that at perigee and apogee the auxiliary circle and the ellipse intersect. So
it can been seen from Fig.1 that for any value of eccentricity the value of eccentric
anomaly and mean anamaly is same.
As the value of eccentricity is increased, near the perigee the spacecraft sweeps more
angle so that Keplers Second law is satisfied. This can also be verified from the graph.
1
Figure 1: Variation of Eccentric anomaly with Mean Anomaly for different values of eccen-
tricites
2
Figure 2: Geocentric equatorial frame and the orbital elements
2 Question 2
Write a code to transform a state vector in to orbital elements. With this code transform the
following state vectors :
Case 1 :
x=-8503.8558701333313 ; xdot = -4.3229148869407341
y= 14729.110427313784 ; ydot = -2.3293249804847838
z= 6190.3008264368991 ; zdot = 5.24855402558600526E-002
Case 2 :
x =-13686.889393418738 ; xdot = 0.88259108105901152
y =-13344.772667428870 ; ydot = 1.9876415852134037
z = 10814.629905439588 ; zdot = 3.4114313525042017
Answer
Using MATLAB, a general code was written to transform a state vector into orbital elements.
The six orbital elements are: a-semi major axis.
e- eccentricity.
i-inclination.
-right ascension of the ascending node(RAAN).
- argument of perigee.
- true anomaly.
3
Results
First case -
Orbital Element Result from code
a(km) 20000.027200
e 0.100001
i(degrees) 20.000000
-raan(degrees) 30.000000
-omega(degrees) 70.000220
-nyu(degrees) 19.999780
Second case -
Orbital Element Result from code
a(km) 20000.018461
e 0.099999
i(degrees) 100.000000
-raan(degrees) 230.000000
-omega(degrees) 199.999888
-nyu(degrees) 190.000112
3 MATLAB codes
3.1 Question 1-Kepler Equation
%% Initialisation
clc;
clear all;
%% Given parameters
4
ylabel(Eccentric Anomaly,FontSize,14, FontName,Arial,FontWeight,bold);
hold on
end
legend(e=0.01,e=0.1,e=0.2,e=0.4,e=0.6,e=0.9)
f = x-(e*sin(x))-M;
df = 1 - (e*cos(x));
dx = -f/df;
x = x + dx;
end
fx=x; % Returns the answer to the main function
clc;
clear all;
%%
%AE313-SPACE FLIGHT MECHANICS
%Code to transform a state vector in to orbital elements.
%Written by Rahul Goud Togita(SC15B039)
%First Case - Given State vector is.
x1=-8503.8558701333313;
xdot1 = -4.3229148869407341;
y1=14729.110427313784 ;
ydot1 = -2.3293249804847838;
z1= 6190.3008264368991 ;
zdot1 = 5.24855402558600526E-002;
5
%%
i=[1 0 0]; % Unit vector in X_direction
j=[0 1 0]; % Unit vector in Y_direction
k=[0 0 1]; % Unit vector in Z_direction
r1=[x1 y1 z1]; %converting into position vector
v1=[xdot1 ydot1 zdot1]; %converting into Velocity vector
mr1=norm(r1); %magnitude of position vector
mv1=norm(v1); %magnitude of velocity
myu = 398600 ; %Gravitational Constant Units are km^3/s^2
%% Semi Major Axis
je1=(mv1*mv1-myu/mr1).*r1-dot(r1,v1).*v1;
e1=je1./myu; %eccentricity vector
me1=norm(e1); %magnitude of eccentricity
%% Inclination
if nyu1<0
nyu1=nyu1+360;
end
if omega1<0
omega1=omega1+360;
6
end
if raan1<0
raan1=raan1+360;
end
%Printing the values of orbital Elements.
fprintf(For First case--a=%f\n e=%f\n i=%f\n raan=%f\n omega=%f\n nyu=%f\n,...
a1,me1,inc1,raan1,omega1,nyu1)
%% For Second case-Given State vector is.
x2 =-13686.889393418738;
xdot2 = 0.88259108105901152;
y2 =-13344.772667428870;
ydot2 = 1.9876415852134037;
z2 = 10814.629905439588;
zdot2 = 3.4114313525042017 ;
%% Semi Major Axis
r2=[x2 y2 z2];
v2=[xdot2 ydot2 zdot2];
mr2=norm(r2);
mv2=norm(v2);
myu = 398600 ;
a2=(myu*mr2)/(2*myu-mr2*mv2*mv2);
%% Eccentricity
je2=(mv2*mv2-myu/mr2).*r2-dot(r2,v2).*v2;
e2=je2./myu;
me2=norm(e2);
%% Inclination
h2=cross(r2,v2);
mh2=norm(h2);
w2=h2./mh2;
k=[0 0 1];
i=[1 0 0];
j=[0 1 0];
ci2=dot(w2,k);
inc2=acosd(ci2);
%% Right ascension of ascending node
N2=cross(k,w2)./(norm(cross(k,w2)));
craan2=dot(N2,i);
sraan2=dot(k,cross(i,N2));
raan2=atan2d(sraan2,craan2);
%% Argument of Perigee
ecap2=e2./norm(e2);
7
comega2=dot(N2,ecap2);
somega2=dot(w2,cross(N2,ecap2));
omega2=atan2d(somega2,comega2);
%% True Anamoly
rcap2=r2./norm(r2);
cnyu2=dot(ecap2,rcap2);
snyu2=dot(w2,cross(ecap2,rcap2));
nyu2=atan2d(snyu2,cnyu2);
%% For Finding Positive Angles.
if nyu2<0
nyu2=nyu2+360;
end
if omega2<0
omega2=omega2+360;
end
if raan2<0
raan2=raan2+360;
end
fprintf(for Second case -- a=%f\n e=%f\n i=%f\n raan=%f\n omega=%f\n nyu=%f\n...
,a2,me2,inc2,raan2,omega2,nyu2)