the Develop which will determine the trajectory of a projectile as a function of
ID: 3796945 • Letter: T
Question
the Develop which will determine the trajectory of a projectile as a function of time. The output of the program should be a table o o Time o Horizontal location o Vertical location o Horizontal velocity o Vertical velocity o Total velocity o Maximum elevation which matches the table provided below (note: do NOT use the table function) The program should also determine maximum elevation. Assume frictionless flight (no aerodynamic drag User inputs: o Units o Relevant gravitational value o Initial velocity o Launch angle (in degrees) o Time increment (in seconds) The relevant kinematic equations are v vo at Where a is acceleration, d is displacement, t is time Vf is final velocity, and v is initial velocity The horizontal distance can be found as x(t) Vort, (1)Explanation / Answer
Matlab code:
clc;
unit = input('Please input the units being used (m/feet)!', 's');
g = input('Please input corresponding value of gravity!');
v = input('Please input corresponding velocity!');
angle = input('Please input angle of launch!');
angle = angle*0.0174533; %convert into radian
dt = input('Please input time increament in seconds!');
fprintf('t x(t) y(t) vx(t) vy(t) v(t) ');
t = 0;
yt = 0;
vx = v*cos(angle);
vy = v*sin(angle) - g*t;
xt = vx * t;
yt = v*t*sin(angle) - (0.5*g*t*t);
h = [yt]
while(yt >= 0)
fprintf('%d %d %d %d %d %d ',t,xt,yt,vx,vy,sqrt(vx^2 + vy^2));
vx = v*cos(angle);
vy = v*sin(angle) - g*t;
xt = vx * t;
yt = v*t*sin(angle) - (0.5*g*t*t);
h = [h , yt];
t = t + dt;
end
fprintf('The maximum elevation recorded is %d %s', max(h), unit);
sample Output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.