-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlotLyapOrb.asv
139 lines (128 loc) · 3.87 KB
/
PlotLyapOrb.asv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
%{
...
Created on 28/02/2020 16:31 and modified on 9/3/2020
Plots the Lyapunov Orbits
Some plots might be clear, some might(change the xLim,yLim pertaining to
problem)
I am not sure how to make it generic
...
%}
function PlotLyapOrb(G_var,system)
systemparameters;
switch system
case 'ext'
OrbPar = load('LyapOrbParExt.mat');
case 'int'
OrbPar = load('LyapOrbParInt.mat');
LyapOrbPar = OrbPar.LyapOrb;
fun_EOM = G_var.IntFunc.EOM;
NoofFam = size(LyapOrbPar(1).time,1);
mu = G_var.Constants.mu;
%% ---------------------Lyap_L1 and Lyap_L2 Lyap_Lyap orbits-----------------------------
fprintf('\n')
fprintf('Plotting the Lyapunov orbits of L1 and L2 ...\n')
fprintf('\n')
figure()
for Loc = 1:size(LyapOrbPar,2)
for i = 1: 2: NoofFam
[~,x] = Integrator(G_var,fun_EOM,LyapOrbPar(Loc).IC(i,:),[0 LyapOrbPar(Loc).time(i,1)]);
x(:,1) = x(:,1)*lExt;
x(:,2) = x(:,2)*lExt;
x(:,3) = x(:,3)*lExt;
x(:,4) = x(:,4)*lExt*2*pi/Text;
x(:,5) = x(:,5)*lExt*2*pi/Text;
x(:,6) = x(:,6)*lExt*2*pi/Text;
switch Loc
case 1
plot(x(:,1),x(:,2),'k')
case 2
plot(x(:,1),x(:,2),'r')
case 3
plot(x(:,1),x(:,2),'g')
end
hold on
grid on
end
hold on
end
PlotContourEquilPoints(G_var,'L1L2NsecPrim','ext')
% if mu < 1e-6
% xlim([0.96 1.03]*lExt)
% ylim([-0.025 0.025]*lExt)
% elseif mu < 1e-4 && mu >1e-6
% xlim([0.8 1.25]*lExt)
% ylim([-0.18 0.18]*lExt)
% elseif mu > 1e-3
% xlim([0.3 1.7]*lExt)
% ylim([-0.4 0.4]*lExt)
% end
xlabel('\it{x-axis}')
ylabel('\it{y-axis}')
title('\it{Lyapunov orbits of L_{1} and L_{2}}')
set(gcf,'PaperPosition',[0 0 5 5]);
set(gcf,'PaperSize',[5 5])
%saveas(gcf, 'Lyap_L1L2_Orbits', 'pdf');
%% ---------------------Lyap_L1 Lyap_Lyap orbits-----------------------------
figure()
for i = 1: 2: NoofFam
[~,x] = Integrator(G_var,fun_EOM,LyapOrbPar(1).IC(i,:),[0 LyapOrbPar(1).time(i,1)]);
x(:,1) = x(:,1)*lExt;
x(:,2) = x(:,2)*lExt;
x(:,3) = x(:,3)*lExt;
x(:,4) = x(:,4)*lExt*2*pi/Text;
x(:,5) = x(:,5)*lExt*2*pi/Text;
x(:,6) = x(:,6)*lExt*2*pi/Text;
plot(x(:,1),x(:,2),'k')
hold on
end
grid on
PlotContourEquilPoints(G_var,'L1L2NsecPrim','ext')
% if mu < 1e-6
% xlim([0.96 1.03]*lExt)
% ylim([-0.025 0.025]*lExt)
% elseif mu < 1e-4 && mu >1e-6
% xlim([0.8 1.25]*lExt)
% ylim([-0.18 0.18]*lExt)
% else
% xlim([0.2 1.5]*lExt)
% ylim([-0.5 0.5]*lExt)
% end
%
xlabel('\it{x-axis}')
ylabel('\it{y-axis}')
title('\it{Lyapunov Orbits of L_1}')
set(gcf,'PaperPosition',[0 0 5 5]);
set(gcf,'PaperSize',[5 5])
%saveas(gcf, 'G:\My Drive\MATLAB\Matlb3BP\ThreeBodyProblemCodes\Restricted3BodyProblem\Figures\Lyap_L1_Orbit', 'pdf');
%saveas(gcf, 'Lyap_L1_Orbits', 'pdf');
%% ---------------------Lyap_L2 Lyap_Lyap orbits-----------------------------
figure()
for i = 1: 2: NoofFam
[~,x] = Integrator(G_var,fun_EOM,LyapOrbPar(2).IC(i,:),[0 LyapOrbPar(2).time(i,1)]);
x(:,1) = x(:,1)*lExt;
x(:,2) = x(:,2)*lExt;
x(:,3) = x(:,3)*lExt;
x(:,4) = x(:,4)*lExt*2*pi/Text;
x(:,5) = x(:,5)*lExt*2*pi/Text;
x(:,6) = x(:,6)*lExt*2*pi/Text;
plot(x(:,1),x(:,2),'k')
hold on
end
grid on
PlotContourEquilPoints(G_var,'L1L2NsecPrim','ext')
% if mu < 1e-6
% xlim([0.96 1.03]*lExt)
% ylim([-0.025 0.025]*lExt)
% elseif mu < 1e-4 && mu >1e-6
% xlim([0.8 1.25]*lExt)
% ylim([-0.18 0.18]*lExt)
% else
% xlim([0.2 1.5]*lExt)
% ylim([-0.5 0.5]*lExt)
% end
xlabel('\it{x-axis}')
ylabel('\it{y-axis}')
title('\it{Lyapunov Orbits of L_2}')
set(gcf,'PaperPosition',[0 0 5 5]);
set(gcf,'PaperSize',[5 5])
%saveas(gcf, 'Lyap_L2_Orbits', 'pdf');