Power cross-spectral density

14 views (last 30 days)
Martin
Martin on 25 Oct 2012
Commented: Fotios Kostarelos on 11 Jul 2020
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.

Accepted Answer

Wayne King
Wayne King on 27 Oct 2012
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.
  4 Comments
Martin
Martin on 28 Oct 2012
"If you try to do a magnitude squared coherence estimate without basing it on such a cross spectrum, you'll end up with a worthless magnitude squared coherence that is identically 1. This is well-documented in the literature."
And now documented by my MATLAB code. :) I will try to read about the so-called Welch estimate.
Thank you very much for the answers - they are highly appreciated.
Fotios Kostarelos
Fotios Kostarelos on 11 Jul 2020
Hi
I'm currently trying to implement coherence in hardware for my project. To do that, I need to compute cross power spectrum and (auto)power spectrum density respectively. The first thing I did is to familiarize myself with the matlab calls mscohere, cpsd, and pwelch, and then I tried to write code in order to get the same results with these functions. My confusion started with cross power spectrum, and especially when I first searched about it and came up with the concept of cross correlation in order to obtain the cross spectrum(and auto correlation for auto power spectrum). In theory ℱ{crosscorrelation(x,y)} results in the cross power spectrum density, however in prectise I've managed to get the same results as the cpsd function using this equation ℱ{x}*conj(ℱ{y}) and not the above(ℱ{crosscorrelation(x,y)}), as you discuss on this post. So, first question is, is this the case ℱ{crosscorrelation(x,y)}=ℱ{x}*conj(ℱ{y})? The only thing I can verify with code is ℱ{convolution(x,y)}= ℱ{x} * ℱ{y}. Also, In the matlab documentation I haven't found any requirement for correlated signals in order to use mscohere cpsd or pwelch function. So, is it necessary to use correlation in order to obtain cross or (auto)power spectrum? What's the difference when I use correlation and when I dont?
Thank you

Sign in to comment.

More Answers (1)

Martin
Martin on 27 Oct 2012
Sorry for the rudeness, but I will try a bump of this thread. Will not happen again.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!