Académique Documents
Professionnel Documents
Culture Documents
QUESTION 5
Figure below shows the zero-velocity contours and L1-L5 points. Decreasing C (increasing
magitude of contours) means increasing energy. Dark red areas are highly inaccessible that
needs alot of energy to pass.
-3.5 -3.5
-3.17
-3.1
-3.17
-3.2
-3.01
-3.01
L4
-4
0.5
-3.3
-4
-3.4
0
Earth
L1
L2
-3.5
-3.5
-4 L3 -4
-3.5
-3.6
-3.5 -3.5
-0.5
-3.01-3.01
-3.19
-3.19
-3.7
L5
-3.8
-1
-3.19
-3.19
-3.9
-4 -4
-1.5
-1.5
-1
-0.5
0
0.5
Distance Units (DU)
1.5
-4
MATLAB CODE
%%% QUESTION 5 CR3BP for Earth-Moon system
clear all;
clc;
% Earth-mass ratio non dimensional
mu = 1/(81.3+1); % m2/(m1+m2)
% create z data
x=-1.5:.01:1.55; %to increase the resolution of the surfaces, %change the
middle number..default is .05
y=-1.5:.01:1.55;
for i=1:length(x)
for j=1:length(y)
z(j,i)=x(i)^2+y(j)^2+2*(1-mu)/sqrt((x(i)+mu)^2
+y(j)^2)+2*mu/sqrt((x(i)-1+mu)^2+y(j)^2); % height of contours in terms of
C, potential
end
end
Mariusz Santora
%% Parameters
% L2 liberation point
v(1) = 3.012147;
% L3 liberation point
v(2) = 3.188342;
% L1 liberation poin
v(3) = 3.172161;
% L4 and L5 liberation points
v(4) = 2.987887;
v(5) = 2.987887;
% Other points
v(6) = 3.5;
v(7) = 4;
contourlevels=length(v);
disp('Contour Levels');
disp(contourlevels)
% plot zero relative-velocity contours
figure
[c, h] = contourf(x, y, -z, [-v -v]);
clabel(c, -v) % lower V means higher energy, higher v -> higher energy
xlabel('Distance Units (DU)')
ylabel('Distance Units (DU)')
title('Zero-velocity contours in Earth-Moon System', 'FontSize', 14)
colorbar;
hold on
scatter3(0, 0, 0, 20, 'k', 'filled'); % Earth
text(0,0.1,0,'Earth','Color','k');
scatter3(0.99, 0, v(1), 2, 'k', 'filled'); % Moon
scatter3(0.83629259089993, 0, v(1), 10, 'y', 'o'); % L2 point
text(0.67,0,0,'L2','Color','k');
scatter3(1.15616816590553, 0, v(2), 10, 'y', 'o'); % L3 point
text(1.25,0,0,'L3','Color','k');
scatter3(-1.00511551160689, 0, v(3), 10, 'y', 'o'); % L1 point
text(-1.17,0,0,'L1','Color','g');
scatter3(0.48772252900000, 0.86602540378444, v(4), 10, 'y', 'o'); % L4
point
text(0.55,0.75,0,'L4','Color','g');
scatter3(0.48772252900000, -0.86602540378444, v(5), 10, 'y', 'o'); % L5
point
text(0.55,-0.75,0,'L5','Color','g');
Mariusz Santora
QUESTION 6
a)
Zero-velocity contours in Earth-Moon System and Trajectory
1.5
C=2.988400
-2.99
L4
0.5
Earth
L1
L2
L3
-0.5
L5
-2.99
-1
-1.5
-1.5
-1
-0.5
0
0.5
Distance Units (DU)
1.5
1.2
C=2.988400
1
-2.99
0.8
L4
0.6
0.4
0.2
Earth
-0.2
0.2
0.4
0.6 L2 0.8
Distance Units (DU)
L3
The trajectory is librating about Lagrange Point L4 and cannot reach the point since
Ctrajectory = 2.988400 < CL4 = 2.987997. Therefore it would require slightly more energy to
achieve a trajectory at this point. Since Ctrajectory is higher than the rest of the Zero-velocity
contours, the trajectory can potentially reach other Lagrange Points given sufficient
time.
L5
Mariusz Santora
b)
Zero-velocity contours in Earth-Moon System and Trajectory
1.5
L4
0.5
C=C3=3.172161
0
Earth
L1
L2
L3
-0.5
L5
-1
-3.17
-1.5
-1.5
-1
-0.5
0
0.5
1
1.5
Distance Units (DU)
Zero-velocity contours in Earth-Moon System and Trajectory
0.3
0.2
0.1
L2
L3
-0.1
-0.2
-0.3
0.6
0.7
0.8
0.9
1
1.1
Distance Units (DU)
1.2
1.3
The trajectory can escape the Earth-Moon system since Ctrajectory = C3 = 3.172161. The
neck at L3 opens up when the trajectory has this energy and it can pass through L3 and out of
the system (e.g. to other planets).
L5
Mariusz Santora
MATLAB CODE
%%% Question 6:CR3BP with Trajectory for Earth-Moon system
%% Zero-velocity contours (from Q.5)
clear all;
clc;
% Earth-mass ratio non dimensional
global mu
mu = 1/(81.3+1); % m2/(m1+m2)=1/(m1/m2+1)
% create z data
x=-1.5:.01:1.55; %to increase the resolution of the surfaces, %change the
middle number..default is .05
y=-1.5:.01:1.55;
for i=1:length(x)
for j=1:length(y)
z(j,i)=x(i)^2+y(j)^2+2*(1-mu)/sqrt((x(i)+mu)^2
+y(j)^2)+2*mu/sqrt((x(i)-1+mu)^2+y(j)^2); % height of contours in terms of
C, potential
end
end
% Parameters
% L1 liberation point
C(1) = 3.012147;
% L2 liberation point
C(2) = 3.188342;
% L3 liberation point
C(3) = 3.172161;
% L4 and L5 liberation points
C(4) = 2.987887;
C(5) = 2.987887;
% Other points
C(6) = 3.5;
C(7) = 4;
% Trajectory
C(8)=2.9884;
% C(8)=C(3);
contourlevels=length(C);
Mariusz Santora
disp('Contour Levels');
disp(contourlevels)
%% Trajectory with contours
% Initial Conditions of trajectory for part a)
x01=[0.4925060 0.85 0 0 0 0]';
C1=2.988400;
v1=sqrt(x01(1)^2+x01(2)^2+2*(1-mu)/sqrt((x01(1)+mu)^2
+x01(2)^2)+2*mu/sqrt((x01(1)-1+mu)^2+x01(2)^2)-C1);
% Initial Conditions of trajectory for part b)
% x01=[1.15 0.00994 0 0 0 0]';
%
% C2=C(3);
%
% v2=sqrt(x01(1)^2+x01(2)^2+2*(1-mu)/sqrt((x01(1)+mu)^2
+x01(2)^2)+2*mu/sqrt((x01(1)-1+mu)^2+x01(2)^2)-C2);
%Absolute & Relative Tolerances
NewOpts=odeset('AbsTol',1e-12,'RelTol',1e-12);
% Period
tau1=0:0.01:100; % time period of 24 hours
% Ordinary Differential Equation Output
[T0, X0]=ode45(@cr3bp_trajectory, tau1, x01', NewOpts);
%% Plots
% plot zero relative-velocity contours
figure
[c, h] = contourf(x, y, -z, [-C(8) -C(8)]);
clabel(c, -C(8)) % Higher potential V means lower energy
xlabel('Distance Units (DU)')
ylabel('Distance Units (DU)')
title('Zero-velocity contours in Earth-Moon System and Trajectory',
'FontSize', 12)
colorbar;
hold on
text(0,0.1,0,'Earth','Color','k');
scatter3(0.83629259089993, 0, -C(1), 10, 'b', 'o'); % L1 point
text(0.67,0,0,'L2','Color','k');
scatter3(1.15616816590553, 0, -C(2), 10, 'b', 'o'); % L2 point
text(1.25,0,0,'L3','Color','k');
scatter3(-1.00511551160689, 0, -C(3), 10, 'b', 'o'); % L3 point
text(-1.17,0,0,'L1','Color','k');
scatter3(0.48772252900000, 0.86602540378444, -C(4), 10, 'b', 'o'); % L4
point
text(0.55,0.75,0,'L4','Color','k');
Mariusz Santora
scatter3(0.48772252900000, -0.86602540378444, -C(5), 10, 'b', 'o'); % L5
point
text(0.55,-0.75,0,'L5','Color','k');
% Graph of Trajectory
plot3(X0(:,1),X0(:,2),X0(:,3),'b') % Plots the trajectory
axis square
text(-mu,1.1,0,'C=2.988400','Color','k');
% Earth and Moon
plot(-mu, 0, '*g');
plot(1 - mu, 0, '*b');
hold off
x0(1)
x0(2)
x0(3)
x0(4)
x0(5)
x0(6)
=
=
=
=
=
=
x-component
y-component
z-component
x-component
y-component
z-component
of
of
of
of
of
of
position
position
position
velocity
velocity
velocity
% output
%
%
%
%
%
%
ydot(1)
ydot(2)
ydot(3)
ydot(4)
ydot(5)
ydot(6)
=
=
=
=
=
=
x
y
z
x
y
y
component
component
component
component
component
component
of
of
of
of
of
of
velocity
velocity
velocity
acceleration
acceleration
acceleration
global mu
r1 = sqrt((x0(1)+mu)^2+x0(2)^2+x0(3)^2);
r2 = sqrt((x0(1)-1+mu)^2+x0(2)^2+x0(3)^3);
% integration vector [xdot, ydot, zdot, xdotdot, ydotdot, zdotdot]
x0dot = [x0(4) x0(5) x0(6) 2*x0(5)+x0(1)-(1-mu)*(x0(1)+mu)/r1^3-mu*(x0(1)1+mu)/r2^3 -2*x0(4)+x0(2)-(1-mu)*x0(2)/r1^3-mu*x0(2)/r2^3 -x0(6)*(1mu)/r1^3-x0(6)*mu/r2^3]';
Mariusz Santora
QUESTION 7
Return Trajectory from Moon to Earth (CR3BP)
0.3
0.2
0.1
Moon
0
L2
Earth
-0.1
-0.2
-0.3
-0.4
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0.005
-0.005
-0.01
0.965
0.97
0.975
0.98
0.985
0.99
Mariusz Santora
Return Trajectory from Moon to Earth (CR3BP)
0.025
0.02
0.015
0.01
0.005
0
-0.005
-0.01
-0.015
-0.02
-0.02
-0.01
0.01
0.02
0.03
0.018
0.016
Earth
0.014
0.012
0.01
0.008
-16
-14
-12
-10
-8
-6
-4
-2
-3
x 10
Mariusz Santora
b)
Nominal
24.9637
Initial Vy
Computed
Error,
degree
Computed initial Vy
Error
velocity
23.9886
-0.9751
-1
-2.476641255892641
-0.0004 km/s =
- 0.4 m/s
25.9800
1.0163
+1
-2.475841255892641
+0.0004 km/s =
- 0.4 m/s
-2.476241255892641
Nominal
24.9637
Computed initial Vy
Error
velocity
Computed
Error,
degree
-2.477241255892641
-0.001 km/s =
- 1 m/s
22.6307
- 2.333
-2.475241255892641
+0.001 km/s =
+ 1m/s
27.6781
+ 2.7144
-2.476241255892641
Mariusz Santora
Mariusz Santora
tau=0:0.000001:1; % time period of 24 hours nominal
tau=0:0.00001:0.658699999999999785 %0.658639999999999785
% Ordinary Differential Equation Output
[T0, X0]=ode45(@cr3bp_trajectory, tau, x0', NewOpts);
% Intersection with Earth's atmosphere
y2eNew=(y2e);
y1eNew=(y1e);
x1eNew =(x2e);
xco = X0(:,1);
yco = X0(:,2);
zco = X0(:,3);
index = 0 ;
minimum = 3;
error = zeros(1,length(xco));
uu=length(xco);
for vv=2:length(xco)
error(uu)=abs((sqrt((xco(uu)-xc1)^2+(yco(uu))^2)-radius1));
if error(uu)<minimum
minimum =error(uu);
index=uu;
end
disp(100*vv/length(xco))
uu=uu-1; % breaks the loop when intersection occurs
end
figure(2)
stem(error)
TrueX= xco(1:index);
TrueY= yco(1:index);
TrueZ = zco(1:index);
%% Plots
figure
plot(xe,ye,'g') % Plots Earth's atmosphere
hold on
plot(xm,ym,'b') % Plots Moon
plot(xe2,ye2, 'b'); % Plots Earth
plot(xm2,ym2, 'c'); % Plots Moon's Orbit
scatter3(0.83629259089993, 0, 0, 10, 'k', '*'); % L2 point
text(0.79,0,0,'L2','Color','k');
text(-mu,-0.05,0,'Earth','Color','k');
text(0.9,0.04,0,'Moon','Color','k');
title('Return Trajectory from Moon to Earth (CR3BP)', 'FontSize', 12)
% Graph of Trajectory
plot3(TrueX,TrueY,TrueZ,'r') % Plots the trajectory
axis equal
hold off
%% Entry Angle at Atmospheric Interface
rx=X0(index,1); % position in x-direction
ry=X0(index,2); % position in y-direction
rz=X0(index,3); % position in y-direction
r_vector=[rx ry rz]; % position vector
r=sqrt(rx^2+ry^2+rz^2); % position magnitude
vx=X0(index,4); % Velocity in x-direction
vy=X0(index,5); % Velocity in y-direction
Mariusz Santora
vz=X0(index,6); % Velocity in y-direction
v_vector=[vx vy vz]; % velocity vector
v=sqrt(vx^2+vy^2+vz^2); % velocity magnitude
gamma=atan(vy/vx)*180/pi; % Entry Angle at h = 100 km Nominal Entry angle:
24.9637 deg
gammanom=24.9637;
gamma1=23.9637;
gamma2=25.9637;
disp('Flight Path Angle in degrees, Gamma: ');
disp(gamma);
disp(' Nominal Flight Path Angle in degrees, Gamma: ');
disp(gammanom);
function x0dot = cr3bp_trajectory (tsim, x0)
% first order circular restricted
% three-body equations of motion
% input
%
%
%
%
%
%
x0(1)
x0(2)
x0(3)
x0(4)
x0(5)
x0(6)
=
=
=
=
=
=
x-component
y-component
z-component
x-component
y-component
z-component
of
of
of
of
of
of
position
position
position
velocity
velocity
velocity
% output
%
%
%
%
%
%
ydot(1)
ydot(2)
ydot(3)
ydot(4)
ydot(5)
ydot(6)
=
=
=
=
=
=
x
y
z
x
y
y
component
component
component
component
component
component
of
of
of
of
of
of
velocity
velocity
velocity
acceleration
acceleration
acceleration
global mu
r1 = sqrt((x0(1)+mu)^2+x0(2)^2+x0(3)^2);
r2 = sqrt((x0(1)-1+mu)^2+x0(2)^2+x0(3)^3);
% integration vector [xdot, ydot, zdot, xdotdot, ydotdot, zdotdot]
x0dot = [x0(4) x0(5) x0(6) 2*x0(5)+x0(1)-(1-mu)*(x0(1)+mu)/r1^3-mu*(x0(1)1+mu)/r2^3 -2*x0(4)+x0(2)-(1-mu)*x0(2)/r1^3-mu*x0(2)/r2^3 -x0(6)*(1mu)/r1^3-x0(6)*mu/r2^3]';