# Chapter 6: Antennas¶

## Example 6.1, Page 137¶

In [1]:
import math
from pylab import *
%matplotlib inline
#Variable Decalration
a=3
b=2
dB=1

#Calculation
#Initializations
tita=arange(-90,92,2)
tita[45]=1
tita1=arange(-90,92,2)
Y=linspace(0,0,91)
E=linspace(0,0,91)
gE=linspace(0,0,91)
GE=linspace(0,0,91)
X=linspace(0,0,91)
E1=linspace(0,0,91)
gH=linspace(0,0,91)
GH=linspace(0,0,91)
for i in range(0,size(Y)-1):
Y[i]=math.pi*b*math.sin(tita[i]*3.142/180)
X[i]=math.pi*a*math.sin(tita[i]*3.142/180)
E[i]=(math.sin(Y[i]))/Y[i]
E1[i]=math.cos(tita1[i]*3.142/180)*(math.sin(X[i]))/X[i]
gE[i]=(E[i])**2   #Raiation pattern in E-Plane
gH[i]=E1[i]**2    #Raiation pattern in H-Plane
GE[i]=10*math.log10(gE[i])  #Raiation pattern in E-Plane(dB)
GH[i]=10*math.log10(gH[i])  #Raiation pattern in H-Plane(dB)

#Results

figure(0)
ylim([-30,0])
xlim([-90,90])
xlabel('tita degrees')
ylabel('GE(tita)')
figure(1)
ylim([-30,0])
xlim([-90,90])
xlabel('tita degrees')
ylabel('GH(tita)')
show()


## Example 6.2, Page 159¶

In [1]:
import math
from pylab import *
%matplotlib inline
#Varable Declaration

N=5   #Number of elements of dipole
s=0.25 #Space between dipole elements(wavelengths)
phi0=0#Angle between array factor and array(degrees)

#Calculation

phi=arange(-180,182,2)
Si=linspace(0,0,181)
for k in range(0,180):
Si[k]=alpha+2*3.142*s*math.cos(phi[k]*3.142/180)
AFR=linspace(0,0,181)
AFI=linspace(0,0,181)
for i in range(0,180):
for j in range(0,N-1):
AFR[i]=AFR[i]+math.cos(j*Si[i])  #Real part of Array factor
AFI[i]=AFI[i]+math.sin(j*Si[i])#Imaginary part of Array factor

teta=linspace(-3.142,3.142,181)
AF=linspace(0,0,181)
for k in range(0,180):
AF[k]=AF[k]+(AFR[k]**2+AFI[k]**2)**0.5

#Result

polar(teta,AF)
title('Polar plot of Array Factor')
show()


## Example 6.3, Page 160¶

In [2]:
import math
from pylab import *
%matplotlib inline
#Varable Declaration

N=5   #Number of elements of dipole
s=0.25 #Space between dipole elements(wavelengths)
phi0=90*math.pi/180 #Angle between array factor and array(radians)

#Calculation

phi=arange(-180,185,5)
Si=linspace(0,0,73)
for k in range(0,73):
Si[k]=alpha+2*math.pi*s*math.cos(phi[k]*math.pi/180)

AFR=linspace(0,0,73)
AFI=linspace(0,0,73)

for i in range(0,73):
for j in range(0,N):
AFR[i]=AFR[i]+math.cos(j*Si[i])  #Real part of Array factor
AFI[i]=AFI[i]+math.sin(j*Si[i])#Imaginary part of Array factor

teta=phi*math.pi/180
AF=linspace(0,0,73)
for k in range(0,73):
AF[k]=AF[k]+(AFR[k]**2+AFI[k]**2)**0.5

#Result

polar(teta,AF)
title('Polar plot of Array Factor')
show()