-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtools_satellite.py
102 lines (71 loc) · 2.36 KB
/
tools_satellite.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
import numpy as np
import json
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.constants import G
import modello_fisico as md
from params import *
def plotta(file,energia):
f = open(file)
data = []
for line in f:
data.append(json.loads(line))
data = np.array(data)
#estrai colonne
x = data[:,0]
y = data[:,1]
x_int = np.linspace(1,len(energia),len(energia))
if area != None :
plt.figure(1)
plt.subplot(221)
plt.plot(x, y)
plt.grid(True)
plt.title('Orbita')
circle = plt.Circle((0,0),md.raggio_terrestre,color ='g',fill=False)
fig = plt.gcf()
ax = fig.gca()
ax.add_artist(circle)
plt.xlabel('metri')
plt.subplot(222)
plt.plot(x_int*md.h_inter,energia)
plt.grid(True)
plt.title('Energia meccanica')
plt.xlabel('secondi')
plt.ylabel('joule')
plt.subplot(212)
altezza = data[:,6] - md.raggio_terrestre
plt.plot(x_int*md.h_inter,altezza)
plt.grid(True)
plt.title('Altezza')
plt.xlabel('secondi')
plt.ylabel('metri')
else:
plt.figure(1)
plt.subplot(221)
plt.plot(x, y)
plt.grid(True)
plt.title('Orbita')
plt.xlabel('metri')
plt.subplot(222)
plt.plot(x_int*md.h_inter,energia)
plt.grid(True)
plt.title('Energia meccanica')
plt.xlabel('secondi')
plt.ylabel('joule')
plt.subplot(223)
y_2 = (data[:,6] - distanza )/distanza
plt.plot(x_int*md.h_inter,y_2)
plt.grid(True)
plt.title('Errore raggio')
plt.xlabel('secondi')
plt.ylabel('Errore relativo')
plt.subplot(224)
energia_cinetica = 0.5*m2*(np.sqrt(G*M1/distanza))**2
energia_ideale = energia_cinetica - G*M1*m2/distanza
errore_en = (energia - energia_ideale)/energia_ideale
plt.grid(True)
plt.title('Errore Energia meccanica')
plt.plot(x_int*md.h_inter,errore_en)
plt.xlabel('secondi')
plt.ylabel('Errore Relativo')
return