function fxg=Lagrange(totalPoints,xValues,fValues,xg)

fxg=0.;

for i=1:totalPoints
    t=fValues(i);
    for j=1:totalPoints
       if j~=i
           t=t*(xg-xValues(j))/(xValues(i)-xValues(j));
       end        
    end
    fxg=fxg+t;
end
