Plotting sound pressure level

57 views (last 30 days)
Alok Bendale
Alok Bendale on 18 Oct 2019
Commented: Alok Bendale on 20 Nov 2019
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')

Answers (1)

Soham Chakraborty
Soham Chakraborty on 22 Oct 2019
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 Comment
Alok Bendale
Alok Bendale on 20 Nov 2019
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.

Sign in to comment.

Products


Release

R2015a

Community Treasure Hunt

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

Start Hunting!