-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBinomial_array_3D.m
84 lines (51 loc) · 1.6 KB
/
Binomial_array_3D.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
%% MATLAB code for Binomial Array in 3D
% Version 1.0
%% Pre-initialisation
clear;
clc;
close all;
%% Accepting inputs
N = input('\nEnter the number of Elements::(eg., 5,6,7,etc)->');
d = input('\nEnter the distance between the elements::(eg.,0.4,0.5,etc)->');
tic;
k = 2*pi;
beta = 0;
[theta phi]=meshgrid(linspace(0,2*pi,180));
%% Calculating Array element(AE) and Array Factor(AF)
psi = (k.*d.*cos(theta)) + beta;
AF = (1+exp(1j.*(psi))).^(N-1);
AF = AF - min(min(AF));
AE = sqrt(1- ((sin(theta).^2).*(cos(phi).^2)));
%% Calculating Array Pattern(AP)
% Array Pattern is calculated as follows,
%
% Array Pattern = ArrayFactor * ArrayElement
AP = AF .* AE;
toc;
%% Plotting results
[x1,y1,z1] = sph2cart(phi,theta,abs(AE));
surf(x1,y1,z1,'FaceLighting','phong',...
'LineStyle','none',...
'FaceColor',[1 0 0]);
legend('Array Element','Location','SouthEastOutside')
light('Style','local',...
'Position',[-10.162701816704 -0.924193626363743 14.9951905283833]);
axis image
figure
[x2,y2,z2] = sph2cart(phi,theta,abs(AF));
surf(x2,y2,z2,'FaceLighting','phong',...
'LineStyle','none',...
'FaceColor',[1 0 0]);
light('Style','local',...
'Position',[-10.162701816704 -0.924193626363743 14.9951905283833]);
legend('Array Factor','Location','SouthEastOutside')
axis image
figure
[x3,y3,z3] = sph2cart(phi,theta,abs(AP));
surf(x3,y3,z3,'FaceLighting','phong',...
'LineStyle','none',...
'FaceColor',[1 0 0]);
light('Style','local',...
'Position',[-10.162701816704 -0.924193626363743 14.9951905283833]);
legend('Array Pattern','Location','SouthEastOutside')
axis image