Octave Band Averages from PSD

조회 수: 7 (최근 30일)
John
John 2012년 10월 6일
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

답변 (1개)

Wayne King
Wayne King 2012년 10월 6일
편집: Wayne King 2012년 10월 6일
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)
  댓글 수: 1
John
John 2012년 10월 8일
Thankyou. That is extremely useful. I do have one more question though if you don't mind.
I am using msspectrum to plot the sound power over the frequency range and using avgpower on my calibration tests to determine how much each test needs to be adjusted.
ie. adjustment = real calibration value - avgpower(calibration)
At this stage, how do I take that adjustment value and apply it to my tests.
ie. instead of plotting by hmss = msspectrum(Hs,x,'Fs',Fs);
plot(hmss)
I want to plot that exact plot by translated down by the adjustment value.
Also, is there any way of exporting the (x,y) values that build the graph if i do plot(hmss)?

댓글을 달려면 로그인하십시오.

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by