1) Two projectiles, A and B, are shot at the same instant from the same spot. Pr
ID: 2122672 • Letter: 1
Question
1) Two projectiles, A and B, are shot at the same instant from the same spot. Projectile A
is shot at a speed of 680 m/s at an angle of 65 degrees, and projectile B is shot at a
Speed of 780 m/s at an angle of 42 degrees. Using Mat lab, determine the horizontal distance traveled each second by both projectiles until they hit the ground. For each
Second, determine horizontal distance between the two projectiles. Create two plots:
One showing the trajectory for each projectile, and one showing the distance between
The two projectiles.
2)Given an existing matrix m create a new matrix n that contains all the elements in the 2nd and 3rd rows of m, in the 3rd and 5th columns.
Explanation / Answer
ANS 1:
clear all;
clc;
v_a = 680;
theta_a = 65;
theta_a = theta_a * pi() /180;
v_b = 780;
theta_b = 42;
theta_b = theta_b * pi() / 180;
%Loop till vertical height of A is less zero
h_a(1) = v_a * sin (theta_a) - 0.5 * 9.81; %Vertical height after 1 s
d_a(1) = v_a * cos (theta_a); % Horizontal height after 1 s
h_b(1) = v_b * sin (theta_b)- 0.5 * 9.81; %Vertical height after 1 s
d_b(1) = v_b * cos (theta_b); %Horizontal height after 1 s
t_a(1) = 1;
t_b(1) = 1;
time = 1;
while(h_a(time) > 0)
time = time+1;
t_a(time) = time;
h_a(time) = v_a * sin(theta_a)*time - 0.5 * 9.81*time^2;
d_a(time) = v_a * cos (theta_a)*time;
end
time = 1;
while(h_b(time) > 0)
time = time+1;
t_b(time) = time;
h_b(time) = v_b * sin (theta_b)*time - 0.5 * 9.81*time^2;
d_b(time) = v_b * cos (theta_b)*time;
end
plot(t_a,h_a,t_b,h_b);%For vertical heights
plot(t_a,d_a,'.r',t_b,d_b,'.b'); %For horizontal distance
ANS 2:
clear all;
clc;
ind1 = 6;
ind2 = 7;
ind_row = [2 3];
ind_col = [3 5];
A = rand(ind1,ind2); %Generate initial random matrix of dimensions ind1,ind2
for(i = 1:2)
for(j = 1:7)
B(j,ind_col(i)) = A(ind_row(i),j);
end
end
A
B
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.