Difference 'bandpower' with time-dependent signal or 'bandpower' with PSD

9 ビュー (過去 30 日間)
Inti Vanmechelen
Inti Vanmechelen 2020 年 7 月 13 日
コメント済み: Inti Vanmechelen 2020 年 7 月 13 日
Hi all,
I have a question with respect to matlab's built-in function "bandpower".
The power of a certain signal can be calculated starting from a time-dependent signal, or from a PSD outcome.
In both cases, the result is the same:
t = 0:0.001:1-0.001;
fs = 1000;
x = cos(2*pi*100*t)+randn(size(t));
p = bandpower(x)
p = 1.4368
[pxx,f] = periodogram(x,rectwin(length(x)),length(x),fs);
p2 = bandpower(pxx,f,'psd')
p2 = 1.4368
However, when adding a frequency range (since I am interested in the average power in a specific frequency range), the result is not the same with the two methods:
freqrange = [0,5];
p = bandpower(x,fs,freqrange)
p = 0.0122
[pxx,f] = periodogram(x,rectwin(length(x)),length(x),fs);
p2 = bandpower(pxx,f,freqrange,'psd')
p2 = 0.0136
Any suggestion as to why these results are not equal would be greatly appreciated!

採用された回答

Deepak Gupta
Deepak Gupta 2020 年 7 月 13 日
Hi Inti,
Bandpower function by default uses hamming window and in the psd calculation you have used rectangular window which is creating the difference in two methods so if you use same windows in both methods, results should be same.
t = 0:0.001:1-0.001;
fs = 1000;
x = cos(2*pi*100*t)+randn(size(t));
freqrange = [0,5];
p1 = bandpower(x,fs,freqrange)
[pxx,f] = periodogram(x,hamming(length(x)),length(x),fs);
p2 = bandpower(pxx,f,freqrange,'psd')
Cheers,
Deepak
  1 件のコメント
Inti Vanmechelen
Inti Vanmechelen 2020 年 7 月 13 日
Aha! That really helps!
Thank you for the quick reply :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by