Skip to content
Snippets Groups Projects
Commit 89745645 authored by Achilles Kappis's avatar Achilles Kappis
Browse files

Remove scaling from cross-correlations and reshape observation filters with...

Remove scaling from cross-correlations and reshape observation filters with single liners instead of loops in obsFiltTD.m
parent bf1d1ecd
No related branches found
No related tags found
1 merge request!4Fix time-domain calculations of the optimal observation filter
This commit is part of merge request !4. Comments created here will be created in the context of that merge request.
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment