其他分享
首页 > 其他分享> > 绘制迫击炮弹运行轨迹

绘制迫击炮弹运行轨迹

作者:互联网

########## Begin ##########
import numpy as np
import matplotlib.pyplot as plt
def calBombTrace(d, v0=50, n=30):
    g = 9.8
    tmax = 2*v0*np.sin(np.radians(d))/g
    t = np.linspace(0, tmax, n)
    xt = v0*t*np.cos(np.radians(d))
    yt = v0*t*np.sin(np.radians(d))-1/2*g*t**2
    return xt, yt
D = [30, 45, 60, 75]
for d in D:
    xt,yt = calBombTrace(d)
    plt.plot(xt,yt,'r-')
plt.grid('on')
plt.axis([0, 260, 0, 120])
plt.show()
########## End ##########
plt.savefig( 'src/step6/student/pic.png' )
plt.close()

标签:轨迹,yt,v0,##########,plt,np,绘制,迫击炮弹,xt
来源: https://blog.csdn.net/qq_42833469/article/details/121354432