MATLAB: Power cross-spectral density

cross-spectral densityfftfrequency domainpower spectral density

Hi all,
I am curently working with frequency response functions on the basis of 1 input data sample and 1 output data sample. As I would like to plot the coherence function, I need to compute the cross-spectral densities. Since I am new to this field, I would like to ask some of you experts whether it is correct to compute a power cross-spectral density (pcsd) as
pcsd_xy = psd_xx.*conj(psd_yy)
where psd = power spectral density. Is this correct? I know that MATLAB has commands which can solve this for me, but I would really like to programme it myself.
Thanks in advance.
Kind regards, Martin Ulriksen.

Best Answer

That is not correct. The cross spectrum (the Fourier transform of the cross correlation) is not real-valued. The cross spectrum is (ignoring the scaling factors) the DFT of X times the complex conjugate of the DFT of Y.
The way you have it written there is no need to do conj(psd_yy) because the PSD of y is real-valued.
The cross-correlation of X and Y is not an even function of the lag, k, unlike the autocorrelation of X OR the autocorrelation of Y. That is why the Fourier transform of the cross-correlation (the cross spectrum) is complex-valued.
Related Question