Plotting sound pressure level

조회 수: 35 (최근 30일)
Alok Bendale
Alok Bendale 2019년 10월 18일
댓글: Alok Bendale 2019년 11월 20일
Hello,
I am working on intensity probe to develop sound meter level. I did the fft and calculated sound pressure levels as well as sound power level using sound pressure level Lp=20log10(P/Pref) and sound power level Lw= Lp+5.344. The size of columns Lp and Lw is 1024x1 and size of frequency column in fft calculations is 1x513. How can I overcome this problem?
Sample rate is 16384
blocksize is 1024
frequency resolution is 50Hz
Signal is sine wave with frequency amplitude 6400
Thank you.
for i = 1 : numel(RealPa)
Lp(i, 1) = log10(RealPa(i))+ log10(100000)-log10(2); %Sound Pressure Level Calculation
end
for i=1:numel(Lp)
Lw(i,1)=Lp(i)+5.344; %Sound Power Level Calculation
end
%Beow is code for FFT
[d,s]=xlsread('CHANNEL1.xlsx');
t=d(:,1);
p=d(:,2);
L=length(t);
Ts=mean(diff(t));
Fs=1/Ts;
Fn=Fs/2;
pc=p-mean(p);
FTv=fft(pc)/L;
Fv=linspace(0,1,fix(L/2)+1)*Fn;
Iv=1:length(Fv);
figure(1)
plot(Fv,abs(FTv(Iv))*2)
grid
xlabel('Frequency in Hz')
ylabel('Amplitude in Pa')

답변 (1개)

Soham Chakraborty
Soham Chakraborty 2019년 10월 22일
Hi,
In order to get the sound pressure level of an audio signal, you can use the splMeter system object. You can refer to the following link for more information about it: https://www.mathworks.com/help/audio/ref/splmeter-system-object.html
You can declare the object as follows:
SPL = splMeter('SampleRate', frequency_value);
Then you can get the sound pressure level data that corresponds to that specific frequency value as follows:
[y, Fs] = audioread(name_of_file); >> [Lt,Leq,Lpeak,Lmax] = SPL(y);
You would have to repeat these steps for each one of the frequency value in the y array and form a matrix with all the sound pressure level data that corresponds to the frequency data.
You can find the time array that corresponds to the y array (the signal values) as follows:
time_in_sec = (1:size(y,1))/Fs;
  댓글 수: 1
Alok Bendale
Alok Bendale 2019년 11월 20일
Thank you for your response and also extremely sorry for replying so late, but I have data in terms of pressure not as an audio file. The attached file is one of the samples I have taken with two microphones.

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

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by