from __future__ import division
from math import pi
#Given
D=90# directivity
lamda=2# wavelength
Ae=(D*(lamda**2))/(4*pi)#effective aperture
print 'The maximum effective aperture of the\n aerial is %0.2f sq m'%(Ae)
from math import pi,cos
#Given
n=10#no of aerial elements
d=0.5#distance in terms of wavelength
Beam_Width=2/(n*d)#
Beam_Width_degrees=Beam_Width*180/pi
print 'Angular beam width is %0.2f degrees\nBeamWidth is %0.2f rad'%(Beam_Width_degrees,Beam_Width)
from numpy import arange, pi
from mpmath import quad, sin
#Given
r=1#assume distance for ease of calculation
#Pav(theta)=(1000/(3*pi*r**2))*((sin(theta))**2)
theta=arange(0, pi, 0.1)
x0=0
x1=pi
Pt=(2000/(3*r**2))*quad(lambda theta: (sin(theta))**3,[x0,x1])#Total power radiated
print 'Total power radiated is %0.2f watts'%(Pt)
from math import pi,cos
#Given
dl=2# length of wire
I=6#current in the wire
f=1e6# operating freq
r=30e3#distance at which field is to be calculated
theta=90#right angles to the wire axis
lamda=300# wavelength
w=2*pi*f#angular freq
c=3e8
t=f**-1
Phi=w*(t-(r/c))#Phase shift
Erad=25.13e-5*cos(Phi)#Radiation electric field intensity
H=Erad/(120*pi)#Radiation magnetic field intensity
print 'electric field intensity is %0.2f mV/m \n magnetic field intensity is %0.2f uA/m'%(Erad*1e3,H*1e6)
from math import sqrt
#Given
#c
Rr=73# radition resistance
Vrms=10#RMS voltage of the signal
Zin_mod=sqrt((73**2)+(42**2))#absolute input impedance
Irms=Vrms/Zin_mod#RMS current
Pt=(Irms**2)*Rr# Radiated power
print 'The radiated power is %0.2f watts'%(round(100*Pt)/100)
#Given
#b
c=3e8
f=2e9#operating freq
Ae=100#aperture area
lamda=c/f# operating wavwlength
D=((4*3.141*Ae)/(lamda**2))# Directivity
print 'Ideal directive gain is %d'%(D)
#Given
#b
n=10# no of aerial elements
lambda_d=2#
BeamWidth=2*lambda_d/n# Beamwidth
print 'The angular width is %0.2f degrees'%(BeamWidth)
from math import log10
#Given
D1=1
D2=1.5*D1 # diameters of the new reflectors D1=1assumed for ease of calculation
G_dbs=10*log10((D2/D1)**2)#Gain in dBs
print 'Overall Gain is %0.2f dBs'%(round(1000*G_dbs)/1000)
#Given
#b
c=3e8
f=800e3# operating freq
dl=27#effective height
lamda=c/f
Rr=40*(3.142**2)*(dl/lamda)**2#Radiation Resistance
print 'Radiation resistance is %0.2f ohm'%(Rr)