I'm trying to derive a formula to find the angle $θ$ required to hit a target that may be higher or lower than the initial launch position.
My known variables are $g, v_0, y_0, y_f, x_0, x_f$ where:
- $θ$ is the initial launch angle and the variable being solved for;
- $g$ is the gravity constant;
- $v_0$ is the initial angular velocity;
- $y_0$ is the initial launch elevation;
- $y_f$ is the final landing position (in such cases where the projectile lands lower or higher than the launch position);
- $x_0$ is the initial horizontal launch displacement;
- $x_f$ is the horizontal landing position, or range;
- $t$ is the time in seconds during the path of motion.
I started by converting the formula for x position into one for time $(x = x_0 + v_{x0}t$ becomes $t = \frac{x}{x_0 + v_{x0}})$
I set the equation for total flight time $\left(\frac{v_{y0}}{g} + \frac{\sqrt 2h}{g}\right)$ equal to this equation, since $v_{xf} = v_{x0}$ and $x_f$ is known. Leading me to $\frac{x}{x_0 + v_{x0}} = \frac{v_{y0}}{g} + \frac{\sqrt 2h}{g}$.
I took the equation for maximum height, $\frac{gt^2}{2}$ and substituted the expression for time into it, giving me $\frac{gx^2}{2x_0^2 + 4x_0v_{x0} + v_{x0}^2}$. Since $v_{y0}$ can be expressed in terms of $v_{x0}$, I also substituted that in $v_{x0} = v_0\cdot \cos \theta$ and $v_{y0} = v_0\cdot \sin \theta$ so $v_{y0} = v_{x0}\cdot \tan \theta$.
From there I continued to simplify and rearrange until I ended up with $\theta = \cos^{-1}\frac{2gx^2}{v_0}$, however this doesn't give me the correct answer and this is my third attempt over the past several hours.
I've been using the following values in a standard trajectory formula that finds $x_f$ from $\theta, v_0, y_0, x_0$:
- $g = 9.81 \, \mathrm{m/s}$
- $θ = 70^\circ$
- $v_0 = 75 \, \mathrm{m/s}$
- $y_0 = 3 \, \mathrm{m}$
- $y_f = 0 \, \mathrm{m}$
- $x_0 = 0 \, \mathrm{m}$.
When I plug these into a standard trajectory formula, I find that the range is $369.65957 \, \mathrm{m}$, which I have been using for $x_f$. I expect to find $\theta \approx 70^\circ$ when I solve for $\theta$ using $v_0$ and $x_f$, but other formulas I have found on the web end up giving me $\approx 45^\circ$ or $\approx 89^\circ$.
Thanks for any help!