-
Notifications
You must be signed in to change notification settings - Fork 0
/
FR.m
109 lines (93 loc) · 3.3 KB
/
FR.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
%FR.m Computes the channel impulse response at the rectangular coordinates X_1,Y_1,Z_1 for a given sources matrix POS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% FREQUENCY RESPONSE FUNCTION V 2.0 %
% %
% by E. Amador (emmanuel.amador@insa-rennes.fr) %
% IETR/DGA %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Ex,Ey,Ez]=FR(X_1,Y_1,Z_1)
global f c Rf POS va
%Channel Frequency Response computation, we compute 8 FR corresponding to
%each eighth of the system
Ex = zeros(1,length(f));
Ey = zeros(1,length(f));
Ez = zeros(1,length(f));
Ex1 = zeros(1,length(f));
Ey1 = zeros(1,length(f));
Ez1 = zeros(1,length(f));
Ex2 = zeros(1,length(f));
Ey2 = zeros(1,length(f));
Ez2 = zeros(1,length(f));
Ex3 = zeros(1,length(f));
Ey3 = zeros(1,length(f));
Ez3 = zeros(1,length(f));
Ex4 = zeros(1,length(f));
Ey4 = zeros(1,length(f));
Ez4 = zeros(1,length(f));
Ex5 = zeros(1,length(f));
Ey5 = zeros(1,length(f));
Ez5 = zeros(1,length(f));
Ex6 = zeros(1,length(f));
Ey6 = zeros(1,length(f));
Ez6 = zeros(1,length(f));
Ex7 = zeros(1,length(f));
Ey7 = zeros(1,length(f));
Ez7 = zeros(1,length(f));
Ex8 = zeros(1,length(f));
Ey8 = zeros(1,length(f));
Ez8 = zeros(1,length(f));
%1/4
%FR 1/8, images in the space defined by x>=0, y>=0, z>=0
[Ex1,Ey1,Ez1] = FR8th(X_1,Y_1,Z_1);
%FR 2/8, images in the space defined by x>=0, y>=0, z<=0, we need to add
%one order to the images previously used, use negative values for their z
%coordinates and add pi to their azimut angle
POS(:,4) = POS(:,4)+1; %order+1
POS(:,3) = -POS(:,3);
POS(:,6) = POS(:,6)+pi;
[Ex2,Ey2,Ez2] = FR8th(X_1,Y_1,Z_1);
POS(:,3) = -POS(:,3); %change again the signs of the z coordinates because the next eighth is in the half-space z>0
%2/4
%FR 3/8, images in the space defined by x>=0, y<=0, z>=0
POS(:,2) = -POS(:,2); %change the signs of the y coordinates
POS(:,5) = pi-POS(:,5); %change the tilt angle
[Ex3,Ey3,Ez3] = FR8th(X_1,Y_1,Z_1);
%FR 4/8, images in the space defined by x>=0, y<=0, z<=0
POS(:,4) = POS(:,4)+1; %order+1
POS(:,3) = -POS(:,3);
POS(:,6) = POS(:,6)+pi;
[Ex4,Ey4,Ez4] = FR8th(X_1,Y_1,Z_1);
POS(:,2) = -POS(:,2);
POS(:,3) = -POS(:,3);
%3/4
%FR 5/8, images in the space defined by x<=0, y>=0, z>=0
POS(:,4) = POS(:,4)-1; %order-1
POS(:,1) = -POS(:,1);
[Ex5,Ey5,Ez5] = FR8th(X_1,Y_1,Z_1);
%FR 6/8, images in the space defined by x<=0, y>=0, z<=0
POS(:,4) = POS(:,4)+1; %order+1
POS(:,3) = -POS(:,3);
POS(:,6) = POS(:,6)+pi;
[Ex6,Ey6,Ez6] = FR8th(X_1,Y_1,Z_1);
POS(:,3) = -POS(:,3);
POS(:,5) = pi-POS(:,5);
%4/4
%FR 7/8, images in the space defined by x<=0, y<=0, z>=0
POS(:,2) = -POS(:,2);
POS(:,6) = -POS(:,6);
[Ex7,Ey7,Ez7] = FR8th(X_1,Y_1,Z_1);
%FR 8/8, images in the space defined by x<=0, y<=0, z<=0
POS(:,4) = POS(:,4)+1; %order+1
POS(:,3) = -POS(:,3);
POS(:,6) = POS(:,6)+pi;
[Ex8,Ey8,Ez8] = FR8th(X_1,Y_1,Z_1);
POS(:,1) = -POS(:,1);
POS(:,2) = -POS(:,2);
POS(:,3) = -POS(:,3);
POS(:,4) = POS(:,4)-3;
POS(:,6) = mod(POS(:,6),2*pi);
Ex = Ex1+Ex2+Ex3+Ex4+Ex5+Ex6+Ex7+Ex8;
Ey = Ey1+Ey2+Ey3+Ey4+Ey5+Ey6+Ey7+Ey8;
Ez = Ez1+Ez2+Ez3+Ez4+Ez5+Ez6+Ez7+Ez8;