- #1
Zacattackz
- 7
- 1
Homework Statement
The objective is to code a working solver, but my question is specifically with the physics aspect. I am to find the θ value necessary to launch a projectile and hit a target. My problem is distinguishing between an overshoot and an undershoot. For example:
Both of these launches have minimum points (the dots), that represent their closest point to the target (red with cross). Both of the minpoints fall in the same quadrant relative to the target (quadrant 3), but the blue needs to decrease the launch angle, while green needs to increase. How do I tell the difference between these and so tell my code whether to increase or decrease its guess? If the minpoint lands in any other quadrant I decrease or increase θ accordingly (decrease for quad 1,2 ; increase for quad 4)
Homework Equations
x,y,θ, velocity are known at all points on the line. As well as their derivatives.
To find the minpoints. ν⋅d = 0 is used where:
ν=velocity vector= xdot*i+ydot*j
d=vector from projectile to target=(T_x-x)*i+(T_y-y)*j
Target location = (T_x,T_y)
The code will solve for when v⋅d is equal to zero. Here is a picture illustrating that instance:
edit: I realize the velocity vector should fall inside of the blue, my mistake
The Attempt at a Solution
Here is an example of what my code does.Each image shows a successive guess angle and its corresponding path. The red circle is the target, while circles on the path indicate where a minimum distance has been found.
http://imgur.com/a/YPlv9
The first guess is an undershoot, while the second is a "high" undershoot. Causing the final guess to change the theta angle in the wrong direction. I need a way to detect when the guess is a "high" undershoot.
Last edited: