Octave Band Averages from PSD
12 views (last 30 days)
Show older comments
Hi everyone,
I am using a simple code to extract the PSD from a set of time-based sound data. I am now interested in obtaining the octave band averages of this data and I am completely lost. Can anyone help me out?
The code I ave at the moment is:
*clear all
close all
echo on
Fs= 4000; % Sampling Frequency (Hz)
x = xlsread('No Excitation.csv',1,'J35:J52034');
Hs=spectrum.welch;
psd(Hs,x,'Fs',Fs);
echo off;*
Thanks, John
0 Comments
Answers (1)
Wayne King
on 6 Oct 2012
Edited: Wayne King
on 6 Oct 2012
You want to average the power over octave bands? You can do that with the avgpower() method.
t = 0:0.001:1-0.001
Fs = 1000;
x = cos(2*pi*50*t)+1/2*sin(2*pi*200*t)+randn(size(t));
psdest = psd(spectrum.welch,x,'Fs',Fs);
Now to get the average power from [0,100] Hz
pwr = avgpower(psdest,[0 100]);
It may be more useful to consider the percentage of the total power in that interval
totpower = avgpower(psdest,[0 Fs/2]);
100*(pwr/totpower)
See Also
Categories
Find more on Octave in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!