In: Electrical Engineering
V(t)=V0 + g t
H(t)= H0 + V0 t + ½ g t2
The rocket deploys a parachute after 9 seconds and descends at a constant rate of 20 ft/sec. How long does it take to reach the ground?write that by matlab program only
Plot the velocity and the height as functions of time on a single plot. Fully format the figure.
By matlab program please
Explanation:
MATLAB code:
clc;clear all;
V_0 = 200; % ft/s
H_0 = 0; % from ground
g = -32.2; % ft/s^2
t_upward = 9; % after 9 seconds parachute is deployed
t_final = t_upward+4.9634;
t=(0:0.01:t_final)';
time = zeros(length(t),1);
V = zeros(length(t),1);
H = zeros(length(t),1);
for i=1:length(t)
time(i)=t(i);
if time(i)<=t_upward
V(i) = V_0+g*time(i);
H(i) = H_0+V_0*time(i)+0.5*g*(time(i)^2);
else
V(i) = V(t_upward)-20+g*time(i);
H(i) =
H(t_upward)-20*(time(i)-t_upward)+0.5*g*(time(i)-t_upward)^2;
end
end
max_point = find(H==max(H));
Max_height = H(max_point);
Time_at_max_height = t(max_point);
disp('Maximum height (in ft) the rocket reached in the air
is:')
disp(Max_height)
disp('Time taken (in seconds) to reach the maximum height
is:')
disp(Time_at_max_height)
H_downward = H(length(H));
disp('The distance to be travelled by the rocket to reach ground
(after the parachute is deployed) is:')
disp( H_downward)
disp('time (in sec) taken to reach ground after the parachute is
deployed is:')
disp(t_final-t_upward)
plot(t,V,'r')
hold on
plot(t,H,'b')
title('Velocity V (red) versus time t and Height H (blue) versus
time t (in seconds)')
xlabel('time t in seconds')
ylabel('Velocity V (red) in ft/s and Height H (blue) in ft')
grid on
MATLAB result:
Maximum height (in ft) the rocket reached in the air is:
621.1180
Time taken (in seconds) to reach the maximum height is:
6.2100
The distance to be traveled by the rocket to reach ground (after
the parachute is deployed) is:
-479.3888
time (in sec) taken to reach ground after the parachute is
deployed is:
4.9634
MATLAB plot: