熱門文章

2022年3月2日 星期三

使用 Google 試算表及 VPython 計算砲彈軌跡

作者:王一哲
日期:2022/3/2


前言


前幾天在 YouTube 上看到李永樂老師的影片「如何精準命中目標?戰爭到底帶給我們什麽?」,影片中提到理想狀態與實際情境下的斜向拋射運動差異,最後有提到計算道彈的數值方法。影片中李永樂老師是用 Excel 計算的,而我在高三多元選修中則是教學生用 VPython 計算,雖然工具不同,但是原理相同。

理想狀態


若砲彈的初速度量值為 $v_0$、仰角為 $\theta$,重力加速度為 $g$,只考慮重力的作用,則砲彈的水平位移 $x$ 與時間 $t$ 的關係為 $$ x = v_0 \cos \theta \cdot t ~\Rightarrow~ t = \frac{x}{v_0 \cos \theta} $$ 鉛直位移 $y$ 與時間 $t$ 的關係為 $$ y = v_0 \sin \theta \cdot t - \frac{1}{2}gt^2 $$
將 $t = \frac{x}{v_0 \cos \theta}$ 代入 $y$ 可得軌跡方程式 $$ y = v_0 \sin \theta \cdot \frac{x}{v_0 \cos \theta} - \frac{1}{2}g \cdot \left( \frac{x}{v_0 \cos \theta} \right)^2 = \tan \theta \cdot x - \frac{g}{2v_0^2 \cos^2 \theta} \cdot x^2$$ 由於 $$ \frac{1}{\cos^2 \theta} = \sec^2 \theta = 1 + \tan^2 \theta $$ 可以將軌跡方程式改寫成 $$ y = x \cdot \tan \theta - \frac{gx^2}{2v_0^2} \cdot (1 + \tan^2 \theta) $$ 若已知目標物所在的位置 $(x, y)$,則初速度仰角 $\theta$ 可以由 $\tan \theta$ 為變數的一元二次方程式解出。 $$ gx^2 \cdot \tan^2 \theta - 2v_0^2 x \cdot \tan \theta + 2v_0^2 y + gx^2 = 0 $$ $$ \tan \theta = \frac{v_0^2 x \pm \sqrt{v_0^4 x^2 - gx^2 (2v_0^2 y + gx^2)}}{gx^2} $$