-
Notifications
You must be signed in to change notification settings - Fork 2
/
rateOfChangePerturbation.py
176 lines (140 loc) · 4.57 KB
/
rateOfChangePerturbation.py
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import twoBodyTool
import numpy as np
from scipy.integrate import odeint
from twoBodyTool import F, F1, sv2coe, RE, J2, miu, rate
x0 = -6045
y0 = -3490
z0 = 2500
vx0 = -3.457
vy0 = 6.618
vz0 = 2.533
t = np.linspace(0,8200 * 11, 100000)
solution1 = odeint(F1, [x0, y0, z0, vx0, vy0, vz0], t)
results1 = []
for data in range(0, 100000):
r_test = np.squeeze(solution1[data:data+1, 0:3])
v_test = np.squeeze(solution1[data:data+1, 3:6])
t1 = np.linspace(0,(8200 * 11) / 3600, data+1)
results1.append(sv2coe(r_test, v_test))
results1 = np.array(results1)
rateFactor = results1[:1,8]*J2*((RE*10**(-3)/results1[:1,9])**2)
omgRate = -(3/2)*(rateFactor*np.cos(results1[:1,1]*np.pi/180))
omgCaseRate = (3/4)*rateFactor*(5*(np.cos(results1[:1,1]*np.pi/180)**2)-1)
i = results1[:1,1]
n = results1[:1,8]
p = results1[:1,9]
omgRate, omgCaseRate = rate(i, n, p)
# In[9]:
import numpy as np
import pylab as plot
import matplotlib.pyplot as plt
import numpy, scipy, pylab, random
from matplotlib.ticker import MultipleLocator
import matplotlib as mpl
from matplotlib.ticker import MaxNLocator
from scipy import stats
x1 = results1[:, 4]
y1 = t1
slope, intercept, r_value, p_value, std_err = stats.linregress(y1,x1)
line = slope*y1+intercept
plt.plot(y1, line, 'red', label='fitted line')
plt.scatter(y1,x1,color='green', s=3)
plt.show()
# In[10]:
import numpy as np
import pylab as plot
import matplotlib.pyplot as plt
import numpy, scipy, pylab, random
from matplotlib.ticker import MultipleLocator
import matplotlib as mpl
from matplotlib.ticker import MaxNLocator
from scipy import stats
plt.figure(figsize=(16.53, 11.69), dpi=600)
x1 = t1
y1 = results1[:, 0]
plt.subplot(3, 2, 1)
slope, intercept, r_value, p_value, std_err = stats.linregress(x1,y1)
line = slope*x1+intercept
plt.plot(x1, line, 'red', label='fitted line')
plt.scatter(x1,y1,color='blue', s=3)
plt.grid(True)
plt.xlabel("Time (in hours)")
plt.ylabel(r'$\alpha$' + ' (in km)')
plt.title("Variation of Semimajor Axis for one orbital period \n")
#plt.ylim((8785, 8790))
#plt.xticks(np.arange(0, 8200, 1000))
x2 = t1
y2 = results1[:, 1]
plt.subplot(3, 2, 2)
slope, intercept, r_value, p_value, std_err = stats.linregress(x2,y2)
line = slope*x2+intercept
plt.plot(x2, line, 'red', label='fitted line')
plt.scatter(x2,y2,color='green', s=3)
plt.grid(True)
plt.xlabel("Time (in hours)")
plt.ylabel('i' + ' (in degree)')
plt.title("Variation of Inclination of orbit for one orbital period \n")
#plt.ylim((150, 155))
#plt.xticks(np.arange(0, 8200, 1000))
x3 = t1
y3 = results1[:, 2]
plt.subplot(3, 2, 3)
slope, intercept, r_value, p_value, std_err = stats.linregress(x3,y3)
line = slope*x3+intercept
plt.plot(x3, line, 'red', label='fitted line')
plt.scatter(x3,y3,color='yellow', s=3)
plt.grid(True)
plt.xlabel("Time (in hours)")
plt.ylabel(r'$\Omega$' + ' (in degree)')
plt.title("Variation of Right ascencion of the ascending node for one orbital period \n")
#plt.ylim((255, 256))
#plt.xticks(np.arange(0, 8200, 1000))
x4 = t1
y4 = results1[:, 3]
plt.subplot(3, 2, 4)
slope, intercept, r_value, p_value, std_err = stats.linregress(x4,y4)
line = slope*x4+intercept
plt.plot(x4, line, 'red', label='fitted line')
plt.scatter(x4,y4,color='brown', s=3)
plt.grid(True)
plt.xlabel("Time (in hours)")
plt.ylabel("e")
plt.title("Variation of Eccentricity for one orbital period \n")
#plt.ylim((0, 0.3))
#plt.axis('equal')
#plt.xticks(np.arange(0, 8200, 1000))
x5 = t1
y5 = results1[:, 4]
plt.subplot(3, 2, 5)
slope, intercept, r_value, p_value, std_err = stats.linregress(x5,y5)
line = slope*x5+intercept
plt.plot(x5, line, 'red', label='fitted line')
plt.scatter(x5,y5,color='orange', s=3)
plt.grid(True)
plt.xlabel("Time (in hours)")
plt.ylabel(r'$\omega$' + ' (in degree)')
plt.title("Variation of Argument of perigee for one orbital period \n")
#plt.ylim((10, 25))
#plt.xticks(np.arange(0, 8200, 1000))
x6 = t1
y6 = results1[:, 5]
plt.subplot(3, 2, 6)
slope, intercept, r_value, p_value, std_err = stats.linregress(x6,y6)
line = slope*x6+intercept
plt.plot(x6, line, 'red', label='fitted line')
plt.scatter(x6,y6,color='pink', s=3)
plt.grid(True)
plt.xlabel("Time (in hours)")
plt.ylabel(r'$\theta$' + ' (in degree)')
plt.title("Variation of True Anomaly for one orbital period \n")
#plt.ylim((10, 35))
plt.subplots_adjust(hspace=0.5, wspace=0.3)
plt.suptitle("Variations of Classical Orbital Elements over one orbital period \n under J2 perturbation", fontsize=18, fontweight=700)
#plt.figure(figsize=(11.69, 16.53), dpi=600)
#plt.savefig('coeSimulation.pdf', dpi=600)
plt.savefig('regressionPerturbation.pdf')
plt.show()
# In[ ]: