a  = -1; b = 1;
ll = 30;
m = 16;
for i = 1:m+1
     x(i,1) = .5*(b+a) +.5*(b-a)*(2*(i-1)-m)/m ;
 %  x(i,1) = .5*(b+a) +.5*(b-a)*cos(pi*(i-1)/m) ;
end
%   y = cos(ll*x);
    y = 1./(1+ll*x.^2);
close all
x0 = linspace(-1,1,200)';
    y0 = 1./(1+ll*x0.^2);
%   y0 = cos(ll*x0);
%  a = InterpN(x,y);
%  a = InterpNRecur(x,y);
  [P,S] = polyfit(x,y,8);
%  a = InterpV(x,y);
%  pVal = HornerN(a,x,x0);
%  pVal = HornerV(a,x0);
   pVal = polyval(P,x0);
%  plot(x0,pVal,'--',x,y,'*')
   plot(x0,y0,x0,pVal,'--',x,y,'*')
   axis([-1 1 -2 2])  