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

11 visualizaciones (últimos 30 días)
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!

Respuesta aceptada

Deepak Gupta
Deepak Gupta el 13 de Jul. de 2020
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

Más respuestas (0)

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by