Problem 1: The velocity of a rocket is described by: 10 2-5 t, osts 624-5 t, 8st
ID: 3163403 • Letter: P
Question
Problem 1: The velocity of a rocket is described by: 10 2-5 t, osts 624-5 t, 8sts 16 v(t) 36 t t 12 (t-16) 16 sts 26 2136 e 01 (-26), t 26 otherwise Develop an M-file function to compute v as a function oft. Then, develop a script file that uses this file to generate a plot ofv versus t for t-5 to 50. Problem 2: The (x,y) coordinates of a small projectile are given by: x t, y exp(-t) sin (5 t t) Represent the projectile by a small dot, and animate its motion from t 0 to t 5. Use a time step size of 0.05. Use appropriate axis limits. Use the Maltab command 'movie' and generate an avi file named projectile avi 1.2 OF4 FUJITSExplanation / Answer
Problem 1
Velocity as a function of time
%%%%%%%%%%%%%%%%
function v=velocity(t)
v=heaviside(t).*(10.*t.^2-5.*t).*heaviside(8-t)+heaviside(t-8).*(624-5.*t).*heaviside(16-t)+heaviside(t-16).*(36.*t+12.*(t-16).^2).*heaviside(26-t)+heaviside(t-26).*(2136.*exp(-0.1.*(t-26)));
end
% Save this script as velocity.m in the MATLAB directory.
%%%%%%%%%%%%%%%%%
Plot of v vs. t
%%%%%%%%%%%%%%%%%
t=-5:0.1:50;
plot(t,velocity(t))
xlabel('Time(t)','FontSize',20,'FontWeight','bold')
ylabel('Velocity(V)','FontSize',20,'FontWeight','bold')
title('Velocity(V) vs. Time(t)','FontSize',20)
%%%%%%%%%%%%%%%%%%%%%%%%%
I have done problem 1.