function [S] = xProd(X,iband);
%  Usage:  [S] = xProd(X,iband);
%  Inputs: 
%  	X(nch,npts)   = input complex fourier coefficients 
%       iband(2,Nbt) = array of integer band limits (in the
%		nominal range 2:npts/2)
%  Outputs:
%	X(nch,nch,Nbt) = complex sdm averaged over each band
[nch,npts] = size(X);
[dum,Nbt] = size(iband);
S = zeros(nch,nch,Nbt);
for ib = 1:Nbt
   i1 = iband(1,ib); i2 = iband(2,ib);
   for k = 1:nch
      for j = 1:k
         S(k,j,ib) = 	sum(X(k,i1:i2).*conj(X(j,i1:i2)));
         if(j < k)
            S(j,k,ib) = conj(S(k,j,ib));
         end
      end
   end
end
