diff --git a/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFiltEst.m b/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFiltEst.m index c01a20e1059bd01b620d7acdd8024d0fcaa357f4..3a799bd5bbbf5629e118877d1ffa3f27273ef9a1 100644 --- a/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFiltEst.m +++ b/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFiltEst.m @@ -28,10 +28,10 @@ % matrix must be NxM, where N is the number of % virtual microphones and M the number of sources. % -% srcCsd [numeric] (Optional): The source cross spectral density matrix. -% This must be a square (MxM) symmetric matrix -% with the cross power spectral density of the -% sources. [Default: eye(M)] +% Svv [numeric] (Optional): The source cross spectral density matrix. This +% must be a square (MxM) symmetric matrix with +% the cross power spectral density of the +% sources. [Default: eye(M)] % % -------------------------------------------------- % Output @@ -60,7 +60,7 @@ % Notes % % -------------------------------------------------- -function [est, err, errSqr, normErrSqr, See] = obsFiltEst(Pm, O, Pe, srcCsd) +function [est, err, errSqr, normErrSqr, See] = obsFiltEst(Pm, O, Pe, Svv) % ==================================================== % Check for number of arguments % ==================================================== @@ -82,17 +82,17 @@ function [est, err, errSqr, normErrSqr, See] = obsFiltEst(Pm, O, Pe, srcCsd) Pe = NaN; end - if nargin > 3 && ~isempty(srcCsd) - validateattributes(srcCsd, "numeric", {'2d', 'nonnan', 'finite'}, mfilename, "Source cross spectral density matrix", 3) + if nargin > 3 && ~isempty(Svv) + validateattributes(Svv, "numeric", {'2d', 'nonnan', 'finite'}, mfilename, "Source cross spectral density matrix", 3) % Check for correct dimensions - if diff(size(srcCsd)) + if diff(size(Svv)) error("The source power spectral density matrix must be a square matrix"); - elseif size(srcCsd, 1) ~= size(Pe, 1) + elseif size(Svv, 1) ~= size(Pe, 1) error("The number of rows of the source power spectral density matrix must be equal to the number of sources"); end else - srcCsd = eye(size(Pe, 2)); + Svv = eye(size(Pe, 2)); end @@ -110,7 +110,7 @@ function [est, err, errSqr, normErrSqr, See] = obsFiltEst(Pm, O, Pe, srcCsd) % Sum of squared estimation errors if nargout > 2 for eIdx = size(Pe, 1):-1:1 - errSqr(eIdx) = err(eIdx, :) * srcCsd * err(eIdx, :)'; + errSqr(eIdx) = err(eIdx, :) * Svv * err(eIdx, :)'; end errSqr = errSqr.'; @@ -119,7 +119,7 @@ function [est, err, errSqr, normErrSqr, See] = obsFiltEst(Pm, O, Pe, srcCsd) % Normalised squared errors if nargout > 3 for eIdx = length(errSqr):-1:1 - See(eIdx) = Pe(eIdx, :) * srcCsd * Pe(eIdx, :)'; + See(eIdx) = Pe(eIdx, :) * Svv * Pe(eIdx, :)'; normErrSqr(eIdx) = errSqr(eIdx)/See(eIdx); end