Plotting sound pressure level

27 次查看(过去 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 Processing Algorithm Design 的更多信息

产品


版本

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by