From c50638aa28838ffa79c4e7b03fbf8f1bebd673c8 Mon Sep 17 00:00:00 2001
From: ZaellixA <axilleaz@protonmail.com>
Date: Wed, 4 Sep 2024 18:33:16 +0100
Subject: [PATCH] Fix bug in obsFilt.m to allow for negative values in the
 source strength PSD matrix so that complex numbers can be used

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

diff --git a/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFilt.m b/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFilt.m
index 0c4bb05..2431f64 100644
--- a/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFilt.m	
+++ b/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFilt.m	
@@ -3,7 +3,7 @@
 % Author: Achilles Kappis
 % e-mail: axilleaz@protonmail.com
 %
-% Date: 01/09/2024 (DD/MM/YYYY)
+% Date: 04/09/2024 (DD/MM/YYYY)
 %
 % Copyright: MIT
 % --------------------------------------------------
@@ -91,7 +91,12 @@ function [oOpt, Sme, Smm, condNum] = obsFilt(Pe, Pm, srcCsd, regFacs, snrVal)
 
     % Validate optional arguments
     if nargin > 2 && ~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");
+        end
     else
         srcCsd = eye(size(Pe, 2));
     end
-- 
GitLab