%A script to compare 2 plots of the same polynomial
%M126 HW1 #7
%1/12/12
%Brad Nelson

clear all;

xs=1.920:0.001:2.080; %x values

f1= @(x) (x-2).^9;
f2= @(x) x.^9 - 18*x.^8 + 144*x.^7-672*x.^6+2016*x.^5 ...
-4032*x.^4+5376*x.^3-4608*x.^2+2304*x-512;

y1=f1(xs);
y2=f2(xs);

figure;
hold on;
plot(xs,y1,'k');
plot(xs,y2,'r');
hold off;
legend('(x-2)^9','x^9-18x^8+144x^7-...');
xlabel('x');

print -depsc poly.eps