-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoh4Para.m
38 lines (31 loc) · 1.12 KB
/
coh4Para.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function [coh] = coh4Para(Cy,Cz,dy,dz,U,f)
% check vertical coeff
if numel(Cy)>4; error('C must be a vector with max 4 columns or rows');end
if numel(Cy)==1,
Cy = [Cy(:)',0,1,0];
elseif numel(Cy)==2,
Cy = [Cy(:)',1,0];
elseif numel(Cy)==3,
Cy = [Cy(:)',0];
end
% check vertical coeff
if numel(Cz)>4; error('C must be a vector with max 4 columns or rows');end
if numel(Cz)==1,
Cz = [Cz(:)',0,1,0];
elseif numel(Cz)==2,
Cz = [Cz(:)',1,0];
elseif numel(Cz)==3,
Cz = [Cz(:)',0];
end
% lateral separation
a1 = (Cy(1).*f).^2;
a2 = Cy(2).^2;
AA = (sqrt(a1+a2).*dy./U).^(Cy(3));
% vertical separation
b1 = (Cz(1).*f).^2;
b2 = Cz(2).^2;
BB = (sqrt(b1+b2).*dz./U).^(Cz(3));
% combination
coh = exp(-sqrt(AA.^2+BB.^2));
coh = coh.*cos(Cy(4).*dy.*f./U).*cos(Cz(4).*dz.*f./U);
end