Calculating Zenith Angle for Nerf Gun Targeting

  • Thread starter tomsiv
  • Start date
  • Tags
    Angle Gun
In summary, the conversation discusses using a code to calculate the zenith angle for a nerf gun to hit a target at a desired coordinate. The code uses two equations to solve for the zenith angle (θ) and time after firing (Δt). The equations involve tracking the azimuth angle and calculating changes in position along the projected range and z axis. The conversation also mentions difficulties in setting up these equations as a matrix to solve and suggests a method involving trigonometric functions and algebraic equations.
  • #1
tomsiv
2
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 = [itex]\sqrt{x^{2}+ y^{2}}[/itex]) and the z value. The basic equations we are using are

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

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

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
  • #2
What do you mean by "set these up as a matrix to solve"? Your equations are non-linear.
 
  • #3
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).
 
  • #4
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.
 
  • #5


As a fellow scientist, I can understand the complexity of the problem you are facing. It seems like you have a good understanding of the equations and variables involved, and your approach of solving for theta and delta t simultaneously using a matrix is a valid one.

One thing you may want to consider is breaking down the problem into smaller, more manageable parts. Instead of trying to solve the equations for all possible combinations of x, y, and z, you could start by fixing one variable (such as x) and solving for the other two (y and z). Then, you could vary x and see how the solutions change. This can help you understand the relationships between the variables and potentially simplify the overall problem.

Another approach could be to use a numerical method, such as Newton's method, to iteratively solve the equations for different values of theta and delta t. This may be more computationally intensive, but it can also provide a more accurate solution.

Overall, it's important to keep in mind that there is no one "right" way to solve a problem like this. It's all about finding the approach that works best for your specific situation and problem. I wish you luck in your capstone design and hope this information helps you in your calculations.
 

1. What is a zenith angle?

The zenith angle is the angle between the vertical line (pointing straight up) and an object in the sky or on the ground.

2. How is the zenith angle calculated?

The zenith angle can be calculated using trigonometry, specifically the tangent function. The formula is: Zenith angle = arctan (height/distance).

3. Why is calculating the zenith angle important for Nerf gun targeting?

Calculating the zenith angle is important for Nerf gun targeting because it helps determine the angle at which the gun should be aimed to hit a specific target. This can improve accuracy and increase the chances of hitting the target.

4. What factors affect the accuracy of calculating the zenith angle for Nerf gun targeting?

Some factors that can affect the accuracy of calculating the zenith angle for Nerf gun targeting include variations in the Nerf gun's velocity, wind speed and direction, and the distance from the gun to the target. Other factors such as gravity and the angle of the gun may also play a role.

5. Are there any tools or methods that can assist in calculating the zenith angle for Nerf gun targeting?

Yes, there are various tools and methods that can assist in calculating the zenith angle for Nerf gun targeting. These include using a protractor or angle finder tool, creating a mathematical model, or using a computer program or app specifically designed for calculating angles for Nerf gun targeting.

Similar threads

Replies
2
Views
1K
  • Introductory Physics Homework Help
2
Replies
38
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • General Math
Replies
3
Views
2K
  • Introductory Physics Homework Help
Replies
4
Views
865
Replies
6
Views
3K
  • Electromagnetism
Replies
4
Views
811
Replies
11
Views
1K
  • Introductory Physics Homework Help
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
29
Views
934
Back
Top