function porovnaniLagrangeovyACebysevovyInterpolace()

% Rungeho funkce
f = @(x) (1./(1+x.^2)); a = -5; b = 5;
for n=1:20
    uzly = linspace(a,b,n+1);
    InterpolaceLagrangeova(f,uzly);
    uzlyCeb = uzlySkalovanehoCebysevovaPolynomu(n,a,b);
    hold on
    InterpolaceLagrangeova(f,uzlyCeb);
    log = sprintf('f(x) = 1/(1+x^2), a = -5, b = 5, n = %d',n);
    title(log)
    pause;
    clf
end

% nase funkce
f = @(x) (sin(exp(2*x))); a = -1; b = 1;
for n=1:20
    uzly = linspace(a,b,n+1);
    InterpolaceLagrangeova(f,uzly);
    uzlyCeb = uzlySkalovanehoCebysevovaPolynomu(n,a,b);
    hold on
    InterpolaceLagrangeova(f,uzlyCeb,'r--');
    log = sprintf('f(x) = sin(exp(x)), a = -1, b = 1, n = %d',n);
    title(log)
    pause;
    clf
end

