# Chapter 4 : Analysis of Linear Arrays¶

## Example 4.1,Page Number 195¶

In :
from __future__ import division
from sympy import Symbol

L = Symbol('L') #Defining L as lambda
l = 10*L
N = 20 # number of elements
d = l/N
BW1 = (2*(L/d)*1/N) #bandwidth
print "Null-to-null BW of broadside array in radians when l = 10*L,N = 20:",round(BW1,2)
l = 50*L
N = 100 # number of elements
d = l/N
BW2 = (2*(L/d)*1/N) #bandwidth
print "Null-to-null BW of broadside array in radians when l = 50*L,N = 100:",round(BW2,2)
l = 20*L
N = 50 # number of elements
d = l/N
BW3 = (2*(L/d)*1/N) #bandwidth
print "Null-to-null BW of broadside array in radians when l = 20*L,N = 50:",round(BW3,2)

Null-to-null BW of broadside array in radians when l = 10*L,N = 20: 0.2
Null-to-null BW of broadside array in radians when l = 50*L,N = 100: 0.04
Null-to-null BW of broadside array in radians when l = 20*L,N = 50: 0.1


## Example 4.2,Page Number 196¶

In :
from __future__ import division
from sympy import Symbol
from math import sqrt

L = Symbol('L') #Defining L as lambda
l = 10*L
N = 20 # number of elements
d = l/N
BW1 = 2*sqrt((2*(L/d)*1/N)) #bandwidth
print "Null-to-null BW of end-fire array in radians when l = 10*L,N = 20:",round(BW1,3)
l = 50*L
N = 100 # number of elements
d = l/N
BW2 = 2*sqrt((2*(L/d)*1/N)) #bandwidth
print "Null-to-null BW of end-fire array in radians when l = 50*L,N = 100:",round(BW2,3)
l = 20*L
N = 50 # number of elements
d = l/N
BW3 = 2*sqrt((2*(L/d)*1/N)) #bandwidth
print "Null-to-null BW of end-fire array in radians when l = 20*L,N = 50:",round(BW3,3)

Null-to-null BW of end-fire array in radians when l = 10*L,N = 20: 0.894
Null-to-null BW of end-fire array in radians when l = 50*L,N = 100: 0.4
Null-to-null BW of end-fire array in radians when l = 20*L,N = 50: 0.632


## Example 4.3,Page Number 196¶

In :
from __future__ import division
from math import sqrt

#variable declaration

f = 6       #frequency in GHz
f = 6*10**9 #frequency in Hz
c = 3*10**8 #speed of light in m/s
l = 10      # array length in meter

#calculations
lamda = c/f #wavelength in meter
# formula : BWFN  =  2*lambda/l
BWFN  =  2*(lamda/l) # band width in radians
D = 2*(l/lamda) # directivity

#result
print "Directivity:",round(D,3)

null-to-null Beamwidth of broad side array in radians: 0.01
Directivity: 400.0


## Example 4.4,Page Number 197¶

In :
from __future__ import division
from math import pi

#variable declaration
f = 10       #frequency in Ghz
f = 10*10**9 #frequency in hertz
c = 3*10**8  #speed of light in m/s
lamda = c/f  #wavelength in meter
N = 50       # number of elements

#calculations
d = 0.5*lamda # element spacing in meter
Beta = 2*(pi)/lamda # phase shift
alpha = Beta*d # progressive phase shift in radians
l = N*d # Array length in meter

#result
print "progressive phase shift in radians:",round(alpha,3)
print "Array length in meter",round(l,3)

progressive phase shift in radians: 3.142
Array length in meter 0.75


## Example 4.5,Page Number 197¶

In :
from __future__ import division
from math import pi
from sympy import Symbol

#variable declaration
N = 100 # no. of elements
Lm = Symbol('Lm') # defining Lm as lambda

#calculations
d = 0.5*Lm
l = N*d # array length
BWFN  =  114.6 /(l/Lm) # beam width in degrees
HPBW  =  BWFN/2 # half power beam width in degrees
D1 = 2*(l/Lm) # directivity of broad side array
D2 = 4*(l/Lm) # directivity of end fire array

#result
print "half power beamwidth in degrees:",round(HPBW,3)
print "null-to-null beamwidth in degrees:",round(BWFN,3)
print "directivity of broad side array:",round(D1,1)
print "directivity of end fire array:",round(D2,1)

# note : answer in the book is mis-printed,the HPBW is not 11.46 it should be 1.146 degrees.

# note: misprint in second step of part a in book correct is l = N*d = 100*0.5*lamda = 50*lamda

half power beamwidth in degrees: 1.146
null-to-null beamwidth in degrees: 2.292
directivity of broad side array: 100.0
directivity of end fire array: 200.0


## Example 4.9,Page Number 200¶

In :
from __future__ import division
import numpy  as np
from math import factorial

# formula :combination(n,r)=(factorial(n))/(factorial(r)*factorial(n-r))
print("when n=2")
n=2
a_0=factorial(1)/factorial(0)*factorial(1) #relative excitation level 1
a_1=factorial(1)/factorial(1)*factorial(0) #relative excitation level 2
print "relative excitation levels of binomial array at n=2:",np.array([a_0,a_1])
print("when n=3")
n=3
a_1=factorial(1)/factorial(1)*factorial(0) #relative excitation level 2
a_0=2*a_1 # relative excitation level 1
print "relative excitation levels of binomial array at n=3:",np.array([a_1,a_0,a_1])

when n=2
relative excitation levels of binomial array at n=2: [ 1.  1.]
when n=3
relative excitation levels of binomial array at n=3: [ 1.  2.  1.]


## Example 4.10,Page Number 200¶

In :
from __future__ import division
from math import log10,pi

#variable declaration
d = 30       #separation distance in meter
f = 10       #frequency in mega hertz
f = 10*10**6 #frequency in hertz
c = 3*10**8  #speed of light in m/s
lamda = c/f  #wavelength in meter
Gt = 1.65   #transmitting gain in dB
Gr = 1.65   #receiving gain in dB

#calculations

# basic transmission loss :
# formula : Lb = 10*log(((4*(pi)*d)**2/(lamda)**2))
Lb = 10*log10((4*(pi)*d)**2/(lamda)**2) # basic transmmision loss in dB
# actual transmission loss :
La = Lb-Gt-Gr # actual transmisson loss in dB

#result
print "basic transmmision loss in dB:",round(Lb,3)
print "actual transmisson loss in dB:",round(La,3)

basic transmmision loss in dB: 21.984
actual transmisson loss in dB: 18.684


## Example 4.11,Page Number 201¶

In :
from __future__ import division
from math import log10,pi

f = 0.3 #frequency in Ghz
f = 0.3*10**9 #frequency in hertz
c = 3*10**8 #speed of light in m/s
lamda = c/f #wavelength in meter
d1 = 1.6 # in Km
d1 = 1.6*10**3 # in meter
# formula : Lb = 20*log10((4*(pi)*d)/(lamda))
Lb1 = 20*log10(4*pi*d1/lamda) # basic transmission loss in dB
print "basic transmission loss in dB when d = 1.6Km,f = 0.3GHz:",round(Lb1,3)
d2 = 16 # in Km
d2 = 16*10**3 # in meter
# formula : Lb = 20*log10((4*(pi)*d)/(lamda))
Lb2 = 20*log10(4*pi*d2/lamda) # basic transmission loss in dB
print "basic transmission loss in dB when d = 16Km,f = 0.3GHz:",round(Lb2,3)
d3 = 160 # in Km
d3 = 160*10**3 # in meter
# formula : Lb = 20*log10((4*(pi)*d)/(lamda))
Lb3 = 20*log10(4*pi*d3/lamda) # basic transmission loss in dB
print "basic transmission loss in dB when d = 160Km,f = 0.3GHz:",round(Lb3,3)
d4 = 320 # in Km
d4 = 320*10**3 # in meter
# formula : Lb = 20*log10((4*(pi)*d)/(lamda))
Lb4 = 20*log10(4*pi*d4/lamda) # basic transmission loss in dB
print "basic transmission loss in dB when d = 320Km,f = 0.3GHz:",round(Lb4,3)
# when frequency is 3Ghz
# given :
f = 3 #frequency in Ghz
f = 3*10**9 #frequency in hertz
c = 3*10**8 #speed of light in m/s
lamda = c/f #wavelength in meter
d1 = 1.6 # in Km
d1 = 1.6*10**3 # in meter
# formula : Lb = 20*log10((4*(pi)*d)/(lamda))
Lb1 = 20*log10(4*pi*d1/lamda) # basic transmission loss in dB
print "basic transmission loss in dB when d = 1.6Km,f = 3GHz:",round(Lb1,3)
d2 = 16 # in Km
d2 = 16*10**3 # in meter
# formula : Lb = 20*log10((4*(pi)*d)/(lamda))
Lb2 = 20*log10(4*pi*d2/lamda) # basic transmission loss in dB
print "basic transmission loss in dB when d = 16Km,f = 3GHz:",round(Lb2,3)
d3 = 160 # in Km
d3 = 160*10**3 # in meter
# formula : Lb = 20*log10((4*(pi)*d)/(lamda))
Lb3 = 20*log10(4*pi*d3/lamda) # basic transmission loss in dB
print "basic transmission loss in dB when d = 160Km,f = 3GHz:",round(Lb3,3)
d4 = 320 # in Km
d4 = 320*10**3 # in meter
# formula : Lb = 20*log10((4*(pi)*d)/(lamda))
Lb4 = 20*log10(4*pi*d4/lamda) # basic transmission loss in dB
print "basic transmission loss in dB when d = 320Km,f = 3GHz:",round(Lb4,3)

basic transmission loss in dB when d = 1.6Km,f = 0.3GHz: 86.067
basic transmission loss in dB when d = 16Km,f = 0.3GHz: 106.067
basic transmission loss in dB when d = 160Km,f = 0.3GHz: 126.067
basic transmission loss in dB when d = 320Km,f = 0.3GHz: 132.087
basic transmission loss in dB when d = 1.6Km,f = 3GHz: 106.067
basic transmission loss in dB when d = 16Km,f = 3GHz: 126.067
basic transmission loss in dB when d = 160Km,f = 3GHz: 146.067
basic transmission loss in dB when d = 320Km,f = 3GHz: 152.087


