Please help me to write code for this problem . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please help me to write code for this problem .

The height h(t) and speed S(t) of a projectile (such as a kicked soccer ball, or a rocket) launched with an initial speed S0 at an angle A to the horizontal are given by 2 2 0 2 0 2 0 S(t) S 2S gtsin(A) g t h(t) S tsin(A) 0.5gt = ! + = ! where g is the acceleration due to gravity. The projectile will strike the ground when h(t)=0 which gives the time to hit t 2(S / g)sin(A) hit = 0 . • Write a MATLAB program that computes the hit time for a given initial speed and angle, and displays the hit time and the speed of the rocket when it hits the ground. • Store the program in a script file called rocket.m and run it. Note: you can compute square roots using the MATLAB function sqrt . Do not forget to include comments and a header, use meaningful variable names and indentation when appropriate.

23rd Apr 2021, 5:46 PM
sana ahmed
sana ahmed - avatar
3 Answers
+ 1
Attempt
23rd Apr 2021, 5:52 PM
Ananiya Jemberu
Ananiya Jemberu - avatar
+ 1
Thank you
25th Apr 2021, 6:50 PM
sana ahmed
sana ahmed - avatar
0
% Values for speed, gravity and angles s0 = 20; g = 9.81; A = 40*pi/180; % Hit time t_hit = 2*s0*sin(A)/g; % Computing arrays of (time, height, and speed.) t = 0:t_hit/100:t_hit; h = s0*t*sin(A) - 0.5*g*t.^2; s = sqrt(s0^2 - 2*s0*g*sin(A)*t + g^2*t.^2); % height determination not less than 6. % speed not greater than 16. u = find(h >= 6 & s <= 16); % Compute the time. t_1 = (u(1) - 1)*(t_hit/100); t_2 = u(length(u) - 1)*(t_hit/100);
25th Apr 2021, 1:27 AM
Nabi Sadat
Nabi Sadat - avatar