i want to plot a 2d planar array antenna using the array factor and by not using any toolbox. so far i have reffered arik d brown book on esa using matlab but im not able to get the output so far ive coded this much.

l=3e8/3.3e9;
k=2*pi/l;
theta=-80:80;
phi=-80:80;
[THETA,PHI]=meshgrid(theta,phi);
My=10;
Nz=10;
dy=l/2;
dz=l/2;
deltay=0;deltaz=0;
psiy=(k*dy*sin(THETA).*sin(PHI))+deltay;
psiz=(k*dz*sin(THETA).*cos(PHI))+deltaz;
AFy=0;
AFz=0;
for m=1:My
AFy=AFy+exp(1i*(m-1)*psiy);
end
for n=1:Nz
AFz=AFz+exp(1i*(n-1)*psiz);
end
AF= AFy.*AFz;
AFmag=abs(AF);
figure
surf(PHI,THETA,AFmag);
shading interp;
colormap('default');
xlabel('phi');
zlabel('directivity');
title('');

3 Comments

clear
clc
%Balanis Chapter 6 formulas 3rd edition
%Array factor of planar arrays
j=sqrt(-1);
M=361; %Angle resolution
k=2*pi; %wavenumber
theta=linspace(0,pi,M);
phi=linspace(-pi/2,pi/2,M);
[THETA,PHI]=meshgrid(theta,phi);
dtheta=pi/M;
dphi=pi/M;
%Planar Array variables
My=8;
Nz=8;
dy=0.5; %Interelement spacing in y
dz=0.5; %Interelement spacing in z
deltay=0; %Steering angle in phi
deltaz=0; %Steering angle in theta
%Array factor
psiy=(-k*dy*sin(THETA).*sin(PHI))+deltay;
psiz=(-k*dz*cos(THETA))+ deltaz;
AFy=0;
AFz=0;
for m=1:My
AFy= AFy+ exp(j*(m-1)*psiy);
end
for n=1:Nz
AFz=AFz+ exp(j*(n-1)*psiz);
end
AF=AFy.*AFz;
AFmag=abs(AF);
%Directivity
Utheta=AFmag.^2;
Prad=sum(sum(Utheta.*sin(THETA)*dtheta*dphi));
D=4*pi*Utheta/Prad;
dBd=20.*log10(D);
%Directivity Plot
% figure;
surf(PHI,THETA,D);
shading interp;
colormap('default');
xlabel('\phi[deg]','Fontsize',6);
set(gca,'XTick',-pi/2:pi/6:pi/2);
set(gca,'XTickLabel',{'-90','-60','-30','0','30','60','90'},'Fontsize',10,'fontweight','bold','box','on');
ylabel('\Theta[deg]','Fontsize',6);
set(gca,'YTick',0:pi/6:pi);
set(gca,'YTickLabel',{'-90','-60','-30','0','30','60','90'},'Fontsize',10,'fontweight','bold','box','on');
zlabel('Directivity',"FontSize",10)
Thanks.
why sin(THETA) is taken out in the above from psiz? Balanis book includes a sin(THETA) in psiz.
psiy=(-k*dy*sin(THETA).*sin(PHI))+deltay;
psiz=(-k*dz*cos(THETA))+ deltaz;
However, when I have sin(THETA) in the psiz , I can not get the AF in Balanis book. can you help answer this question. thanks.
Hi Shadi,
DId you find any solution? I see that yes sin(theta) should be there in the equation of psiz. Plus, it also hase cos(phi) instead of cos(theta) . But as soon as i put it i am getting an anusual directivity graph. If you could help. Thanks in advance.

Sign in to comment.

Answers (0)

Categories

Asked:

on 1 Feb 2020

Commented:

on 15 Oct 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!