You are on page 1of 2

Pseucódigo de Matlab para la interpolación de Lagrange.

function p=interpolaciondeLagrange(x,f,a)
n=length(x);
syms t;
p=0;
for i=1:n
L=1;
for j=1:n
if i~=j
L=L*(t-x(j))/(x(i)-x(j));
end
end
p=p+L*f(i)
end
t=a;
p=eval(p)

You might also like