% Oving 6, oppgave 4.c)

n = 20;

% Uniformt fordelte noder.
h = 10/n;
x = [-5:h:5]

% Chebyshev noder. 
% i = 0:n
% x = 5*cos((2*i+1)*pi/(2*n+2));

y = 1./(1+x.^2);

% Polynominterpolasjon. 
a = polyfit(x,y,n);

t = linspace(-5,5,101);
plot(t,polyval(a,t),x,y,'*')
grid
