Skip to content
Snippets Groups Projects

Fix time-domain calculations of the optimal observation filter

Merged Imported Achilles Kappis requested to merge ObsFiltTDFix into main
1 file
+ 6
12
Compare changes
  • Side-by-side
  • Inline
@@ -211,7 +211,7 @@ function [O, Rme, Rmm, Ovec, RmeMtx, RmmMtx, condNum, mMtx, Omean, RmeMean, RmmM
for mIdx = size(m, 2):-1:1
% Calculate the cross-correlations between virtual and monitoring microphones
for eIdx = size(e, 2):-1:1
corr = xcorr(m(:, mIdx, jIdx), e(:, eIdx, jIdx), filtLen, "unbiased");
corr = xcorr(m(:, mIdx, jIdx), e(:, eIdx, jIdx), filtLen);
Rme(:, mIdx, eIdx, jIdx) = corr(filtLen + 1:-1:2);
end
@@ -220,11 +220,11 @@ function [O, Rme, Rmm, Ovec, RmeMtx, RmmMtx, condNum, mMtx, Omean, RmeMean, RmmM
for mmIdx = mIdx:-1:1
% Auto-correlation matrices are Toeplitz symmetric
if mIdx == mmIdx
corr = xcorr(m(:, mmIdx, jIdx), m(:, mmIdx, jIdx), filtLen, "unbiased");
corr = xcorr(m(:, mmIdx, jIdx), m(:, mmIdx, jIdx), filtLen);
Rmm(:, :, mIdx, mmIdx, jIdx) = toeplitz(corr(filtLen + 1:-1:2));
else
corr = xcorr(m(:, mIdx, jIdx), m(:, mmIdx, jIdx), filtLen, "unbiased");
corr = xcorr(m(:, mIdx, jIdx), m(:, mmIdx, jIdx), filtLen);
% Cross-correlation matrices
for iIdx = filtLen-1:-1:0
@@ -250,12 +250,8 @@ function [O, Rme, Rmm, Ovec, RmeMtx, RmmMtx, condNum, mMtx, Omean, RmeMean, RmmM
Ovec(:, :, jIdx) = RmeMtx(:, :, jIdx).'/(RmmMtx(:, :, jIdx) + beta * eye(size(RmmMtx, 1)));
end
% "Split" observation filter vector to observation filters per monitoring and virtual microphone
for jIdx = size(Ovec, 3):-1:1
for mIdx = size(m, 2):-1:1
O(:, :, mIdx, jIdx) = Ovec(:, mIdx:size(m, 2):end, jIdx);
end
end
% "Split" observation filter vector to observation filters per monitoring and virtual microphone
O = permute(reshape(Ovec, size(Ovec, 1), size(m, 2), filtLen, size(Ovec, 3)), [1, 3, 2, 4]);
% ====================================================
% Provide additional output arguments
@@ -282,9 +278,7 @@ function [O, Rme, Rmm, Ovec, RmeMtx, RmmMtx, condNum, mMtx, Omean, RmeMean, RmmM
Oopt = RmeMtxMean.'/(RmmMtxMean + beta * eye(size(RmmMtxMean)));
% Reshape
for mIdx = size(m, 2):-1:1
Omean(:, :, mIdx) = Oopt(:, mIdx:size(m, 2):end);
end
Omean = permute(reshape(Oopt, size(Oopt, 1), size(m, 2), filtLen), [1, 3, 2]);
end
% Mean cross-correlations between monitoring and virtual microphones over trials/sound field realisations
Loading