-
Notifications
You must be signed in to change notification settings - Fork 1
/
graph.py
32 lines (25 loc) · 1.83 KB
/
graph.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
import matplotlib.pyplot as plt
originalData = [102, 154.11, 209, 492.67, 308, 992.17, 410, 1390.81, 512, 1647.28, 614, 1759.12, 717, 1813.09, 818, 1849.96, 920, 1924.03, 1023, 2018.55, 1129, 2100.45, 1227, 2249.17, 1329, 2435.81, 1430, 2606.91, 1533, 2718.49, 1635, 2699.94, 1738, 2342.06, 1839, 1272.02, 1941, 263.50, 2043, 10.07, 2145, 8.83, 2247, 36.12, 2349, 151.32, 2451, 623.65, 2554, 1288.92, 2656, 1715.99, 2757, 1893.18, 2860, 1937.46, 2962, 1939.07, 3064, 1948.35, 3166, 1962.37, 3268, 1983.75, 3370, 1998.01, 3472, 1986.29, 3575, 1968.73, 3676, 1922.18, 3778, 1403.63, 3881, 466.78, 3982, 49.61, 4085, 5.01, 4186, 4.28, 4288, 22.97, 4391, 279.38, 4493, 934.76, 4594, 1364.24, 4700, 1471.71, 4799, 1476.84, 4902, 1454.73, 5003, 1437.64, 5105, 1438.82, 5208, 1453.30, 5309, 1490.57, 5412, 1539.52, 5514, 1624.32, 5615, 1785.99, 5718, 1991.91, 5820, 2215.87, 5922, 2412.49, 6024, 2610.16, 6126, 2822.87, 6228, 2997.68, 6330, 3152.94, 6433, 3348.36, 6534, 3481.96, 6636, 3636.29, 6739, 3797.23, 6840, 3850.26, 6943, 3761.06, 7045, 3619.90, 7146, 3081.30, 7249, 2045.76, 7351, 911.54, 7452, 299.18, 7555, 56.82, 7657, 5.38, 7759, 5.73, 7861, 20.14, 7963, 268.06, 8065, 1124.49, 8167, 2132.30, 8273, 2730.02, 8372, 2981.75, 8473, 3075.75, 8576, 3222.31, 8678, 3443.44, 8780, 3624.98, 8882, 3706.82, 8984, 3784.23, 9086, 3938.45, 9188, 4149.12]
x = []
y = []
for i, num in enumerate(originalData):
if i % 2 == 0:
x.append(originalData[i])
else:
y.append(originalData[i])
if len(x) != len(y):
print("Error: x and y must have the same")
exit(1)
plt.plot(x, y, '-o')
plt.title('Graph Force@Time')
plt.xlabel('Time/ms')
plt.ylabel('Force/g')
# plt.grid(True)
plt.show()
maxVal = 0
maxIndex = 0
for i in range(len(y)):
if y[i] > maxVal:
maxVal = y[i]
maxIndex = x[i]
print('Time: ', maxIndex, ', MaxValue: ', maxVal)