

function err_test

xk=linspace(-1,1,5);
x=linspace(-1,1,1000);

pn=polyfit(xk,exp(xk),4);
pnx=polyval(pn,x);
fx=exp(x);

clf;
axis equal
plot(x,abs(fx-pnx),'k-','LineWidth',2,...
                       'MarkerEdgeColor','k',...
                       'MarkerFaceColor','k',...
                       'MarkerSize',2)

% fx=(x-xk(1)).*(x-xk(2)).*(x-xk(3)).*(x-xk(4)).*(x-xk(5));
% fx=abs(fx);
% clf;
% axis equal
% plot(x,fx,'k-','LineWidth',2,...
%                        'MarkerEdgeColor','k',...
%                        'MarkerFaceColor','k',...
%                        'MarkerSize',2)