

% This excerpt shows a usage of multiple subplot commands for Problem 6.
% You may copy and paste it into your code verbatim or with whatever
%  changes you desire. 

figure(50601);
% Plot the Verlet solution:  ---------->
subplot(3,2,1);  plot(y_V1, v_V1);
axis([ -1.1*max(abs(y_V1)) 1.1*max(abs(y_V1)) ...
       -1.1*max(abs(v_V1)) 1.1*max(abs(v_V1)) ])
axis('equal')
xlabel('y', 'fontsize', 12);   ylabel('v', 'fontsize', 12);
title('Verlet-1','fontsize',14)
% Plot the modified Euler solution:  ---------->
subplot(3,2,2);  plot(Y1_mE, Y2_mE);
axis([ -1.1*max(abs(Y1_mE)) 1.1*max(abs(Y1_mE)) ...
       -1.1*max(abs(Y2_mE)) 1.1*max(abs(Y2_mE)) ])
axis('equal')
xlabel('y', 'fontsize', 12);   ylabel('v', 'fontsize', 12);
title('modified Euler','fontsize',14)
% Plot the cRK solution:  ---------->
subplot(3,2,3);  plot(Y1_cRK, Y2_cRK);
axis([ -1.1*max(abs(Y1_cRK)) 1.1*max(abs(Y1_cRK)) ...
       -1.1*max(abs(Y2_cRK)) 1.1*max(abs(Y2_cRK)) ])
axis('equal')
xlabel('y', 'fontsize', 12);   ylabel('v', 'fontsize', 12);
title('classical Runge--Kutta','fontsize',14)
% Plot the central-difference solution:  ---------->
subplot(3,2,4);  plot(y_CD, v_CD);
axis([ -1.1*max(abs(y_CD)) 1.1*max(abs(y_CD)) ...
       -1.1*max(abs(v_CD)) 1.1*max(abs(v_CD)) ])
axis('equal')
xlabel('y', 'fontsize', 12);   ylabel('v', 'fontsize', 12);
title('central-difference','fontsize',14)
% Plot the ode45 solution with AbsTol = 0.002:  ---------->
subplot(3,2,5);  plot(Y_ode45_A(:,1), Y_ode45_A(:,2));
axis([ -1.01 1.01 -1.01 1.01 ])
axis('equal')
xlabel('y', 'fontsize', 12);   ylabel('v', 'fontsize', 12);
title('ode45 with Tol=0.002','fontsize',14)
% Plot the ode45 solution with AbsTol = 0.003:  ---------->
subplot(3,2,6);  plot(Y_ode45_B(:,1), Y_ode45_B(:,2));
axis([ -1.01 1.01 -1.01 1.01 ])
axis('equal')
xlabel('y', 'fontsize', 12);   ylabel('v', 'fontsize', 12);
title('ode45 with Tol=0.003','fontsize',14)
