Consider the following data from a threestage mode rocket la
Consider the following data from a three-stage mode rocket launch: Use the subplot command to the following sections to plot on the same graphing window. Create a plot with time on the x-axis and altitude on the y-axis. Use the diff function to determine the velocity during each time interval, and plot the velocity against the starting time for each interval. Use the diff function again to determine the acceleration for each time interval, and plot the acceleration against the starting time for each interval.
Solution
%--------------------------------------------------------------------
clc;
clear all;
close all;
t=0:1:24;
x=[0,107.37,210.00,307.63,400,484.60,550,583.97,580,549.53,570,699.18,850,.....
927.51,950,954.51,940,910.68,930,1041.52,1150,1158.24,1100,1041.76,1050];
diff_x(1)=0;
for i=2:25;
diff_x(i)=x(i)-x(i-1);
end
for i=2:25;
doub_diff_x(i)=diff_x(i)-diff_x(i-1);
end
subplot(1,3,1)
plot(t,x)
subplot(1,3,2)
plot(t,diff_x)
subplot(1,3,3)
plot(t,doub_diff_x)
%-----------------------------------------------------------------------------------
