function yi = triginterp ( xi, xd, yd )

% TRIGINTERP Trigonometric interpolation.
%
%  Discussion:
%
%    Sample data (xd,yd) at equally spaced points is known.
%
%    The trigonometric interpolant to this data is to be evaluated
%    at the points xi.
%
% Input:
5
%   xi  interpolant points;
%   xd  data nodes;
%   yd  data values;
%
% Output:
%
%   yi   interpolant values;
%
  N = length ( xd );
%
% Adjust the spacing of the given independent variable.
%
  h = 2 / N;
  scale = ( xd(2) - xd(1) ) / h;
  xd = xd / scale;  
  xi = xi / scale;
%
% Evaluate the interpolant.
%
  yi = zeros ( size ( xi ) );
  for k = 1 : N
    yi = yi + yd(k) * trig_cardinal ( xi - xd(k), N );
  end

  return
end


