########## 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()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)