function P = Lagrange(X,Y,x) P=0; for k=1:10 L=Y(k); for i=1:10 if(i~=k) L=L*(x-X(i))/(X(k)-X(i)); end end P=P+L; end