\"Create a launch movie from the given file. Change the marker during different
ID: 3816486 • Letter: #
Question
"Create a launch movie from the given file. Change the marker during different portions of the launch."
So it'd be, say purple during the first 0.15 seconds, then blue during segment 2 when the rocket has stopped etc.
I have no idea how to do this any help would be apprecaited thank you in advance!
This program models the flight of a small rocket 2 m O. 05 g 9.81 tEngine 0 15: Force 16 vChute 20 Dt 01 3- clear t v h t (n) 0 h (n) 0 Segment l: The rocket engine is on during the first 15 seconds 7 al Force-m*g) /m. 8 while t (n) tEngine && n 50000 n-n+l 10 t (n) t (n-1)+D Eal t h (n)-0.5*al t (n 2: 12 13 Lend 14 15 vl v (n) hl h (n) tl t (n) 16 Segment 2 The rocket engine has stopped but the parachute hasn't opened 17 yet 18 while v (n) vChute && nExplanation / Answer
function [M,N] = rocketMovie()
%This program models the fight of a small rocket
m=0.05; g=9.81;tEngine=0.15;Forcw=16;vChute=-20;Dt=.01;
clear t v h
n=1;
t(n)=0,v(n)=0;h(n)=0;
%segment1: The rocket engine is on during the first.15 seconds
a1=(Force-m*g)/m;
while(t(n)<tEngine && n<5000
n=n+1;
t(n) = t(n-1)+Dt;
v(n)=a1*t(n);
h(n)=0.5*a1*t(n).^2;
end
n;
v1=v(n); h1=h(n); t1=t(n);
%segment2: The rocket engine has stopped but the parachute hasn't opened yet
while v(n)>=vChute && n<5000
n=n+1;
t(n)=t(n-1)+Dt;
v(n)=v1-g*(t(n)-t1);
h(n)=h1+v1*(t(n)-t1)-0.5*g*(t(n)-t1)^2;
end
n;
v2=v(n); h2=h(n); t2=t(n);
%segment3: parachute opens and rocket floats to ground
while h(n)>0 && n<5000
n=n+1;
t(n)=t(n-1)+Dt;
v(n)=vChute;
h(n)=h2+vChute*(t(n)-t2);
end
n;
subplot(1,2,1)
for t = 1:1:5000
plot(t,h,t1,h1,'o',t2,h2,'o')
xlabel('Time (s)')
ylabel('Height (m)')
title('Rocket Height')
drawnow
M(t) = getframe; % this will make movie
end
subplot(1,2,2)
for t = 1:1:5000
plot(t,v,t1,v1,'o',t2,v2,'o')
xlabel('Time (s)')
ylabel('Velocity (m/s)')
title('Rocket Velocity')
drawnow
N(t) = getframe; % this will make movie
end
end
M=[];
N=[];
[M,N] = rocketMovie(); %calling function
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.