% Rounding Error Graph

x = 0.988:0.0001:1.012;
y = x.^7 - 7*x.^6 + 21*x.^5 - 35*x.^4 + ...
    35*x.^3 - 21*x.^2 + 7*x - 1;
yy = (x - 1).^7;

plot(x,y,'k-','linewidth',1.5);
hold on
plot(x,yy,'r-','linewidth',1.5);
grid

h = legend('Polynomial', '$y = (x-1)^7$', ...
    'Location','northwest');
 set(h,'Interpreter','latex')
 
% Set up fonts and labels for the Graph
fontlabs = 'Times New Roman';  
xlabel('$x$','FontSize',16,'FontName',fontlabs, ...
    'interpreter','latex');  
ylabel('$y$','FontSize',16,'FontName',fontlabs, ...
    'interpreter','latex'); 
mytitle = 'Rounding Error';
title(mytitle,'FontSize',16,'FontName', ...
    'Times New Roman','interpreter','latex'); 
set(gca,'FontSize',16);        

print -depsc round_err.eps	% Create EPS file (Figure)