※ 绘制炸弹轨迹 V——绘制多条轨迹
作者:互联网
########## Begin ##########
import numpy as np
import matplotlib.pyplot as plt
def calBombTrace(h, v0):
g,n = 9.8,30
tmax = (2*h/g)**0.5
t = np.linspace(0, tmax, n)
xt = v0*t
yt = h-1/2*g*t**2
return xt, yt
H = [3000, 2000, 1000]
V0 = [200, 260, 230]
for h in H:
for v0 in V0:
xt,yt = calBombTrace(h,v0)
plt.plot(xt,yt,'r-')
plt.grid('on')
plt.axis([0, 6500, 0, 3000])
plt.show()
########## End ##########
plt.savefig( 'src/step6/student/pic.png' )
plt.close()
标签:轨迹,多条,v0,plt,3000,##########,绘制,yt,xt 来源: https://blog.csdn.net/qq_42833469/article/details/121333327