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

Add output argument to return the condition number of the RmmMtx from the obsFiltTD.m

parent 13015a2c
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
% Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com
%
% Date: 14/09/2024 (DD/MM/YYYY)
% Date: 15/09/2024 (DD/MM/YYYY)
%
% Copyright: MIT
% --------------------------------------------------
......@@ -86,6 +86,12 @@
% RmmMtx [numeric]: This is the matrix with the cross-correlation matrices
% of the monitoring microphone signals stacked together.
% The dimensions are TotFiltLenxTotFiltLenxJ.
%
% condNum [numeric]: The condition number of the monitoring microphone
% cross-correlation matrix "RmmMtx". This is a vector of
% length J, with each element corresponding to the
% condition number of the matrix for each trial/sound
% field realisation.
%
% mMtx [numeric]: The monitoring microphone signals vectorised so that they
% can be used directly with either "Ovec" or "Oopt"
......@@ -136,12 +142,12 @@
% Stephen J. Elliott and Jordan Cheer.
%
% --------------------------------------------------
function [O, Rme, Rmm, Ovec, RmeMtx, RmmMtx, mMtx, Omean, RmeMean, RmmMean, Oopt, RmeMtxMean, RmmMtxMean] = obsFiltTD(e, m, beta, filtLen, delay, fs)
function [O, Rme, Rmm, Ovec, RmeMtx, RmmMtx, condNum, mMtx, Omean, RmeMean, RmmMean, Oopt, RmeMtxMean, RmmMtxMean] = obsFiltTD(e, m, beta, filtLen, delay, fs)
% ====================================================
% Check for number of arguments
% ====================================================
narginchk(2, 6);
nargoutchk(0, 13);
nargoutchk(0, 14);
% ====================================================
% Validate input arguments
......@@ -253,13 +259,20 @@ function [O, Rme, Rmm, Ovec, RmeMtx, RmmMtx, mMtx, Omean, RmeMean, RmmMean, Oopt
% ====================================================
% Provide additional output arguments
% ====================================================
% The monitoring microphone signals vectorised per trial/sound field realisation
% Condition number of RmmMtx for each trial/sound field realisation
if nargout > 6
for jIdx = size(RmmMtx, 3):-1:1
condNum(jIdx) = cond(Rmm(:, :, jIdx));
end
end
% The monitoring microphone signals vectorised per trial/sound field realisation
if nargout > 7
mMtx = reshape(m, prod(size(m, [1, 2])), size(m, 3));
end
% Observation filter calculated with the mean Rme and Rmm over the trials/sound field realisation
if nargout > 7
if nargout > 8
% Average the RmeMtx and RmmMtx matrices
RmeMtxMean = mean(RmeMtx, 3);
RmmMtxMean = mean(RmmMtx, 3);
......@@ -272,12 +285,12 @@ function [O, Rme, Rmm, Ovec, RmeMtx, RmmMtx, mMtx, Omean, RmeMean, RmmMean, Oopt
end
% Mean cross-correlations between monitoring and virtual microphones over trials/sound field realisations
if nargout > 8
if nargout > 9
RmeMean = mean(Rme, 4);
end
% Mean cross-correlations of monitoring microphones over trials/sound field realisations
if nargout > 9
if nargout > 10
RmmMean = mean(Rmm, 5);
end
end
\ No newline at end of file
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