Height andSpeed of a Projectile
The height and speed of a projectile (such as a thrown ball) launched with a speed of Vo at an angle A to the horizontal are given by’

where g is the acceleration due to gravity. The projectile will strike the ground when
h(l) = 0, which gives the time to hit, thit = 2(vo/g)sinA. Suppose that A = 40°,
vc = 20 tnls, and g = 9.81 mls2. Use the MATLAB relational and logical operators
to’ find the times when the height is no less than 6 m and the speed is multaneously
no greater than 116 mls. In addition, discuss another approach to obtaining a
.soluation
The key to solving this problem with relational and logical operators is to use the find
command to determine the times at which the logical expression (h >= 6) & (v <= 16) is true. First we must generate the vectors hand v corresponding to times II and 12 between 0 ≤ ≥ hit using a spacing for time 1 that is small enough to achieve sufficient accuracy for our purposes. We will choose a spacing of (hit! 100, which provides 101 values of time. The program follows. When computing the times II and 12,we must subtract 1 from u (1) and from length (u) because the first element in the array t corresponds to 1 = 0 (that is, t (1) is 0).

% Set the values for initial speed/”gravity, and angle. ,vO = 20; g = 9.81; A =40*pi/180; % Compute the time to hit. t_hit = 2*vO*sin(A)/g; % Compute the arrays containing time, height, and speed. t [0 :t_hi t/100 :t_hi t1 ; h = vO*t*sin(A) – 0.5*g*t.A2; v = sqrt (vOA2 – 2*vO*g*sin(A)*t +’g A 2*t.A 2); % Determine when the height is no less than 6, % and the speed is no greater than 16. u = find h>=.6&v<=16); % Compute the corresponding times. t_l (u(1)-1)*(t_hit/100)
t_2 = u(length(u)-1)*(t_hit/100)

The results are t l = 0.8649 and 12= 1.7560. Between these two times h :! 6 m and v 16 mls. We could have solved this problem by plotting h(t) and V(I), but the accuracy of the results would be limited by our ability to pick points off the graph; in addition, if we had to solve many such problems, the graphical method would be more time-consuming.