## Example 4.12,Page Number 202¶

In :
from __future__ import division
from math import log10,pi

Gt=10 # transmission gain in dB
Gr=10 # receiving gain in dB
#when frequency=0.3GHz
# given :
f=0.3 #frequency in Ghz
f=0.3*10**9 #frequency in hertz
c=3*10**8 #speed of light in m/s
lamda=c/f #wavelength in meter
d1=1.6 # in Km
d1=1.6*10**3 # in meter
# formula : Lb=20*log10((4*(pi)*d)/(lamda))
Lb1=20*log10(4*pi*d1/lamda) # basic transmission loss in dB
La1=Lb1-Gt-Gr # Actual transmission loss in dB
print "Actual transmission loss in dB when d=1.6Km,f=0.3GHz:",round(La1,2)
d2=16 # in Km
d2=16*10**3 # in meter
# formula : Lb=20*log10((4*(pi)*d)/(lamda))
Lb2=20*log10(4*pi*d2/lamda) # basic transmission loss in dB
La2=Lb2-Gt-Gr # Actual transmission loss in dB
print "Actual transmission loss in dB when d=16Km,f=0.3GHz:",round(La2,2)
d3=160 # in Km
d3=160*10**3 # in meter
# formula : Lb=20*log10((4*(pi)*d)/(lamda))
Lb3=20*log10(4*pi*d3/lamda) # basic transmission loss in dB
La3=Lb3-Gt-Gr # Actual transmission loss in dB
print "Actual transmission loss in dB when d=160Km,f=0.3GHz:",round(La3,2)
d4=320 # in Km
d4=320*10**3 # in meter
# formula : Lb=20*log10((4*(pi)*d)/(lamda))
Lb4=20*log10(4*pi*d4/lamda) # basic transmission loss in dB
La4=Lb4-Gt-Gr # Actual transmission loss in dB
print "Actual transmission loss in dB when d=320Km,f=0.3GHz:",round(La4,2)
# when frequency is 3Ghz
# given :
f=3 #frequency in Ghz
f=3*10**9 #frequency in hertz
c=3*10**8 #speed of light in m/s
lamda=c/f #wavelength in meter
d1=1.6 # in Km
d1=1.6*10**3 # in meter
# formula : Lb=20*log10((4*(pi)*d)/(lamda))
Lb1=20*log10(4*pi*d1/lamda) # basic transmission loss in dB
La1=Lb1-Gt-Gr # Actual transmission loss in dB
print "Actual transmission loss in dB when d=1.6Km,f=3GHz:",round(La1,2)
d2=16 # in Km
d2=16*10**3 # in meter
# formula : Lb=20*log10((4*(pi)*d)/(lamda))
Lb2=20*log10(4*pi*d2/lamda) # basic transmission loss in dB
La2=Lb2-Gt-Gr # Actual transmission loss in dB
print "Actual transmission loss in dB when d=16Km,f=3GHz:",round(La2,2)
d3=160 # in Km
d3=160*10**3 # in meter
# formula : Lb=20*log10((4*(pi)*d)/(lamda))
Lb3=20*log10(4*pi*d3/lamda) # basic transmission loss in dB
La3=Lb3-Gt-Gr # Actual transmission loss in dB
print "Actual transmission loss in dB when d=160Km,f=3GHz:",round(La3,2)
d4=320 # in Km
d4=320*10**3 # in meter
# formula : Lb=20*log10((4*(pi)*d)/(lamda))
Lb4=20*log10(4*pi*d4/lamda) # basic transmission loss in dB
La4=Lb4-Gt-Gr # Actual transmission loss in dB
print "Actual transmission loss in dB when d=320Km,f=3GHz:",round(La4,2)

Actual transmission loss in dB when d=1.6Km,f=0.3GHz: 66.07
Actual transmission loss in dB when d=16Km,f=0.3GHz: 86.07
Actual transmission loss in dB when d=160Km,f=0.3GHz: 106.07
Actual transmission loss in dB when d=320Km,f=0.3GHz: 112.09
Actual transmission loss in dB when d=1.6Km,f=3GHz: 86.07
Actual transmission loss in dB when d=16Km,f=3GHz: 106.07
Actual transmission loss in dB when d=160Km,f=3GHz: 126.07
Actual transmission loss in dB when d=320Km,f=3GHz: 132.09


## Example 4.13,Page Number 203¶

In :
from __future__ import division
from math import pi

#variable declaration

Wt = 15 # radaited power in watt
f = 60 # in MHz
f = 60*10**6 # in Hz
d = 10 # in m
c = 3*10**8 # in m/s
lamda = c/f # in meter
Gt = 1.64 # transmitting gain in dB
Gr = 1.64 # receiving gain in dB

#calculations
Wr = (Wt*Gt*Gr*(lamda)**2/(4*(pi)*d)**2) # receiving power in watt

#result
print "receiving power in mW:",round(Wr*1000,3)

receiving power in mW: 63.87