function runge2()             
close all
clear all
a = -1; b = 1; m = 32; k = pi*8;%Equally Spaced, m=16
for i = m+1:-1:1% Chebyshev Nodes
    ii = m+2-i;
   x(i,1) = .5*(b+a) +.5*(b-a)*cos(pi*(i-1)/m) ; end        
y = rung(x,k);
x0 = linspace(a,b,100);   y0 = rung(x0,k);
a = interpNrecur(x,y);
pVal = HornerN(a,x,x0);
%[P,S] = polyfit(x,y,m);
%pVal = polyval(P,x0);
%plot(x0,pVal-y0,'g--')
plot(x,y,'r*',x0,pVal,'g--',x0,y0,'b')
%axis([-5,5,-2,2])

function y = rung(x,a)
%y = 1./(1+a*x.^2);
y = sin(a*x);