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

조회 수: 9 (최근 30일)
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by