The height and speed of a projectile such as a thrown ball l
The height and speed of a projectile (such as a thrown ball) launched with a speed of v0 at an angle A to the horizontal are given by
where g is the acceleration due to gravity. The projectile will stike the ground when h(t) = 0, which gives the time to hit thit = 2*(v0/g)*sin(A).
Suppose that A = 30 degrees, v0 = 40 m/s, and g = 9.81 m/s2. Use the MATLAB relational and logical operators to find the times when
a. The height is no less than 15 m.
b. The height is no less than 15 m and the speed is simultaneously no greater than 36 m/s.
c. The height is less than 5 m or the speed is greater than 35 m/s.
Solution
%Matlab Code type in command window
>>A=30;
>> Vo=40;
>> g=9.81;
>> t=0:0.01:2*Vo*sind(A)/g;
>> h=Vo*t*sind(A)-0.5*g*t.^2;
x=find(h>15);%return indexes for h>15
j=t(x);%returns times when h>15
min(j);% gives starting time
max(j)% gives end time
------------------------------------------
Ans a) times when h>15 i.e no less than 15 is t=1sec to 3.08 sec
----------------------------------------------------------------------------------------------------------------
v=sqrt(Vo^2-2*Vo*g*t*sind(A)+g^2*t.^2);
x=find(h>15 & v<36);
j=t(x);
min(j);% gives starting time
max(j)% gives end time
------------------------------------------
Ans b) times when h>15 i.e no less than 15 and v<36 is t=1.04 sec to 3.03 sec
----------------------------------------------------------------------------------------------------------------
x=find(h<5 | v>35);
j=t(x);
j
------------------------------------------
Ans c) times when h<5 i.e less than 5 or v>35 is t=0 sec to 1.52 sec and t=2.55 sec to 4.07 sec
----------------------------------------------------------------------------------------------------------------

