function InterpolaceLagrangeova(f,uzly,vargin)

n = length(uzly)-1;
x = uzly;
a = x(1); b = x(end);
fx = f(x);

xx = linspace(a,b,100);
fxx = xx; fxx(:) = 0;
for j=0:n
    Lj = xx; Lj(:) = 1;
    for k=0:n
        if j==k
            continue;
        end
        Lj = Lj .* ((xx-x(k+1)))./(x(j+1)-x(k+1));
    end
    fxx = fxx + fx(j+1)*Lj;
end
if nargin==2
    plot(xx,fxx,'r',xx,f(xx),'b',x(1:(n+1)),fx(1:(n+1))','kx')
else
    plot(xx,fxx,vargin,xx,f(xx),'b',x(1:(n+1)),fx(1:(n+1))','kx')
end