필터 지우기
필터 지우기

bandpower, why doesn't percentage power add up?

조회 수: 2 (최근 30일)
CarrotCakeIsYum
CarrotCakeIsYum 2015년 10월 19일
댓글: CarrotCakeIsYum 2016년 10월 26일
I'm measuring the frequency people sway at whilst they balance. I need to calculate the percentage power of specific frequency bands. The input vector is sampled at 1000Hz, and has a length of 15000.
To do this I've been using the Matlab function 'bandpower', and have written the following function:
function output = balance_power_test(data)
%Calculates the power of frequencies in four frequency bands.
%Output is given as percentage of total power.
output = zeros(4,1);
ptot = bandpower(data,1000,[0 500]);
pwr_band1 = bandpower(data,1000,[0 50]);
pwr_band2 = bandpower(data,1000,[50 100]);
pwr_band3 = bandpower(data,1000,[100 200]);
pwr_band4 = bandpower(data,1000,[200 500]);
output(1) = 100*(pwr_band1/ptot);
output(2) = 100*(pwr_band2/ptot);
output(3) = 100*(pwr_band3/ptot);
output(4) = 100*(pwr_band4/ptot);
end
However I'm finding that the percentages of power don't add up to anywhere near 100%. E.g. testing the above:
rng('default')
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t)+randn(size(t));
>> balance_power_test(x)
ans =
0.0847
0.0847
0.0847
0.3879
The percentage powers add up to 64.19%. What am I doing wrong!?

채택된 답변

Greg Dionne
Greg Dionne 2015년 10월 22일
Looks like you're double-counting frequencies.
Try this instead:
function output = balance_power_test(data)
%Calculates the power of frequencies in four frequency bands.
%Output is given as percentage of total power.
output = zeros(4,1);
ptot = bandpower(data,1000,[0 500]);
pwr_band1 = bandpower(data,1000,[0 50]);
pwr_band2 = bandpower(data,1000,[51 100]);
pwr_band3 = bandpower(data,1000,[101 200]);
pwr_band4 = bandpower(data,1000,[201 500]);
output(1) = 100*(pwr_band1/ptot);
output(2) = 100*(pwr_band2/ptot);
output(3) = 100*(pwr_band3/ptot);
output(4) = 100*(pwr_band4/ptot);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by