@rrtcc
2016-10-23T16:10:00.000000Z
字数 1694
阅读 19
迎面风阻
最小速度
高度
在引入迎面风阻时,假设风向水平,炮弹所受的的空气阻力如下
依据题意可以设计如下代码
import math
xx = 4000#unit:m
yy = 120 #unit:m
g = 9.8 #unit:m/s
a = (6.5)*(math.pow(10,-3))
Bm = 4*math.pow(10,-5) #unit:m^(-1)
T = 300 #unit:K
vw = -10 #unit:m/s
va = 300 #unit:m/s
sv = [va]
sa = [0]
s = xx
for i in range(21):
v = va
v0 = 0
angle = 25 + i*1
for j in range(20):
x = [0] #unit:m
y = [0] # unit:m
dt = 0.1 #unit:s
vx = [v*math.cos(math.pi*angle/180)]
vy = [v*math.sin(math.pi*angle/180)]
while (x[-1]<=xx):
if y[-1] > 46100:
c = 0
else:
c = math.pow((1-(a*y[-1]/T)),2.5)
Fx = -Bm*math.sqrt((v-vw)*(v-vw))*(vx[-1]-vw)*c
Fy = -Bm*math.sqrt((v-vw)*(v-vw))*vy[-1]*c
vx.append(vx[-1]+Fx*dt)
vy.append(vy[-1]+(-g+Fy)*dt)
x.append(x[-1]+vx[-2]*dt)
y.append(y[-1]+vy[-2]*dt)
r = (xx-x[-2])/(x[-1]-xx)
y[-1] = (y[-2]+r*y[-1])/(r+1)
x[-1] = xx
if y[-1]>yy:
vt = v
v = v0+(vt-v0)/2
if y[-1]<yy:
v0 = v
v = v0+(vt-v0)/2
sv.append(v)
sa.append(angle)
print (sv,sa)
vmin = min(sv)
l = sv.index(vmin)
amin = sa[l]
print ('The minimum initial velocity:'+str(vmin)+'m/s')
print('angle:'+str(amin)+'°')
运行结果
在4000m,y=0的对象时运行程序
The minimum initial velocity:219.2227m/s Angle:43°
考虑2000m外,y=0的对象时运行程序可得
The minimum initial velocity:146.0103m/s Angle:44°
考虑3000m外,y=700的对象时运行程序可得
The minimum initial velocity:206.6594m/s Angle:49°
利用相关程序算出了V的极值,但利用二分法导致角度精度依然不够,需要改进
13级学长和百度