フィルターのクリア

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
  1 件のコメント
CarrotCakeIsYum
CarrotCakeIsYum 2016 年 10 月 26 日
Sorry to be very late... but thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by