-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode1.py
More file actions
26 lines (23 loc) · 688 Bytes
/
Copy pathcode1.py
File metadata and controls
26 lines (23 loc) · 688 Bytes
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
from pylab import *
import matplotlib.pyplot as plt
def list_generator1():
time1 = linspace(0,5,50)
yi= int(input("what is the initial height of your trajectory? "))
g = 9.8
vi = int(input("What is the initial velocity of the particle? "))
list1 = []
for a in time1:
y_coordinate = yi + vi*a - (1/2)*g*(a**2) #formula for calculating the trajectory
list1.append(y_coordinate)
for heights in list1:
a = list1.index(heights)
if heights <0:
list1[a] = 0
print(time1)
print(list1)
figure()
plot(time1, list1)
xlabel("time")
ylabel("height")
plt.show()
list_generator1()