Matlab1/3 Octave analysis different with ArtemiS

Hi All:
I am new in signal processing and I am trying to do a work in noise control and I would like get the same result with ArtemiS did.
My matlab code is:
clear;
fs = 48000.0;
x = load('x.txt');
data = load('data.txt');
result = load('result.txt');
L = 16384; % ???
nfft=8192; % ???
noverlap = 50;
window = hanning(L);
[pxx,f]=pwelch(data, window, noverlap, nfft, fs, 'centered','power');
p = poctave(pxx, fs, f, 'power', 'BandsPerOctave',3, 'FrequencyLimits',[20 20000]);
figure;
plot(x, result, 'r', x, p, 'b');
xlim([-1000 21000])
ylim([-0.1 1.6])
legend('ArtemiS','Matlab')
ArtemiS config is :
This is the result:
Does anyone know why the output are different?
The function poctave has a paramter : FilterOrder — Order of bandpass filters(6 default | positive even integer), may be cause the data difference, anyone who know how to disable it?

 Réponse acceptée

yingbo
yingbo le 31 Oct 2023

0 votes

clear;
fs = 48000.0;
x = load('x1.txt');
y = load('data04.txt');
result_ArtemiS = load('result04.txt');
win_length = 8192;
NFFT = 8192;
overlap = 0.50;
window = hanning(win_length);
[S, F] = spectrogram(y, window, overlap * NFFT, NFFT, fs);
frequencies = [20,25,31.5,40,50,63,80,100,125,160,200,250,315,...
400,500,630,800,1000,1250,1600,2000,2500,3150,...
4000,5000,6300,8000,10000,12500,16000,20000];
result_Matlab = zeros(length(frequencies), 1);
for i = 1:length(frequencies)
f_low = frequencies(i) / 2^(1/6);
f_high = frequencies(i) * 2^(1/6);
[~,f_low_idx] = min(abs(F - f_low));
[~,f_high_idx] = min(abs(F - f_high));
temp = S(f_low_idx:f_high_idx, :);
temp = temp(:);
temp = temp';
temp = abs(temp);
result_Matlab(i) = sqrt(sum(temp.^2));
end
result_Matlab(4) = result_Matlab(4) / 2;
result_Matlab = result_Matlab / 26933;
figure;
plot(x, result_ArtemiS, 'r-o', x, result_Matlab, 'b-o');

Plus de réponses (2)

yingbo
yingbo le 27 Oct 2023

0 votes

x changed from Frequency Bands to 1...31
yingbo
yingbo le 28 Oct 2023

0 votes

The function poctave has a paramter : FilterOrder — Order of bandpass filters(6 default | positive even integer), may be cause the data difference, anyone who know how to disable it?

Produits

Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by