Project#1 If a projectile is fired into the air at an angle (in terms of degrees
ID: 2075037 • Letter: P
Question
Project#1 If a projectile is fired into the air at an angle (in terms of degrees) and with an initial airspeed of V'(in terms of m/s), the horizontal and vertical disp given by the equations · s of the projective as a function of time will be )Vcos(o) where g is the acceleration due to gravity in terms of m/s (that is, g -9.81 m/s)x is the horizontal displacement of the projectile in terms of meters, y is the vertical displacement of the projectile in terms of meters, and r is the time in terms of seconds. Ask the user whether he/she wants the answer in the SI (kilometer or meter) or USCs (mile or foot) units. hehinnt .Allow the user to input an angle 0(0-90), an initial airspe Vo0) it (kmh, m/s, mph or ft/s), and a column vector and its associa of time instances Run the program for the setting when = 45°, - wn * chadk int 1.0 1,5 2.0 2.5 3.0 T =| | s, v-25 m's and V = 55.9234 mph. and its a ated unit (seconds ofthe projectile over theprescribed lime Make sure your program specifies when users input unexpected instances, and the horizontal displacement of the projectile at veryeinformation .4--25 m/s, undefined units, etc.) 4M other time i .Make sure your program has clear and user-friendly input and outnut w (w,t s interface.Explanation / Answer
clear all; clc;
g=-9.81;
theta=input('enter the angle in degress (0 to 90 deg only)');
if theta<0
display ('Angle is less than zero, enter angle between zero to 90');
else
if theta>90
display ('Angle is greater than 90, enter angle between zero to 90');
end
end
V=input('enter the initial air speed (value greater that zero)');
if V<0
display ('Inital speed is less than zero, enter value greater than zero');
end
V_unit=input('enter the unit of air speed in the folowing format : km/h or m/s or mph or ft/sec','s');
if strcmp(V_unit,'km/h') || strcmp(V_unit,'m/s') || strcmp(V_unit,'mph') || strcmp(V_unit,'ft/sec')
if strcmp(V_unit,'km/h')
V=V*0.2778;
end
if strcmp(V_unit,'mph')
V=V*0.447;
end
if strcmp(V_unit,'ft/sec')
V=V*0.3048;
end
else
display('Invalid uints');
end
display('enter 7 time instance values within square braces [..]');
T=input(['enter the time instance']);
T=T';
T_uint=input('enter the unit of time instances in the folowing format seconds-s, hour-hr','s');
if T_uint=='s' | 'hr'
if T_uint=='hr'
T=T*3600;
end
else
display('Invalid uints');
end
for i=1:size(T,1)
Hori_displacement(i,:)=V*cosd(theta)*(T(i,:));
Verti_displacement(i,:)=(0.5*g*((T(i,:)).^2))+V*sind(theta)*(T(i,:));
end
display('Maximum vertical displacement is');
display(max(Verti_displacement));
display('Minimum vertical displacement is');
display(min(Verti_displacement));
display('Horizontal displacement for each time instance is as folows:');
display(Hori_displacement);
For V = 25 m/s and 45 degrees; the answer obtained in matlab is
Maximum vertical displacement is
ans =
15.7353
Minimum vertical displacement is
ans =
0
Horizontal displacement for each time instance is as folows:
Hori_displacement =
0
8.8388
17.6777
26.5165
35.3553
44.1942
53.0330
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.