import math
#Variable declaration
e_half_power = 1/math.sqrt(2) #E(theta) at half power (relative quantity)
#Calculation
theta = math.acos(math.sqrt(e_half_power)) # theta (radians)
hpbw = 2*theta*180/math.pi # Half power beamwidth (degrees)
#Result
print "The half power beamwidth is ", round(hpbw), "degrees"
import math
#Variable declaration
e_half_power = 1/math.sqrt(2) #E(theta) at half power(unitless)
e_null = 0 #E(theta) = 0 at null points (unitless)
theta_1 = 0 #theta' (degrees)
theta = 1 #theta (degrees)
#Calculation
for x in range(3): #Iterate till theta = i
theta = 0.5*math.acos(e_half_power/math.cos(theta_1*math.pi/180))
#theta(radian)
theta_1 = theta*180/math.pi #set i = theta for next iteration (degrees)
hpbw = 2*(theta*180/math.pi) #Half-power beamwidth (Degrees)
theta = 0.5*math.acos(e_null) #theta (radians)
fnbw = 2*(theta*180/math.pi) #Beamwidth between first null (degrees)
#Result
print "The half power beamwidth is", round(hpbw), "degrees"
print "The beamwidth between first nulls is ", round(fnbw), "degrees"
import scipy.integrate
import math
#Variable declaration
def integrand(x):
return math.sin(x) #Function sin(theta)
def integrand2(x):
return 1 #Contant function
#Calculation
omega = scipy.integrate.quad(integrand, 20*math.pi/180, 40*math.pi/180)
omega = omega[0]*(180/math.pi) * scipy.integrate.quad(integrand2 ,30 ,70)[0]
#Integration between the ranges gives solid angle, omega (square degrees)
#Result
print "The solid angle, omega is", round(omega), "square degrees"
import math
import scipy.integrate
#Variable declaration
def func1(x,y):
return (math.cos(x)**4)*math.sin(x)*1 #Function for integration
#Calculation
beam_area = scipy.integrate.dblquad(func1, 0, 2*math.pi,
lambda x: 0, lambda x: math.pi/2)
#Beam area (steradians)
#Result
print "The beam area of the given pattern is", round(beam_area[0], 2), "sr"
import scipy.integrate
from math import pi,sin,cos,log10
#Variable declaration
n = 10 #Number of isotropic point sources
dr = pi/2 #Distance(radians)
hpbw = 40 #Half power beamwidth (degrees)
def integrand(x,phi):
E_norm = (sin(pi/20))*(sin((pi/2)*(5*cos(phi)-6))/sin((pi/20)*(5*cos(phi)-6)))
return (E_norm**2)
#Calculation
gain = scipy.integrate.dblquad(integrand, 0, 2*pi,
lambda x: 0, lambda x: pi/2)[0]
gain = (4*pi)/gain #Gain (unitless)
gain_db = 10*log10(gain)#Gain (dB)
gain_hpbw = 40000/(hpbw**2) #Gain from approx. equation (unitless)
gain_hpbw_db = 10*log10(gain_hpbw) #Gain from approx. equation (dB)
gain_diff = gain_hpbw_db - gain_db #Difference in gain (dB)
#Result
print "The gain G is", round(gain_db,2),"dB"
print "The gain from approx. equation is", round(gain_hpbw_db),"dB"
print "The difference is", round(gain_diff,2),"dB"
#The solution is incorrect due to the incorrect integration of the normalized power pattern
#As a result, the difference in gain is slightly higher
import math
import scipy.integrate
#Variable declaration
theta_hp = 90
phi_hp = 90
def integrand(theta, phi):
return ((math.sin(theta)**3)*(math.sin(phi)**2))
#Calculation
direct_exact = 4*math.pi/scipy.integrate.dblquad(integrand, 0, math.pi,
lambda x: 0, lambda x: math.pi)[0]
#Exact Directivity(No unit)
direct_apprx = 41253.0/(theta_hp*phi_hp) #Approximate directivity (No unit)
db_diff = 10*math.log10(direct_exact/direct_apprx) #Difference (decibels)
#Result
print "The exact directivity is", round(direct_exact, 1)
print "The approximate directivity is", round(direct_apprx,1)
print "The decibel difference is ", round(db_diff, 1), "dB"
import math
#Variable declaration
Z = 120*math.pi #Intrinsic impedence of free space (ohm)
#Calculation
max_aper = Z/(320*math.pi**2) #Max. effective aperture (lambda^2)
direct = 4*math.pi*max_aper #directivity (unitless)
#Result
print "The maximum effective aperture is", round(max_aper, 3), "lambda^2"
print "The direcitivity is", direct
import math
#Variable declaration
R_r = 73 #Radiation resistance (ohm)
#Calculation
eff_aper = 30/(R_r*math.pi) #Effective aperture (lambda^2)
directivity = 4*math.pi*eff_aper #Directivity (unitless)
#Result
print "The effective aperture is", round(eff_aper, 2), "lambda^2"
print "The directivity is", round(directivity,2)
#Variable declaration
P_t = 15 #Transmitter power (W)
A_et = 2.5 #Effective aperture of transmitter (meter^2)
A_er = 0.5 #Effective aperture of receiver (meter^2)
r = 15e3 #Distance between the antennas (Line of sight) (m)
freq = 5e9 #Frequency (Hz)
c = 3e8 #speed of light (m/s)
#Calculation
wave_len = c/freq #Wavelength (m)
P_r = (P_t*A_et*A_er)/((r**2)*(wave_len**2)) #received power (W)
#Result
print "The power delivered to the receiver is", round(P_r,6), "watts"
#Variable declaration
E1 = 3 #Magnitude of electric field in x direction (V/m)
E2 = 6 #Magnitude of electric field in y direction (V/m)
Z = 377 #Intrinsic impedence of free space (ohm)
#Calculation
avg_power = 0.5*(E1**2 + E2**2)/Z #average power per unit area (W/m^2)
#Result
print "The average power per unit area is", avg_power, "watts/meter^2"
import math
#Variable declaration
AR_w = 4 #Axial Ratio for left elliptically polarized wave (unitless)
tau_w = 15 #Tilt angle for left elliptically polarized wave (degrees)
AR_a = -2 #Axial Ratio for right elliptically polarized wave (unitless)
tau_a = 45 #Tilt angle for right elliptically polarized wave (degrees)
tau_w2 = 20.7 #2*Tilt angle for left elliptically polarized wave (degrees)
tau_a2 = 39.3 #2*Tilt angle for right elliptically polarized wave (degrees)
#Calculation
eps_a2 = 2*math.atan2(1,AR_a)*180/math.pi #polarisation latitude (degrees)
eps_w2 = 2*math.atan2(1,AR_w)*180/math.pi #antenna latitude (degrees)
gamma_w2 =math.acos(math.cos(eps_w2*math.pi/180)*math.cos(tau_w2*math.pi/180));
#great-circle angle - antenna (radians)
gamma_a2 =math.acos(math.cos(eps_a2*math.pi/180)*math.cos(tau_a2*math.pi/180));
#great-circle angle - wave (radians)
M_Ma = (gamma_w2*180/math.pi) + (gamma_a2*180/math.pi)
#total great-circle angle (degrees)
F = math.cos((M_Ma/2)*math.pi/180)**2
#Polarisation matching factor (relative quantity)
#Result
print "The polarization matching factor is", round(F,2)