
function demo_runge_lin

Nmax=26;
esp=1:Nmax;
N=2.^esp;

f=inline('1./(1+x.^2)');
t=linspace(-5,5,10000); % NODI TEST.
ft=feval(f,t);
errV=[];

for n=N
x=linspace(-5,5,n);     % NODI SUDDIV.
y=feval(f,x);           % (x,y) COPPIE INTP.
st=interp1(x,y,t,'linear'); 
err=norm(ft-st,inf);
errV=[errV; err];
end

for ii=1:Nmax/2
    aa=N(ii); bb=errV(ii);
    cc=N(ii+Nmax/2); dd=errV(ii+Nmax/2);
    fprintf('\n \t $%8.0f$ & $%1.2e$ & $%8.0f$ & $%1.2e$ \\\\',aa,bb,cc,dd);
end