clear				% Clear previous definitions
figure(1)           % Assign figure number
clf                 % Clear previous figures
hold off            % Start with fresh graph

mytitle = 'Duffing''s Equation'; 	% Title
xlab = '$u$'; 		                % X-label
ylab = '$v$'; 	                    % Y-label
tt = linspace(0,2*pi,500);
[te,ue] = ode23(@duffDE,tt,[1;0]);
ep = 0.2;
u0 = cos(tt);
v0 = -sin(tt);
u1 = cos(tt) + ep*((1/32)*(cos(3*tt)-cos(tt))...
    -(3/8)*tt.*sin(tt));
v1 = -sin(tt) + ep*((1/32)*(-3*sin(3*tt)+sin(tt))...
     -(3/8)*(tt.*cos(tt)+sin(tt)));
plot(ue(:,1),ue(:,2),'b-','LineWidth',1.5);  
hold on                           
plot(u0,v0,'r-','LineWidth',1.5);
plot(u1,v1,'m-','LineWidth',1.5);
grid                                % Adds Gridlines
h =legend('Exact, $u_e$', 'Approx $u_0$',...
    'Approx $u_1$', 'Location','southeast');
set(h,'Interpreter','latex')
text(-0.2,0.8,'$\varepsilon = 0.2$','FontSize',14,...
    'interpreter','latex');
xlim([-1.2 1.5]);
ylim([-1.2 1.2]);
fontlabs = 'Times New Roman';   % Font in labels
xlabel(xlab,'FontSize',14,'FontName',fontlabs,...
    'interpreter','latex');  
ylabel(ylab,'FontSize',14,'FontName',fontlabs,...
    'interpreter','latex');  
title(mytitle,'FontSize',16,'FontName',...
    'Times New Roman','interpreter','latex'); 
set(gca,'FontSize',12);         % Axis tick font size
print -depsc duff_plot.eps		% Create figure as EPS file

