I'm fairly new to signal processing, and I have a multivariate time series whose spectral density matrix I wish to compute using only Fourier transform tools. For now, I'm just experimenting with a small number of channels and a small number of signals per channel. Later I'll worry about larger sets, more channels, windowing, averaging, etc.
Here's what I've tried so far, using only the FFT.
% INPUT: Time series data stored in "Data" with each column corresponding to a particular channel
% OUTPUT: Spectral density matrix S, a 3-d array, where S(i,j,k) denotes the cross-spectral density between channels i and j at the k-th frequency. (I'll worry later about the appropriate scaling of the frequencies.)
nfft = 2^nextpow2(r);
% Computations for each pairwise channel combination.
for k=1:length(Xi) S(i,j,k)=Pij(k);
Not only am I unsure as to whether this is correct, but I'm convinced there has to be an easier way, perhaps using other signal processing toolbox commands. (I understand how pwelch can be used for diagonal entries, which are power spectral densities, but what about the off-diagonal ones?)