Different results using poctave and octaveFilter while obtaining a 1/3-octave rms pressure over frequency
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm aiming at obtaining a 1/3 octave band frequency signal for specific centre frequencies. I want to use Matlab's octaveFilter functionality but my results differ from using poctave with the same signals. How to get the same results?
Fs = 48000; % Sampling rate
t = 0:1/Fs:1-1/Fs; % Time vector of 1 second
f = 1000; % Frequency of signal
dpres = 1.415*sin(2*pi*f*t); % Signal in [Pa]
figure()
[p,cf] = poctave(dpres,Fs,'FrequencyLimits',[3 5000],'BandsPerOctave',3);
semilogx(cf,p,'ro-' )
frCen = cf;
[Spl,frCen] = CompOctSplFreq(dpres,frCen)
figure()
semilogx(frCen,Spl,'ro-')
title('1/3-Octave Filtered SPL over Frequency')
xlabel('Center Frequency of Octave Band Filter [Hz]')
ylabel('SPL [dB]')
% Plot delta
figure();
plot(p-Spl')
function [Spl,frCen] = CompOctSplFreq(dpres,frCen)
% Reads singal in pressure over time
freqNum = length(frCen);
Fs = length(dpres);
% Setting up the 1/3-octave filters for all center frequencies
for f = 1:freqNum
octaveFilterBank{f} = octaveFilter(frCen(f),'1/3 octave','SampleRate',Fs,'FilterOrder',12);
% Filtering the signal with the corresponding filters
dpresFiltered(:,f) = octaveFilterBank{f}(dpres');
% Getting the average for each filter frequency band
drms(f) = sqrt(sum(dpresFiltered(:,f).^2)/length(dpresFiltered(:,f)));
end
% Converting the root mean square pressure to SPL
pRef = 20e-06; % Reference pressure
% Spl = 20*log10(drms/pRef);
% For testing
Spl = drms;
end
0 Commenti
Risposte (1)
Mark Thompson
il 8 Gen 2024
By default, poctave() utilises a filter order of 6. Your use of octaveFilter() specifies a filter order of 12. I think what you are seeing is slight differences in the BPFs used by each different octave filter function. Have you been able to resolve this issue, I'm also quite interested...
0 Commenti
Vedere anche
Categorie
Scopri di più su Octave in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!