Difference 'bandpower' with time-dependent signal or 'bandpower' with PSD
6 次查看(过去 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!
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!