-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathViewArrayPattern.m
125 lines (119 loc) · 4.57 KB
/
ViewArrayPattern.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
function [ PATAZ, PATEL ] = ViewArrayPattern( hArray, FreqCenter , ELofAZCut, AZofELCut, weight, figureStartNum )
% view Array Pattern
% input: hArray, handle of Antenna Array
% FreqCenter: 1x1 doulbe, center frequency
% ELofAZCut: 1x1 double, elevation angle of the azimuth cut view
% AZofELCut: 1x1 double, azimuth angle of the elevation cut view
% weight: Nx1 colum vector, complex, weight of the array, N should be equal
% to the number of antenna elements in the array
% output: PATAZ, 1x1 struct of AZ pattern, which includes the following fields:
% PAT, the array pattern in PAT.
% AZ_ANG, contains the coordinate values corresponding to the rows of PAT.
% EL_ANG, contains the coordinate values corresponding to the columns of PAT.
% PATEL, 1x1 struct of EL pattern, which includes the following fields:
% PAT, the array pattern in PAT.
% AZ_ANG, contains the coordinate values corresponding to the rows of PAT.
% EL_ANG, contains the coordinate values corresponding to the columns of PAT.
% 2016-04-16 V0.1 Collus Wang
% 2017-07-05 V1.0 Collus Wang, add pattern normalize = false.
% 2017-07-08 V1.1 Collus Wang, add pattern type switch.
% 2017-10-14 V1.2 Collus Wang, export pattern.
% 2017-11-03 V1.3 Collus Wang, add FlagMax0dB so as to normalize the max AZ and EL cut to 0dB.
% Flags and Switches
SwitchPattern = 'powerdb'; % control the AZ and EL cut pattern type {'directivity' | 'powerdb'}
FlagMax0dB = true; % true = normalize the max AZ and EL cut to 0dB.
% view array geometry
figure(figureStartNum)
viewArray(hArray, 'ShowNormals', true, 'ShowIndex', 'All' );
% 3D plot of array pattern
figure(figureStartNum+10)
pattern(hArray, FreqCenter,...
'CoordinateSystem','polar',...
'Type', 'directivity', ...
'Weight', weight);
colormap('jet')
% Array AZ cut
AZ = -180:0.1:180;
figure(figureStartNum+20)
switch SwitchPattern
case 'powerdb'
pattern(hArray, FreqCenter, AZ, ELofAZCut,...
'CoordinateSystem', 'Polar',...
'Type', 'powerdb',...
'Weight', weight);
[PAT,AZ_ANG,EL_ANG] = pattern(hArray, FreqCenter, AZ, ELofAZCut,...
'CoordinateSystem', 'polar',...
'Type', 'powerdb', ...
'Plotstyle', 'overlay', ...
'Normalize', false, ...
'Weight', weight);
case 'directivity'
pattern(hArray, FreqCenter, AZ, ELofAZCut,...
'CoordinateSystem', 'Polar',...
'Type', 'directivity',...
'Weight', weight);
[PAT,AZ_ANG,EL_ANG] = pattern(hArray, FreqCenter, AZ, ELofAZCut,...
'CoordinateSystem', 'polar',...
'Type', 'directivity', ...
'Plotstyle', 'overlay', ...
'Weight', weight);
end
figure(figureStartNum+21)
if FlagMax0dB, plot(AZ_ANG,PAT.'-max(PAT.'), 'LineWidth', 1.5); end
hold on
plot(AZ_ANG,-3*ones(size(AZ_ANG)), 'r--', 'LineWidth', 1.5);
xlim([min(AZ_ANG), max(AZ_ANG)])
ylim([-30, 5])
title('Array Azimuth Cut')
xlabel('Azimuth (degree)')
ylabel('Normalized Power (dB)')
legend('Norm. Power', '-3dB', 'Location', 'Best')
grid on
PATAZ.PAT = PAT;
PATAZ.AZ_ANG = AZ_ANG;
PATAZ.EL_ANG = EL_ANG;
% Array EL cut
figure(figureStartNum+30)
clf
EL = -90:0.1:90;
switch SwitchPattern
case 'powerdb'
pattern(hArray, FreqCenter, AZofELCut, EL,...
'CoordinateSystem', 'polar',...
'Type', 'powerdb', ...
'Plotstyle', 'overlay', ...
'Weight', weight);
[PAT,AZ_ANG,EL_ANG] = pattern(hArray, FreqCenter, AZofELCut, EL,...
'CoordinateSystem', 'polar',...
'Type', 'powerdb', ...
'Plotstyle', 'overlay', ...
'Normalize', false, ...
'Weight', weight);
case 'directivity'
pattern(hArray, FreqCenter, AZofELCut, EL,...
'CoordinateSystem', 'polar',...
'Type', 'directivity', ...
'Plotstyle', 'overlay', ...
'Weight', weight);
[PAT,AZ_ANG,EL_ANG] = pattern(hArray, FreqCenter, AZofELCut, EL,...
'CoordinateSystem', 'polar',...
'Type', 'directivity', ...
'Plotstyle', 'overlay', ...
'Weight', weight);
end
figure(figureStartNum+31)
if FlagMax0dB, plot(EL_ANG,PAT.'-max(PAT.'), 'LineWidth', 1.5); end
hold on
plot(EL_ANG,-3*ones(size(EL_ANG)), 'r--', 'LineWidth', 1.5);
xlim([min(EL_ANG), max(EL_ANG)])
ylim([-30, 5])
title('Array Elevation Cut')
xlabel('Elevation (degree)')
ylabel('Normalized Power (dB)')
legend('Norm. Power', '-3dB', 'Location', 'Best')
grid on
PATEL.PAT = PAT;
PATEL.AZ_ANG = AZ_ANG;
PATEL.EL_ANG = EL_ANG;
figure(figureStartNum+21) % display AZ cut
end