Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Name : Mahmoud abdo hussein ali all details in the first 6 lines as comments

%========================================================================================
%===========================AUTHOR: MAHMOUD ABDO HUSSEIN ALI
%===========================DR. SUPERVISOR: ALI YOUNES
%===========================REPORT NUMBER TWO
%===========================Description : XY PLANAR ARRAY with 5*5 elements with lambda/2
%========================================================================================
%==================================DEFINE PARAMETERS=====================================
N = 5; % Number of elements in x direction
M = 5; % Number of elements in y direction
f = 300e6; % Operating frequency (300 MHz)
lambda = 1; % Wavelength
d = lambda / 2; % Spacing between elements
max_angle = 90; % Maximum angle (in degrees)
max_angle_rad = max_angle * pi / 180; % Convert maximum angle to radians

%=====================ARRAY FACTOR IN X, Y DIRECTION=====================


b = 2 * pi / lambda; % Phase constant "BETA"
alpha = -b * d * cos(max_angle_rad); % Phase term
phi = linspace(0, 2 * pi, 100); % phi range
theta = linspace(0, pi, 100); % theta range
[Phi, Theta] = meshgrid(phi, theta); % Azimuth and elevation angles
epsi_x = alpha + b * d * sin(Theta) .* cos(Phi); % Phase progression in x direction
epsi_y = alpha + b * d * sin(Theta) .* sin(Phi); % Phase progression in y direction
AF_x = sin(N * epsi_x / 2) ./ (N * sin(epsi_x / 2)); % Array factor x
AF_y = sin(M * epsi_y / 2) ./ (M * sin(epsi_y / 2)); % Array factor y
AF = AF_x .* AF_y; % Final array factor
AF = abs(AF); % Absolute value of array factor

%========Convert spherical coordinates to Cartesian coordinates============


X = AF .* sin(Theta) .* cos(Phi);
Y = AF .* sin(Theta) .* sin(Phi);
Z = AF .* cos(Theta);

%========================Plot the 3D pattern using MATLAB===============================


figure(1);
surf(X, Y, Z);
xlabel('X');
ylabel('Y');
zlabel('Z');
title('3D Pattern of Array Factor');

%============================Plot polar plots using MATLAB===============================


AF_phi_0 = squeeze(AF(:, 1, :)); % Calculate AF for phi = 0 (on the yz plane)
AF_theta_0 = squeeze(AF(1, :, :)); % Calculate AF for theta = 0 (on the xy plane)

figure(2); % Plot polar plots


subplot(2, 1, 1);
polarplot(theta, AF_phi_0);
title('E-theta pattern');

subplot(2, 1, 2);
polarplot(phi, AF_theta_0);
title('E-phi pattern');

You might also like