From 80575f59952dc70de41aa9ead3be17474505ef21 Mon Sep 17 00:00:00 2001
From: ZaellixA <axilleaz@protonmail.com>
Date: Wed, 4 Sep 2024 18:37:43 +0100
Subject: [PATCH] Add checks for the dimensions of Svv in obsFiltEst.m

---
 .../MATLAB/Functions/obsFiltEst.m                     | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFiltEst.m b/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFiltEst.m
index ae04ff9..c01a20e 100644
--- a/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFiltEst.m	
+++ b/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFiltEst.m	
@@ -3,7 +3,7 @@
 % Author: Achilles Kappis
 % e-mail: axilleaz@protonmail.com
 %
-% Date: 23/08/2024 (DD/MM/YYYY)
+% Date: 04/09/2024 (DD/MM/YYYY)
 %
 % Copyright: MIT
 % --------------------------------------------------
@@ -83,7 +83,14 @@ function [est, err, errSqr, normErrSqr, See] = obsFiltEst(Pm, O, Pe, srcCsd)
     end
 
     if nargin > 3 && ~isempty(srcCsd)
-        validateattributes(srcCsd, "numeric", {'2d', 'nonnegative', 'nonnan', 'finite'}, mfilename, "Source cross spectral density matrix", 3)
+        validateattributes(srcCsd, "numeric", {'2d', 'nonnan', 'finite'}, mfilename, "Source cross spectral density matrix", 3)
+
+        % Check for correct dimensions
+        if diff(size(srcCsd))
+            error("The source power spectral density matrix must be a square matrix");
+        elseif size(srcCsd, 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));
     end
-- 
GitLab