Is the unit of Cxy from cpsd in decibel?

Hi,
I want to use the Signal Processing Toolbox to compute the Cross spectrum gain and phase for my sequences X and Y. I wondered the Cxy that cpsd gives me is in the units of dB? I saw the example and it says the unit is dB/rad/freq, how can I convert it to dB?
Thank you so much!

 採用された回答

Wayne King
Wayne King 2011 年 10 月 20 日

0 投票

Hi, no, the output is the cross spectrum, it is complex-valued. If you want the output in db. Use
10*log10(abs(Pxy));
For example:
Fs = 1000;
t = 0:1/Fs:.296;
x = cos(2*pi*t*200)+randn(size(t));
y = cos(2*pi*t*100)+randn(size(t));
[Pxy,F] = cpsd(x,y,[],[],[],Fs);
plot(F,10*log10(abs(Pxy))); grid on;
% compare to
figure;
cpsd(x,y,[],[],[],Fs);

4 件のコメント

Wayne King
Wayne King 2011 年 10 月 20 日
By the way, another common convention for "dB" is the log10 of the power measures. 10*log10(abs(Pxy).^2) or 20*log10(abs(Pxy))
Kay
Kay 2011 年 10 月 20 日
so 20*log10(abs(Pxy)) gives me the values in dB? not dB/hz?
Also, if I want to plot the phase of Pxy, is that simply do:
phase = angle(Pxy);
?
thanks a lot!!
Kay
Wayne King
Wayne King 2011 年 10 月 20 日
yes, angle(Pxy) gives you the phase. The difference between 10*log10() and 20*log10() is the difference between magnitude and magnitude squared, they are both in dB per unit frequency.
Kay
Kay 2011 年 10 月 20 日
is dB same as dB/Hz?
if not, how do I get rid it?

サインインしてコメントする。

その他の回答 (2 件)

Kay
Kay 2011 年 12 月 1 日

0 投票

I'm getting some offset of the result after cpsd, do you know if the algorithm of the cpsd would give me a larger set of numbers as a result?
thanks, Kay

1 件のコメント

Wayne King
Wayne King 2011 年 12 月 1 日
offset after what result?

サインインしてコメントする。

Giandomenico
Giandomenico 2013 年 1 月 31 日
編集済み: Giandomenico 2013 年 1 月 31 日

0 投票

I have a problem with cpsd amplitude. I generate a 20s signal with two harmonic components at 5 and 10Hz, both with an amplitude of 10, then I perform the cpsd I have the two components at the right frequencies, but both with an amplitude of 1000??? it should be 100, right?
fs=512; % sampling frequency
L=10240; % samples
t=(0:L-1)'/fs;
x=10*sin(2*pi*10*t)+10*sin(2*pi*5*t);
[Gxx, f]=cpsd(x,x,rectwin(L),0,L,fs);
plot(f,abs(Gxx),'.r')
Where I am wrong?

カテゴリ

質問済み:

Kay
2011 年 10 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by