Could someone perhaps guide me in the right direction to figure out a way to start this code?
4 views (last 30 days)
Show older comments
(Assignment) "Your program should also have a feature that predicts the velocities and elevation angles at which the projectile can be launched to hit a target given a specified distance. The input to this part of the program should be only the target distance. The output from this part of the program should be the velocities and launch angles for the projectile."
I don't see a way to get both those outputs by just inputting a distance. I'm not asking for someone to give me a code, but just a something to help me start.
3 Comments
James Tursa
on 21 Apr 2016
Edited: James Tursa
on 21 Apr 2016
I assume you have been studying projectile motion in class. So what equations are you familiar with for this motion? Forget the targeting aspects for the moment ... if you were simply given a velocity and an angle, could you write a program to predict its trajectory? Start with that. Once you have that working, then it shouldn't be too much work to extend it to a targeting program. See this link:
https://en.wikipedia.org/wiki/Projectile_motion
Answers (1)
Arnab Sen
on 25 Apr 2016
Hi Collin,
In this case there would be multiple velocity and launch angles. The formulae for projectile distance is
d=(v^2/g). sin(2.theta).
where v is initial velocity, g gravitational acceleration and theta is projection angle.
Now if d is given, then relation between v and theta will be,
v=sqrt(d.g.cosec(2.theta)).
Now, you can vary the theta from 1 to 90 degree in specific interval (e.g. 1 degree)and get corresponding velocities v and out the angle and their corresponding velocities in a table format.
3 Comments
Arnab Sen
on 26 Apr 2016
Use '.*' and './' (element wise multiplication and division) instead of '*' and '/'
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!