Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

For Finding Orbital Elements of number 2:

%Used to Solve for the orbital elements of problem 2


%
mu=398600
%Radius and Velocity Vectors
R1=[-2429.1 4555.1 4577];
V1=[-4.7689 -5.6113 3.0535];
%Magnitude of Radius and Velocity Vector
r1=norm(R1);
v1=norm(V1);
%Radial Velocity
Vr=(dot(R1,V1))/r1;
%Specific Angular Momentum Vector and Magnitude
H=cross(R1,V1);
h=norm(H);
%Solving for i= Inclination Angle
i= acosd(H(3)/h)
%K vector defined
K=[0 0 1];
%Node line Vector and Magnitude
N=cross(K,H);
n=norm(N);
%Solving for RA= Right Ascension of the ascending node
if N(2)>=0
RA= acosd(N(1)/n)
elseif N(2)<0
RA=360-acosd(N(1)/n)
end
%Eccentricity Vector and Magnitude
E=(1/mu)*(cross(V1,H)-(R1*(mu/r1)));
e=norm(E);
%Solving for AP= Argument of Perigee
if E(3)>= 0
AP=acosd(dot(N,E)/(n*e))
elseif E(3)<0
AP=360-acosd(dot(N,E)/(n*e))
end
%Solving for Theta= True Anomaly
if Vr>=0
Theta=acosd((1/e)*((h.^2/mu*r)-1))
elseif Vr<0
Theta=360-acosd((1/e)*((h^2/mu*r1)-1))
end

Answers (ouputs):
i = 50.0003

RA = 70.0004

e = 0.1000

AP = 60.0000

Theta = 3.6000e+002 -1.1900e+003i~0

You might also like