function [t,p] = lagrange(x,y,a,b);
%
% Poynomial interpolation in Lagrange Form. 
%
% Input:   x : vector with the nodes
%          y : Vector with the corresponding y-values. 
%      [a,b] : Interpolation interval 
% Output:  t : vector of equally spaced points in [a,b]
%          p : the value of the interpolation 
%              polynomial in [a,b].

n = length(x);
t = linspace(a,b,101)';

p = zeros(size(t));
L = cardinal(x,t);
for k=1:n
    p = p + y(k)*L(:,k);
end
