function falling clear all global mass gravity alpha mass=80; height=600; %initial height gravity=9.81; tsplit=5; %time before chute opens alpha=1/15; %drag parameter (before chute opens) trange=[0 tsplit]; inits=[height,0]; %iniital conditions (y and v) [t,y]=ode45(@fallfunc,trange,inits); alpha=4/15; %drag parameter (after chute opens) trange=[tsplit 2.85*tsplit]; inits=[y(end,1) y(end,2)]; %Use results of last run to start next [t2,y2]=ode45(@fallfunc,trange,inits); plot(t,y(:,1),t2,y2(:,1),'r',t,y(:,2),'--b',t2,y2(:,2),'--r','LineWidth',2) xlabel('time (s)') ylabel('x (m) v(m/s)') legend('height-before', 'height-after', 'velocity-before', 'velocity-after') hold on x=[0 t2(end)]; z=[0 0]; plot(x,z) % function z=fallfunc(t,y) global mass gravity alpha z=zeros(2,1); z(1)=y(2); z(2)=-gravity+alpha/mass*y(2)^2;