Calculate which projectile will hit the ground first. Then take the flying time
ID: 3791566 • Letter: C
Question
Calculate which projectile will hit the ground first. Then take the flying time t_1 of the projectile and divide it into ten increments by creating a vector t with 11 equally spaced element is D, the last is t_1). At each time t calculate the position vector r_ab between the two projectiles. Knowing that the length of any vector T = r_x i + r_y j can be founded by: r = |r| = Squareroot r_x^2 + r_y^2 find the maximum length of r_ab and at what time it occurs. Print the maximum separation on the first line of an output file. Beginning on the second line. print a 3 column table where the first column is t and the second and third columns are the corresponding x and y components of r_ab. Prompt for the filename.Explanation / Answer
v1v = 5*sind(30);
v1h = 5*cosd(30);
v2v = 3*sind(80);
v2h = 3*cosd(80);
g = 9.81;
t1 = v1v/g;
t2 = v2v/g;
if t1<t2
disp('Particle 1 hits ground first');
tf = 2*t1;
else
disp('Particle 2 hits ground first');
tf = 2*t2;
end
ts = [];
dist = 0;
tans = 0;
for i=1:10
t = tf*i/10;
r1x = v1h*t;
r2x = v2h*t;
r1y = v1v*t - 0.5*g*t*t;
r2y = v2v*t - 0.5*g*t*t;
d = abs(sqrt(r1x*r1x+r1y*r1y) - sqrt(r2x*r2x+r2y*r2y));
if d>dist
dist = d;
tans = t;
end
end
disp(['Maximum separation is ', num2str(dist), ' at ', num2str(tans), 'seconds.']);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.