-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.py
66 lines (52 loc) · 3.8 KB
/
main.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
import math
import matplotlib.pyplot as plt
force=[0.2066713601,1.604845544,3.884477364,6.468060095,10.20665628,14.61394447,19.78110993,25.2522263,29.53793412,32.09112176,32.91178922,31.84796103,28.96042739,24.40116375,19.23399829,14.70512974,11.27048446,8.869272279,7.501493187,6.802406095,6.772011004,7.379912823,8.626111552,10.41942192,12.30391756,13.88446228,14.97868556,15.61698247,15.76895792,15.5257972,14.8571052,14.03643774,12.97260956,12.06075683,11.27048446,10.87534828,10.63218755,10.72337283,10.84495319,11.02732374,11.20969428,11.39206483,11.42245992,11.30087955,11.27048446,11.20969428,11.1489041,11.11850901,11.17929919,11.17929919,11.17929919,11.17929919,11.17929919,11.1489041,11.1489041,11.11850901,11.08811392,10.99692865,10.96653355,10.84495319,10.75376792,10.69297774,10.51060719,10.38902683,10.17626119,10.08507592,9.902705371,9.750729916,9.629149553,9.53796428,9.446779007,9.385988825,9.325198643,9.203618279,9.112433007,9.021247734,8.930062461,8.808482097,8.717296824,8.656506642,8.56532137,8.443741006,8.382950824,8.291765551,8.230975369,8.170185187,8.109395005,8.018209733,7.92702446,7.805444096,7.683863732,7.531888278,7.440703005,7.319122641,7.227937368,7.167147186,7.136752095,7.075961913,7.015171732,6.984776641,6.893591368,6.832801186,6.741615913,6.65043064,6.498455185,6.346479731,6.255294458,6.042528821,5.920948458,5.799368094,5.708182821,5.647392639,5.556207366,5.556207366,5.495417184,5.465022093,5.465022093,5.404231911,5.313046639,5.252256457,5.161071184,5.100281002,5.069885911,4.978700638,4.857120275,4.765935002,4.70514482,4.583564456,4.492379183,4.431589001,4.370798819,4.249218456,4.188428274,4.127638092,4.06684791,3.945267546,3.884477364,3.823687182,3.793292091,3.73250191,3.702106819,3.641316637,3.580526455,3.550131364,3.519736273,3.458946091,3.428551,3.398155909,3.276575545,3.185390273,3.124600091,3.063809909,2.972624636,2.911834454,2.851044272,2.759858999,2.729463908,2.638278636,2.577488454,2.547093363,2.486303181,2.425512999,2.364722817,2.334327726,2.243142453,2.182352271,2.15195718,2.12156209,2.060771908,2.030376817,2.030376817,1.999981726,1.969586635,1.939191544,1.908796453,1.878401362,1.81761118,1.787216089,1.726425907,1.726425907,1.696030816,1.635240634,1.604845544,1.544055362,1.513660271,1.48326518,1.452870089,1.422474998,1.361684816,1.331289725,1.270499543,1.240104452,1.17931427,1.148919179,1.118524088,1.088128997,1.057733907,1.057733907,0.9969437246,0.9665486337,0.9361535427,0.8753633608,0.8753633608,0.8449682699,0.814573179,0.784178088,0.7537829971,0.7537829971,0.7233879061,0.6929928152,0.6929928152,0.6625977242,0.6018075424,0.6018075424,0.6018075424,0.5714124514,0.5410173605,0.5106222695,0.4802271786,0.4802271786,0.4194369967,0.4194369967,0.3890419057,0.3282517239,0.2978566329,0.267461542,0.237066451,0.2066713601,0.2066713601,0.1762762691,0.1154860873,0.08509099631,0.05469590536,0.02430081442,0.02430081442]
#Notes:
#This uses the trapezoidal rule at the moment.
t=0.0017
s=0
time=[]
areaf=[]
g=[1,2,3]
h=[4,5,6]
def round(x):
if (x/t)-(x//t)<(0.5):
return(int(x/t))
else:
return(math.ceil(x/t))
def calc(a1,b1):
a=round(float(a1))
b=round(float(b1))
i=[]
j=[]
if b-a==0:
return(0)
if b-a==1:
return(0)
for h in range(int(a),int(b)+1,1):
i.append(h)
for g in range(int(a)+1,int(b),1):
j.append(g)
sum1=[]
for index in i:
sum1.append(force[index])
sum2=[]
for index in j:
sum2.append(force[index])
s=0.5*t*(sum(sum1)+sum(sum2))
return(s)
for k in range(0,235):
time.append(int(k)*t)
for l in range(0,235):
areaf.append(calc(l*t,234*t))
plt.plot(time,areaf)
plt.xlabel('time')
plt.ylabel('area')
plt.show(block=True)
#from csv import reader
#force1=[]
#with open('bruh.csv') as read_obj:
#csv_reader = reader(read_obj)
#for row in csv_reader:
#force1.append(str(row)[2:-2])
#force=('[%s]' % ','.join(map(str, force1)))