from math import sqrt, acos, degrees
E_theta=1/sqrt(2) #Electric Field at half power
#theta=thetaHP/2 #E(thetaHP/2)=cosd(thetaHP/2)
thetaHP=2*degrees(acos(E_theta)) #degree(Half power beam width)
print "Half power beam width = %0.2f degree "%thetaHP
from math import asin, degrees
E_theta=1/sqrt(2) #Electric field at theta=90-thetaHP/2
#E(90-thetaHP/2)=sind(90-thetaHP/2)
thetaHP=2*(90-degrees(asin(E_theta)) )#degree(HPBW)
print "HPBW = %0.2f degree "%(thetaHP)
theta1=0 ;theta2=180 #degree(Pattern angles)
FNBW=theta2-theta1 #degree(FNBW)#as E is zero at these points
print "FNBW = %0.2f degree "%FNBW
from math import acos, degrees
E_theta=1/sqrt(2) #Elecric field at half power point
#E(thetaHP/2)=(cosd(thetaHP/2))**2
thetaHP=2*degrees(acos(sqrt(E_theta))) #degree(HPBW)
print "Half Power Beam Width = %0.2f degree "%thetaHP
from __future__ import division
from math import pi, cos, acos
theta1=0 ;theta2=pi/2 #radian(Angles)
fi1=0 ;fi2=2*pi #radian(Angles)
#Prad=integrate('integrate('U','thheta',theta1,theta2)','fi',fi1,fi2)
Prad_BY_Um=pi*(1/2)*(cos(2*theta1)-cos(2*theta2)) #(Power radiated/Max intensity)
Do=4*pi/Prad_BY_Um #Exact Directivity
print "Exact Directivity : ",Do
#Um*Cosd(thetaHP/2)=0.5*Um
thetaHP=2*(degrees(acos(0.5))) #degree(HPBW)
fiHP=thetaHP #degree(HPBW)
Do=41253/(thetaHP*fiHP) #Approximate Directivity
print "Approximate Directivity : ",round(Do,3)
K=90 #%#radiation efficiency
Pin=10 #W
Prad=(K/100)*Pin #W
print "Radiated power = %0.f Watts " %Prad
from math import log10
D=20 #Directivity
K=90 #%#radiation efficiency
G=(K/100)*D #Gain
GdB=10*log10(G) #dB
print "Gain = %0.2f dB "%(GdB)
#Answer is not calculated in the book.
from math import log10
Rr=72 #Ω
RL=8 #Ω
G=16 #Gain
K=Rr/(Rr+RL)*100 #%#radiation efficiency
D=G/(K/100) #Directivity
DdB=10*log10(D) #dB
print "Directivity = %0.3f dB" %DdB
Irms=15 #A(Current Drawn)
Prad=5 #kW(Radiated Power)
Rr=Prad*10**3/Irms**2 #Ω(Radiation Resistance)
print "Radiation resistance = %0.2f Ω "%Rr
from math import sqrt
Prad=1000 #W(Radiated Power)
Rr=300 #Ω(Radiation Resistance)
Irms=sqrt(Prad/Rr) #A(Current Drawn)
print "Current drawn = %0.1f A "%Irms
Rr=73 #Ω(Radiation Resistance)
Z=120*pi #Ω(For free space)
#le=lambda/pi
AemBYlambda_sqr=(1/pi)**2*Z/(4*Rr)
print "Maximum effective aperture is ",round(AemBYlambda_sqr,2),"*lambda² m²"
Rr=73 #Ω
Z=120*pi #Ω(For free space)
#Aem=0.13*lambda²
AemBylambda_sqr=0.13
leBYlambda=2*sqrt(AemBylambda_sqr*Rr)/sqrt(Z)
print "Effective length is ",round(leBYlambda,4),"*lambda meter"
from math import sqrt, log10
cos_si_p=1/sqrt(2)
PLF=cos_si_p**2 #Polarization Loss factor
PLFdB=10*log10(PLF) #dB
print "Power loss factor = %0.f dB "%PLFdB
Do_dB=20 #dB
f=10 #GHz
Wi=2*10**-3 #W/m²
c=3*10**8 #m/s
lamda=c/(f*10**9) #m
Do=10**(Do_dB/10) #unitless
Aem=lamda**2/(4*pi)*Do #m²
print "Maximum effective aperture = %0.3e m²" %Aem
Pr=Aem*Wi #W
print "Maximum received power = %0.3f µW "%(Pr*10**6)
ecd=1.0 #for lossless antenna
Aem=2.147 #m²(Maximum Effective aperture)
Zin=75.0 #Ω(Input impedence)
Zo=50.0 #Ω(Output impedence)
f=100.0 #MHz(Operating frequency)
c=3*10**8 #m/s(speed f light)
aw_aa=1.0 #For no polarization loss
lamda=c/(f*10**6) #m(Wavelength)
Tau=(Zin-Zo)/(Zin+Zo) #(Reflection Coefficient)
Do=Aem/(ecd*(1.0-Tau**2)*lamda**2.0/(4*pi)/aw_aa**2) #unitless(Directivity)
print "Directivity of antenna",round(Do,3)
from __future__ import division
PT=15 #W(Transmitted Power)
AeT=0.2 #m²(Effective aperture)
AeR=0.5 #m²(Effective aperture)
f=5 #GHz(frequency)
r=15 #km(line of sight distance)
c=3*10**8 #m/s(Speed of light)
lamda=c/(f*10**9) #m(Wavelength)
PR=PT*AeT*AeR/((r*1000)**2*lamda**2) #Watts(Power delivered to reciever)
print "Power delivered to receiver = %0.2e Watts "%(PR)
#Answer is wrong in the book. lambda is 0.6 instead of 0.06 and lambda**2 is 0.06 instead of 0.0036
DT=20 #dB(Transmitter Directivity)
DR=20 #dB(Reciever Directivity)
PT=10 #W(Transmitted Power)
ecdT=1; ecdR=1 #(For lossless antenna)
aT_aR=1 #(For polarization match)
DT=10**(DT/10) #unitless(Transmitter Directivity)
DR=10**(DR/10) #unitless(Reciever Directivity)
Tau_T=0; Tau_R=0 #(Reflection coefficient)
rBYlambda=50 #m
PR=PT*ecdT*ecdR*(1-Tau_T**2)*(1-Tau_R**2)/(4*pi*rBYlambda)**2*DT*DR*aT_aR**2 #Watts(Power delivered to reciever)
print "Power at receiving antenna = %0.3f Watts "%PR
f=3 #GHz
c=3*10**8 #m/s(Speed of light)
lamda=c/(f*10**9) #m(wavelength)
r=500 #m(distance)
PT=100 #W(Transmitted Power)
GT=25 #dB(Transmitter Gain)
GR=20 #dB(Reciever Gain)
GT=10**(GT/10) #unitless(Transmitter Gain)
GR=10**(GR/10) #unitless(Reciever Gain)
PLF=1; aT_aR=1 #(For polarization match)
PR=PT*(lamda/4/pi/r)**2*GT*GR*aT_aR**2 #Watts(Power delivered to reciever)
print "Power delivered to load = %0.2e Watts "%PR