function PolynomialniRegrese(f,uzly,n,vargin)

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

A = zeros(n+1,n+1);
bb = zeros(n+1,1);
for i=0:n
    for j=0:n
        A(i+1,j+1) = (x.^i)*((x.^j)');
    end
    bb(i+1) = fx*((x.^i)');
end
alfa = A\bb;

xx = linspace(a,b,100);
fxx = xx; fxx(:) = 0;
for j=0:n
    Lj = xx.^j;
    fxx = fxx + alfa(j+1)*Lj;
end
if nargin==3
    plot(xx,fxx,'r',xx,f(xx),'b',x(1:(m+1)),fx(1:(m+1))','kx')
else
    plot(xx,fxx,vargin,xx,f(xx),'b',x(1:(m+1)),fx(1:(m+1))','kx')
end