import numpy as np
import matplotlib.pyplot as plt
angles = [30, 45, 60, 75]
v0 = 50
def calBombTrace(t, angle):
return v0 * t * np.cos(angle), v0 * t * np.sin(angle) - 0.5 * 9.8 * t * t
tmaxes = np.sin(np.radians(angle)) * 2 * v0 / 9.8
for i in range(len(angles)):
tmax = tmaxes[i]
ts = np.linspace(0, tmax, 30)
for j in range(30):
xt,yt = calBombTrace(ts[j], angles[i])
plt.plot(xt,yt,'r-')
plt.grid('on')
plt.axis([0, 6500, 0, 3000])
plt.show()