How Do You Compute Power Cross-Spectral Density for Coherence Functions?

  • Thread starter Thread starter MartinDU
  • Start date Start date
  • Tags Tags
    Density Power
Click For Summary

Homework Help Overview

The discussion revolves around the computation of power cross-spectral density (PCSD) in the context of frequency response functions, specifically focusing on the coherence function. The original poster is seeking clarification on the correct approach to compute the PCSD using power spectral densities (PSD) derived from input and output data samples.

Discussion Character

  • Exploratory, Conceptual clarification, Mathematical reasoning

Approaches and Questions Raised

  • The original poster attempts to compute the PCSD using a formula involving the product of PSDs, questioning whether this approach is valid. Some participants provide alternative definitions based on the Wiener-Khinchin theorem, suggesting that the original approach may not yield the correct results.

Discussion Status

Participants are actively engaging in clarifying the definitions and computations related to PSD and PCSD. Some have pointed out potential errors in the original poster's calculations, while others are exploring the implications of using cross-power versus the correct spectral density calculations. There is a productive exchange of insights regarding the relationship between the frequency response function and the computed values.

Contextual Notes

There are indications of confusion regarding the definitions and calculations of spectral densities, as well as the implications of using cross-power in the context of phase information. The original poster has shared MATLAB code to illustrate their computations, which has prompted further analysis and questioning from participants.

MartinDU
Messages
3
Reaction score
0

Homework Statement


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


Homework Equations


pcsd_xy = psd_xx.*conj(psd_yy)

where psd = power spectral density.

The Attempt at a Solution


Is this a correct approach to obtain the cross-spectral density?

Kind regards,
Martin.
 
Physics news on Phys.org
No, that's not going to do it. Look at the definition of the cross-power PSD from the Wiener-Khinchin theorem
[tex]S_{xy}(\omega)=\int_{-\infty}^{\infty}{R_{xy}(\tau)e^{-i\omega \tau} d\tau},[/tex]where R is the cross-correlation function
[tex]R_{xy}(\tau)=\int_{-\infty}^{\infty}{x(t) y^*(t+\tau)dt}.[/tex]You can see that you can't get the above from what you wrote (note that your PSD S_xx is found by setting x=y).
 
Thanks for the answer. Then I have probably made an error on an earlier state since I obtain compliance between the frequency response function when I use

S_xx(w)=|H(w)|^2 S_ff(w)

and

S_xx(w)=H(jw)S_xf(w).

I have posted a small MATLAB script in which I compute these quantities. I know it is a lot to ask for but can you spot something wrong with my computation of the PSDs?

% Time increment %
dt=t(2)-t(1);

% Number of samples %
N=2^nextpow2(length(t));

% Frequency band %
f=1/dt/N*(0:(N-2)/2);

% --- Fast Fourier transformation --- %

% Input data %
Ft_in=fft(wdata_in,N);

% Output data %
xt_out=fft(wdata_out,N);

% --- Power spectral densities --- %

% Power spectral density of input data %
PSD_in=Ft_in.*conj(Ft_in)/N;

% Power spectral density of output data %
PSD_out=xt_out.*conj(xt_out)/N;

% Power cross-spectral densities of input and output data %
PCSD_in_out=Ft_in.*conj(xt_out)/N;
PCSD_out_in=xt_out.*conj(Ft_in)/N;

% Frequency response function %
H=PSD_out(1:N/2)./PCSD_out_in(1:N/2);

Your answer would be highly appreciated.

Thanks in advance and kind regards,
//Martin.
 
Your input and output PSD's are correct, your cross power calculation is not. You are getting a pleasing result because cross-power would be the wrong thing to use, were you to calculate it correctly. The transfer function is [tex]H(\omega)=\frac{Y(\omega)}{X(\omega)},[/tex] where Y and X are the output and input spectra of your system. Look at your code--you in fact calculate H*, albeit through a very convoluted process.
 
Again, thank you very much for the answer.

The reason why I want to use the cross-power is that I want informations about the phase angle as well as the magnitude.
So what you are saying is that I through

H=PSD_out(1:N/2)./PCSD_out_in(1:N/2)

actually get the complex conjugate of H?
 
MartinDU said:
Again, thank you very much for the answer.

The reason why I want to use the cross-power is that I want informations about the phase angle as well as the magnitude.
So what you are saying is that I through

H=PSD_out(1:N/2)./PCSD_out_in(1:N/2)

actually get the complex conjugate of H?
Take a look at your own code:
MartinDU said:
PSD_out=xt_out.*conj(xt_out)/N;

PCSD_out_in=xt_out.*conj(Ft_in)/N;

% Frequency response function %
H=PSD_out(1:N/2)./PCSD_out_in(1:N/2);
What does it look like to you?
 

Similar threads

Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
6K