You are on page 1of 1

function lagrange_chebyshev()

% Comparison of Lagrangian interpolation polynomials for


% equidistant and non-equidistant (Chebyshev) sample points
% for the function
%
% f(x) = 1/(1+x^2)
%
% using polynomials of degree 5 and 10.

% Author : Andreas Klimke


% Date : July 2002
% Version: 1.1

% Funktionen definieren
f = inline('1./(1+x.^2)');

% Stützstellen bestimmen
xi = { linspace(-5,5,6); ...
[chebyshev(6)*5]; ...
linspace(-5,5,11); ...
[chebyshev(11)*5] };

for k = 1:4
yi{k} = f(xi{k});
ci{k} = polyfit(xi{k},yi{k},length(xi{k})-1);
end

You might also like