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

Add an additional parameter to mulCoh.m to also get the multiple coherence

parent b2c729a1
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
% Author: Achilles Kappis % Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com % e-mail: axilleaz@protonmail.com
% %
% Date: 12/07/2024 (DD/MM/YYYY) % Date: 16/07/2024 (DD/MM/YYYY)
% %
% Copyright: MIT % Copyright: MIT
% -------------------------------------------------- % --------------------------------------------------
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
% -------------------------------------------------- % --------------------------------------------------
% Output % Output
% %
% cohSq [numeric]: The multiple coherence squared.
%
% coh [numeric]: The multiple coherence. % coh [numeric]: The multiple coherence.
% %
% -------------------------------------------------- % --------------------------------------------------
...@@ -36,12 +38,12 @@ ...@@ -36,12 +38,12 @@
% virtual signal and physical signals in remote acoustic sensing" by % virtual signal and physical signals in remote acoustic sensing" by
% P. Zhang, S. Wang, H. Duan, J. Tao, H. Zou and X. Qiu. % P. Zhang, S. Wang, H. Duan, J. Tao, H. Zou and X. Qiu.
% -------------------------------------------------- % --------------------------------------------------
function coh = mulCoh(Px, Py, Sqq, xRegFac) function [cohSq, coh] = mulCoh(Px, Py, Sqq, xRegFac)
% ==================================================== % ====================================================
% Check for number of arguments % Check for number of arguments
% ==================================================== % ====================================================
narginchk(2, 4); narginchk(2, 4);
nargoutchk(0, 1); nargoutchk(0, 2);
% ==================================================== % ====================================================
% Validate input arguments % Validate input arguments
...@@ -78,7 +80,11 @@ function coh = mulCoh(Px, Py, Sqq, xRegFac) ...@@ -78,7 +80,11 @@ function coh = mulCoh(Px, Py, Sqq, xRegFac)
Syy = Py * Sqq * Py'; Syy = Py * Sqq * Py';
Sxy = Px * Sqq * Py'; Sxy = Px * Sqq * Py';
% Calculate multiple coherence % Calculate multiple coherence squared
coh = diag((Sxy'/(Sxx + xRegFac * eye(size(Sxx, 1))) * Sxy)./Syy); cohSq = diag((Sxy'/(Sxx + xRegFac * eye(size(Sxx, 1))) * Sxy)./Syy);
coh = real(coh); % Make sure to get rid of residual imaginary parts cohSq = real(cohSq); % Make sure to get rid of residual imaginary parts
if nargout > 1
coh = sqrt(cohSq);
end
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment