Calculating Zenith Angle for Nerf Gun Targeting

  • Context: Graduate 
  • Thread starter Thread starter tomsiv
  • Start date Start date
  • Tags Tags
    Angle Gun
Click For Summary

Discussion Overview

The discussion revolves around calculating the zenith angle for a nerf gun to accurately target a projectile at specified coordinates (x, y, z). Participants explore the mathematical modeling involved in determining the necessary angle and time parameters for the projectile's trajectory, considering factors such as drag and gravitational effects.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant describes their approach using equations for change in position along the projected range and elevation, seeking to solve for the zenith angle (θ) and time (Δt) simultaneously.
  • Another participant questions the feasibility of setting up the equations as a matrix due to their non-linear nature.
  • A later reply suggests a method to manipulate the equations to isolate θ, leading to a derived relationship involving tangent and cosine functions, ultimately resulting in a fourth-degree algebraic equation.
  • There is an acknowledgment of potential overcomplication in the setup, comparing it to previous experiences with rail gun targeting calculations.

Areas of Agreement / Disagreement

Participants express differing views on the approach to solving the equations, with some proposing algebraic manipulations while others highlight the challenges posed by non-linearity. The discussion remains unresolved regarding the best method to compute the zenith angle.

Contextual Notes

Participants note the assumptions made, such as treating drag as a constant, and the complexity introduced by the non-linear nature of the equations. There is also mention of computational efficiency in coding the solution.

tomsiv
Messages
2
Reaction score
0
I'm working on my engineering capstone design and part of our design requires a code we have written to calculate the appropriate zenith angle for a nerf gun to fire a projectile so that the dart hits a certain target.

We are feeding the code a target coordinate (x,y,z). One section of our code tracks the azimuth angle simply using the x and y coordinates(arctan(y/x)), then the zenith angle will be based on the projected range (r = \sqrt{x^{2}+ y^{2}}) and the z value. The basic equations we are using are

Δr = vtotal*cos(θ)*Δt + .5*d*cos(θ)*Δt^{2}

Δz = vtotal*sin(θ)*Δt + .5*(d*sin(θ) + g)*Δt^{2}

where
Δr = change in position along the projected range
Δz = change in position along the z axis (elevation)
vtotal = total velocity (at muzzle)
Δt = time after firing
d = drag = -k*v2 = (we are going to assume this as a constant even though it depends on velocity)

Now since we are feeding our Matlab/simulink code a desired (x,y,z) value, we will have a desired Δr and Δz (or if you want to think in 2 dimensions a desired X and Y). So what we are trying to do is have our program solve these two equations simultaneously so that we can have a necessary θ value (zenith angle) to hit our target. Two equations, two unknowns (θ and Δt). I'm just running into problems when trying to set these up as a matrix to solve.

I feel like we may be over complicating this, because I've done similar calculations for rail gun targeting, but we had range, etc. as the unknowns and we were selecting theta values. Am I leaving something out or missing an obvious matrix solving method?

Thank you for any help you can offer, sorry if my wording is somewhat confusing.
 
Science news on Phys.org
What do you mean by "set these up as a matrix to solve"? Your equations are non-linear.
 
Yea, sorry, I realized that I had said that a little after posting my problem. I'm just trying to find the best way to solve for theta, using a method that can coded relatively easily (as far as computational time is concerned).
 
Multiple the second equation with ## \cos \theta ## and the first with ## \sin \theta ##; subtract the first from the second. You end up with ## \Delta z \cos \theta - \Delta r \sin \theta = 0.5 g \cos \theta \Delta t^2 ##. Divide this by ## \cos \theta ## and you obtain $$

\tan \theta = \frac {\Delta z - 0.5 g \Delta t^2} {\Delta r }

$$ bserve that $$ \cos \theta = \frac 1 { \sqrt{1 + \tan^2 \theta} }$$ so the first equation becomes $$

\sqrt {\Delta r ^2 + \left(\Delta z - 0.5 g \Delta t^2\right)^2}
= v \Delta t + 0.5 d \Delta t^2 $$ which is equivalent to an algebraic equation of the fourth degree.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 38 ·
2
Replies
38
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
7K
Replies
7
Views
5K
Replies
4
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K