from math import acos, pi, cos, sqrt, degrees
#given data :
from sympy import symbols
lamda, Ep = symbols('lamda Ep')
d = 3.0/2*lamda
beta = 2*pi/lamda
delta = 0 # for broad side array
theta = pi/2 # for maxima
si = 3*pi/2*cos(theta)
E0 = Ep/sqrt(2) # at half power beam width
#Ep = 2*E0*cos(si/2)
#it leads to cos(3*pi/2*cos(theta))=1/sqrt(2)
theta=acos(acos(1/sqrt(2))/(3*pi/2)) # radian
theta = degrees(theta) # degree
HPBW=2*(90-theta) #in degree
print "(i) HPBW = %0.f degree " %HPBW
# 2nd part is wrong. Some mistake in question as cos(theta) = 13/12 which >1 not possible
from math import log10
from sympy import symbols
lamda = symbols('lamda')
#given data :
n=10 #no. of elements
d=lamda/4 #separation in meter
D=2*n/(lamda/d)
Ddb=10*log10(D) #in db
print "For broad side array D = %0.2f db " %Ddb
D=4*n/(lamda/d)
Ddb=10*log10(D) #in db
print "For end fire array D = %0.2f db " %Ddb
from math import sqrt, pi
#given data :
from sympy import symbols, N
lamda = symbols('lamda')
delta=-90 #in degree
#Formula : HPBW=57.3/(sqrt(L/(2*lambda))) in Degree
n=20 #no. of point sources
d=lamda/4 #in meter
L=(n-1)*d
HPBW=57.3/(sqrt(L/lamda/2)) # in Degree
print "HPBW = %0.2f Degree " %HPBW
D=4*L/lamda #Directivity
print "Directivity = %0.2f " %D
Ae = D*lamda**2/4/pi
print "Effective aperture : Ae =",N(Ae,3)
Omega=4*pi/D #in steradian
print "Beam Solid Angle : Omega =",round(Omega,2),"Steradian"
#Note : Answer in the book is not accurate.
from math import degrees
#given data :
n=8 #no. of half wave dipoles
lamda=100 #in cm
lamda=lamda*10**-2 #in m
d=50 #in cm
d=d*10**-2 #in m
I=0.5 #in A
Rr=73 #in Ohm
Pr=n*I**2*Rr #in Watts
print "Pr = %0.2f Watts " %Pr
BWFN=2*lamda/(n*d) #in radian
HPBW=BWFN/2 #in radian
print "HPBW = %0.2f degree" % degrees(HPBW)
from math import log10
from sympy import symbols, N
lamda = symbols('lamda')
#given data :
n=10 #no. of elements
d=lamda/4 #separation in meter
Do=1.789*4*n*d/lamda
Dodb=10*log10(Do) #in db
print "Do = %0.2f db" %(Dodb)
from math import sin, pi
#given data :
n=8 #no. of elements
BWFN=45 #in degree
theta=45 #in degree
f=40 #in MHz
f=f*10**6 #in Hz
#Formula : theta=2*asin(2*pi/(n*dr))
dr=(2*pi/n)/sin((theta/2)*(pi/180)) #
c=3*10**8 #speed of light in m/s
lamda=c/f #in m
d=dr*lamda/(2*pi) #in m
print "Distance = %0.2f m " %d
#given data :
n=10 #no. of elements
from sympy import symbols, N
lamda = symbols('lamda')
#given :
d=lamda/4 #in m
Llambda=n*d/lamda
D=2*Llambda #in unitless
print "Directivity of broadside uniform array = %0.2f " %D
from math import pi
n=4
from sympy import symbols, N, cos, solve
lamda, theta = symbols('lamda theta')
d=lamda/2
delta = pi/3
dr = 2*pi*d/lamda
# Peaks
si = pi*cos(theta)+pi/3
theta = solve(si, theta) # radian
theta = degrees(theta[0]) # degree
print "Peaks : theta =",round(theta,2),"degree"
# Nulls
print "Nulls : "
for k in range(0,3):
theta = degrees(acos(-1.0/3+k/2.0))
print "k =",k,", theta =",round(theta,2),"degree"
print "Side lobes :"
for k in range(0,3):
theta = degrees(acos(-1.0/3+(2*k+1)/4.0))
print "k =",k,", theta =",round(theta,2),"degree"
# Ans in the textbook is not accurate.
from math import cos, sin, pi
#given data :
MainBeamwidth=45 #in degree
thetaN=MainBeamwidth/2 #in degree
thetaN=thetaN*pi/180 #in radian
m=5 #no. of elements
#given : d=lambda/2 in meter
x=cos(pi/(2*(m-1)))
xo=x/cos((pi/2)*sin(thetaN)) #unitless
print "E5=ao*z+a1*(2*z**2-1)+a2*(8*z**4-8*z**2+1)"
print "We Know that : z=x/xo, E5=T4*xo"
print "ao=a1*(2*(x/xo)**2-1)+a2*[8*(x/xo)**4-8*(x/xo)**2+1]=8*x**4-8*x**2+1"
print "By comparing the term we have : "
print "a2=xo**4 a1=4*a2-4*xo**2 ao=1+a1-a2 "
a2=xo**4
a1=4*a2-4*xo**2
ao=1+a1-a2
print "And therefore the 5 elements array is given by : "
print (a2)," ",(a1)," ",(2*ao)," ",(a1)," ",a2
from __future__ import division
#given data :
#Side lobe level below main lobe
print "Side lobe level below main lobe : "
SideLobe=20 #in dB
r=10**(SideLobe/20) #
print "r=",r
#No. of elements are 5, n=5
print "No. of elements are 5, n=5 :"
print "Tchebyscheff polynomials of degree (n-1) is"
print "5-1=4"
print "T4(xo)=r"
print "8*xo**4-8*xo**2+1=10"
print "By using alternate formula, we get"
m=4
r=10
xo=(1/2)*((r+sqrt(r**2-1))**(1/m)+(r-sqrt(r**2-1))**(1/m))
print "xo=" ,xo
print "E5=T4(xo)"
print "E5=ao*z+a1*(2*z**2-1)+a2*(8*z**4-8*z**2+1)"
print "We Know that : z=x/xo, E5=T4*xo"
print "ao=a1*(2*(x/xo)**2-1)+a2*[8*(x/xo)**4-8*(x/xo)**2+1]=8*x**4-8*x**2+1"
print "By comparing the term we have : "
print "a2=xo**4 a1=4*a2-4*xo**2 ao=1+a1-a2 "
a2=xo**4
a1=4*a2-4*xo**2
ao=1+a1-a2
print "And therefore the 5 elements array is given by : "
print round(a2,3)," ",round(a1,3)," ",round(2*ao,3)," ",round(a1,3)," ",round(a2,3)
# Ans in the textbook are not accurate.