How does bandpower() round the input frequencies in variable 'freqrange'?

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

채택된 답변

Paul
Paul 2023년 3월 31일
편집: Paul 2023년 3월 31일
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
ans = 1
Bandpower from the exact frequencies from 50-150
pband1 = bandpower(x,1000,[50 150])
pband1 = 0.6190
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])
pband2 = 0.6190
isequal(pband1,pband2)
ans = logical
1

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Measurements and Feature Extraction에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by