How does bandpower() round the input frequencies in variable 'freqrange'?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Joey LeCheminant
il 30 Mar 2023
Modificato: Joey LeCheminant
il 11 Apr 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 Commenti
Risposta accettata
Paul
il 31 Mar 2023
Modificato: Paul
il 31 Mar 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Measurements and Feature Extraction in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!