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:
Fs= 4000; % Sampling Frequency (Hz)
x = xlsread('No Excitation.csv',1,'J35:J52034');
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)
Play games and win prizes!Learn more