How does bandpower() round the input frequencies in variable 'freqrange'?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Joey LeCheminant
el 30 de Mzo. de 2023
Editada: Joey LeCheminant
el 11 de Abr. de 2023
I am reviewing the documentation on the function 'bandpower' (Band power - MATLAB bandpower (mathworks.com))
My question is about the input variable 'freqrange':
If I want the range [4, 8), i.e. I want the power at 4 Hz and up to but not including 8 Hz, how would I communicate that to the bandpower function? I'm guessing that bandpower is based on FFT analysis, which would give signal power at discrete frequency bins and frequency resolution depends on signal length.
So if I told bandpower that freqrange=[4 7.99], would it round up to 8? or would it round down to the nearest frequency bin? (e.g. down to 7.75 if frequency resolution is .25Hz)
0 comentarios
Respuesta aceptada
Paul
el 31 de Mzo. de 2023
Editada: Paul
el 31 de Mzo. de 2023
Hi Joey,
bandpower is an .m file, at least in 2022a, so you can inspect the code.
My reading is that it will compute the power from f1 to f2 where f1 is the largest periodogram frequency that satisfies f1 <= freqrange(1) and f2 is the smallest frequency that satisfies f2 >= freqrange(2).
rng(100)
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t)+randn(size(t));
The frequency spacing is
1000/numel(t) % Hz
Bandpower from the exact frequencies from 50-150
pband1 = bandpower(x,1000,[50 150])
Bandpower still from 50-150 because those are the closest that bound freqrange from below and above at spacing of 1 Hz
pband2 = bandpower(x,1000,[50.9 149.1])
isequal(pband1,pband2)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Spectral Measurements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!