The position of a projectile, fired with an initial speed of v_0 | at an angle a
ID: 3027823 • Letter: T
Question
The position of a projectile, fired with an initial speed of v_0 | at an angle alpha, can be written as a function of time (x(t), y(t)) as x(t) = v_0 cos (alpha) t and y(t) = v_0 sin(alpha)t - 0.5gt^2| where g = 9.81m/s^2|. The polar coordinates of the projectile (r(t), theta(t)) | at time t are: r(t) = squareroot x^2(t) + y^2 (t) and tan(theta(t)) = y(t)/x(t)| Write a MATLAB script to calculate the r(t) and theta(t)| for input values of v_0|, alpha and t, provided by the user. Run the program for v_0 = 150 m/s and alpha = 65 degree at time t = 5, 10, and 20 sec and report the results. Make sure to define your variables clearly and include proper comments in your code.Explanation / Answer
clc
clear all
V=150; %initial speed
a=65; %angle
g=9.81; %gravity
T=[5 15 20]
for i=1:3% for t=5,10,20
t=T(i);
x=V*cos(a*t);
y=V*sin(a*t)-0.5*g*t^2;
r=sqrt(x^2+y^2)
theta=atan(y/x) %in radians
Theta=57.29*theta %in degrees
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.