function yprime=primize(x,y,n);
%function yprime=primize(x,y,n);
%              uses polyfit and polyval to fit y(x) with a polynomial of 
%                    order n, then subtracts to get yprime.  
coefs=polyfit(x,y,n);
yprime=y-polyval(coefs,x);

xnew=min(x):(max(x)-min(x))/100:max(x);
ynew=polyval(coefs,xnew);

plot(xnew,ynew,x,y,'x',x,yprime,'o')
