import math
#Given:
d = 0.49 #in cm
D = 1.1 #in cm
e_r = 2.3
#calculations
c = 3*10**8 #in meter/second
L = 2*(10**-7)*math.log(D/d) #in Henry/meter
C = 55.56*(10**-12)*(e_r)/math.log(D/d) #in farad/meter
R_o = (60/math.sqrt(e_r)) *math.log(D/d) #in ohms
v = c/math.sqrt(e_r) #in meter/second
#---output---#
print 'Inducmath.tance per unit length(in H/m) =',round(L,4)
print 'Capacimath.tance per unit length(in F/m) =',round(C,4)
print 'Characteristic Impedance (in ohms) =',round(R_o,4)
print 'Velocity of propagation (in m/s)=',round(v,4)
import math
R = 0.05 #in ohms
G = 0
l = 50 #in meter
e = 2.3 #dielectric consmath.tant
#calculations
c = 3*10**8 #in m/s
L = 2*(10**(-7)) #from Exa:4.1
C = 1.58*(10**(-10)) #from Exa:4.1
P_in = 480 #in watts
f = 3*10**9 #in hertz
Z_o = math.sqrt(L/C)
a = R/Z_o #in Np/m
b = 2*math.pi*f*math.sqrt(L*C) #in rad/m
V_p = 1/math.sqrt(L*C)
e_r = (c/V_p)**2
P_loss = P_in*2*l
#---output---#
print 'Atteneuation (in Np/m) =',round(a,4)
print 'Phase consmath.tant (in rad/m) =',round(b,4)
print 'Phase velocity (in m/s) =',round(V_p,4)
print 'Relative permittivity =',round(e_r,4)
print 'Power loss (in watts) =',round(P_loss,4)
import math
#Given
a = 2.42 #in cm
x = 2.3 #x=(b/a)
#calculation
P_bd = 3600*a**2*math.log(x) #in kilowatts
#---output---#
print 'Breakdown Power (in kW) =',round(P_bd,4)
#answer in book is wrongly written as 398 kW.
import math
b = 0.3175 #in cm
d = 0.0539 #in cm
c = 3*10**8 #in m/s
e_r = 2.32
#calculations
Z_o = 60*math.log(4*b/(math.pi*d))/math.sqrt(e_r) #in ohms
V_p = c/math.sqrt(e_r) #in m/s
#---output---#
print 'Charcteristic impedance (in ohms) =',round(Z_o,4)
print 'Velocity of propagation (in m/s) =',round(V_p,4)
import math
e_r = 9.7
c = 3*10**8 #in m/s
r_1 = 0.5 #when ratio: (W/h)=0.5
r_2 = 5 #when ratio: (W/h)=5
#For W/h ratio=0.5
#calculations
e_eff_1 = (e_r+1)/2+((e_r-1)/2)*(1/(math.sqrt(1+12*(1/r_1))+0.04*(1-r_1)))
Z_o_1 = 60*math.log(8/r_1+r_1/4)/math.sqrt(e_eff_1)
v_1 = c/math.sqrt(e_eff_1)
e_eff_2 = (e_r+1)/2+((e_r-1)/2)*(1/(math.sqrt(1+12*(1/r_2))))
Z_o_2 = 120*math.pi*(1/(r_2+1.393+0.667*math.log(1.444+r_2)))/math.sqrt(e_eff_2)
v_2 = c/math.sqrt(e_eff_2)
#---output---#
print "For W/h=0.5 ,"
print 'Effective dielectric consmath.tant =',round(e_eff_1,4)
print 'Charcteristic impedance (in ohms) =',round(Z_o_1,4)
print 'Velocity of propagation (in m/s) =',round(v_1)
#For W/h ratio=5
print "For W/h=5,";
print 'Effective dielectric consmath.tant =',round(e_eff_2,4)
print 'Charcteristic impedance (in ohms) =',round(Z_o_2,4)
print 'Velocity of propagation (in m/s) =',round(v_2,4)
import math
#For TE Wave propagated:
#for Recmath.tangular , taking (a=2b)
r = 100 #assume
#for TE11, wavelength=2*pi*r/1.841
#for TE10, wavelength=2a
#calculations
a = (2*math.pi*r/1.841)/2
ar_rec_TE = (a)*(a/2)
ar_cir_TE = math.pi*r**2
ratio_TE = (ar_cir_TE)/(ar_rec_TE)
b = (2.6155*r)/1.78885
ar_rec_TM = (b)*(b)
ar_cir_TM = math.pi*r**2
ratio_TM = (ar_cir_TM)/(ar_rec_TM)
#---output---#
print 'Ratio of Circular & Rectangular coss-section area (in TE) =',round(ratio_TE,4)
#For TM Wave propagated:
#for Recmath.tangular , taking (a=2b)
#for TE01, wavelength=2.6155*r
#for TE11, wavelength=4b/math.sqrt(5)
print 'Ratio of Circular & Rectangular coss-section area (in TM) =',round(ratio_TM,4)
import math
f = 9*10**9 #in Hz
c = 3*10**10 #in cm/s
#calculations
wl_g = 4 #in m
wl_o = c/f
wl_c = (math.sqrt(1-((wl_o/wl_g)**2))/wl_o)**(-1)
b = wl_c/4
#---output---#
print 'Breadth of rectangular waveguide (in cm) =',round(b,4)
import math
a = 10 #in cm
c = 3*10**10 #in cm/s
#calculations
wl_c = 2*a #in cm
f = 2.5*10**9 #in Hz
wl_o = c/f
wl_g = wl_o/(math.sqrt(1-(wl_o/wl_c)**2)) #in cm
V_p = c/(math.sqrt(1-(wl_o/wl_c)**2))
V_g = c**2/V_p
#---output---#
print 'Cut-off wavelength (in cm) =',round(wl_c,4)
print 'Guide wavelength (in cm) =',round(wl_g,4)
print 'Phase velocity (in cm/s) =',round(V_p,4)
print 'Group velocity (in cm/s) =',round(V_g,4)
import math
#For TE mode:
a = 2.5 #in cm
b = 1 #in cm
f = 8.6*10**9 #in Hz
c = 3*10**10 #in cm/s
#calculations
wl_o = c/f
wl_c_1 = 2*b #for TE01
wl_c_2 = 2*a #for TE10
f_c = c/wl_c_2
wl_c_3 = 2*a*b/math.sqrt(a**2+b**2) #for TE11 & TM11
wl_g_TE10 = wl_o/(math.sqrt(1-(wl_o/wl_c_2)**2)) #for TE10
wl_c_TM11 = wl_c_3;
wl_g_TM11 = wl_o/(math.sqrt(1-(wl_o/wl_c_2)**2)) #for TM11
#---output---#
print 'Only TE10 mode is possible'
print 'Cut-off frequency(in Hz) =',round(f_c,4)
print wl_g_TE10,'Guide wavelength for TE10 (in cm) =',round(wl_g_TE10,4)
#For TM mode:
print 'TM11 also propagates'
print 'Guide wavelength for TM11 (in cm) =',round(wl_g_TM11,4)
import math
wl_c = 10 #in cm
c = 3*10**10 #in cm/s
#calculations
r = wl_c/(2*math.pi/1.841) #in cm
area = math.pi*r**2 #in sq. cm
f_c = c/wl_c
#---output---#
print 'Radius of circular waveguide(in cm) =',round(r,4)
print 'Area of cross-section of circular waveguide(in cm) =',round(area,4)
print 'Frequency above',round(f_c,4),'can be propagated'
import math
a = 4 #in cm
b = 3 #in cm
f = 5*10**9 #in Hz
c = 3*10**10 #in cm/s
#calculations
wl_o = c/f
#For TE waves:
wl_c_TE01 = 2*b #for TE01
wl_c_TE10 = 2*a #for TE10
wl_c_TE11 = 2*a*b/math.sqrt(a**2+b**2) #for TE11
#---logic---#
if(wl_c_TE01>wl_o):
print 'TE01 can propagate'
else:
print 'TE01 cannot propagate'
if(wl_c_TE10>wl_o):
print 'TE10 can propagate'
else:
print 'TE10 cannot propagate'
if(wl_c_TE11>wl_o):
print 'TE11 can propagate'
else:
print 'TE11 cannot propagate'
import math
c = 3*10**10 #in cm/s
d = 4 #in cm
#calculations
r = d/2 #in cm
wl_c = 2*math.pi*r/1.841 #in cm
f_c = c/wl_c
f_signal = 5*10**9 #in Hz
wl_o = c/f_signal
wl_g = wl_o/math.sqrt(1-(wl_o/wl_c)**2)
#---output---#
print 'Cut-off wavelength (in cm) =',round(wl_c,4)
print 'Cut-off frequency (in Hz) =',round(f_c,4)
print 'Guide wavelength (in cm) =',round(wl_g,4)
import math
c = 3*10**10 #in cm/s
a = 5 #in cm
b = 2.5 #in cm
wl_o = 4.5 #in cm
#For TE10 mode:
#calculations
wl_c = 2*a
wl_g = wl_o/math.sqrt(1-(wl_o/wl_c)**2)
V_p = c/math.sqrt(1-(wl_o/wl_c)**2)
w = 2*math.pi*c/wl_o
w_c = 2*math.pi*c/wl_c
b = math.sqrt(w**2-w_c**2)/c
#---output---#
print 'Guide wavelength (in cm) =',round(wl_g,4)
print 'Phase consmath.tant =',round(b,4)
print 'Phase velocity (in cm/s) =',round(V_p,4)
#answer in book is wrongly written as guide wavelength =7.803 cm
#answer in book is wrongly written as Phase velocity = 5.22*10**10 cm/s
import math
c = 3*10**10 #in cm/s
wl_c_TE10 = 16 #Critical wavelength of TE10
wl_c_TM11 = 7.16 #Critical wavelength of TM11
wl_c_TM21 = 5.6 #Critical wavelength of TM21
#For (i): 10 cm
wl_o = 10 #in cm
wl_o=5 #in cm
#---logic---#
print 'For free space wavelength (in cm) =',round(wl_o,4)
if(wl_c_TE10>wl_o):
print ' TE10 can propagate'
else:
print ' TE10 cannot propagate'
if(wl_c_TM11>wl_o):
print ' TM11 can propagate'
else:
print ' TM11 cannot propagate'
if(wl_c_TM21>wl_o):
print ' TM21 can propagate'
else:
print ' TM21 cannot propagate'
#For (ii): 5 cm
print ('For free space wavelength (in cm) =',round(wl_o))
if(wl_c_TE10>wl_o):
print (' TE10 can propagate')
else:
print (' TE10 cannot propagate')
if(wl_c_TM11>wl_o):
print (' TM11 can propagate')
else:
print (' TM11 cannot propagate')
if(wl_c_TM21>wl_o):
print (' TM21 can propagate')
else:
print (' TM21 cannot propagate')
import math
c = 3*10**10 #in cm/s
f = 10*10**9 #in Hz
a = 3 #in cm
b = 2 #in cm
#calculations
n = 120 * math.pi
wl_o = c/f
wl_c = 2*a*b/math.sqrt(a**2+b**2)
Z_TM = round(n*math.sqrt(1-(wl_o/wl_c)**2),4)
#output
print 'Characteristic impedance (in ohms) =', Z_TM
#answer in book is wrongly written as 61.618 ohms
import math
c = 3*10**10 #in cm/s
f = 6*10**9 #in Hz
#calculations
f_c = 0.8*f
wl_c = c/f_c
D = round(1.841*(wl_c/math.pi),4)
wl_o = c/f
wl_g = round(wl_o/math.sqrt(1-(wl_o/wl_c)**2),4)
#output
print 'Diameter of waveguide (in cm) =', D
print 'Guide wavelength (in cm) =', wl_g
import math
a = 1.5 #in cm
b = 1 #in cm
e_r = 4 #dielectric
c = 3*10**10 #in cm/s
#calculations
wl_c = 2*b
f_c = c/wl_c
f_imp = 6*10**9 #impressed frequency (in Hz)
wl_air = c/f_imp
#Inserting dielectric:
wl_dielec = wl_air/math.sqrt(e_r)
#---logic--#
if(wl_dielec > wl_c):
print ' TE01 can propagate'
else:
print ' TE01 cannot propagate'
import math
u = 4*math.pi*10**-7
e = 8.85*10**-12
c = 3*10**10 #in cm/s
f = 6*10**9 #in Hz
a = 1.5 #in cm
b = 1 #in cm
#For TE10 mode:
m = 1
n = 0
#calculations
wl_c = 2*a
f_c = c/wl_c
t_1 = (m*math.pi/a)**2
t_2 = (n*math.pi/b)**2
t_3 = (((2*math.pi*f)**2)*u*e)
a = math.sqrt(abs(t_1+t_2-t_3)) #in neper/m
# variable t_1+t_2-t_3 is negative. So I changed the sign to calculate sqrt.
#---output---#
print 'Attenuation (in dB/m) =', round(a*20 / math.log(10),4)
import math
c = 3*10**10 #in cm/s
f = 9*10**9 #inHz
a = 3 #in cm
b = 1 #in cm
E_max = 3000 #in V/cm
#calculations
wl_o = c/f
wl_c = 2*a #in TE10
wl_g = round(wl_o/math.sqrt(1-(wl_o/wl_c)**2))
P_max = (6.63*10**-4)*E_max**2*a*b*(wl_o/wl_g)
#---output---#
print 'Maximum power for rectangular waveguide (in kilowatts)=', round(P_max/1000, 4)
import math
c = 3*10**10 #in cm/s
f = 9*10**9 #inHz
E_max = 300 #in V/cm
d = 5
#calculations
wl_o = c/f
#For TE11
wl_c = d*math.pi/1.841
wl_g = wl_o/math.sqrt(1-(wl_o/wl_c)**2)
P_max = 0.498*E_max**2*d**2*(wl_o/wl_g)
#---output---#
print 'Maximum power (in watts) =',round(P_max,4)
import math
c = 3.*10**10 #in cm/s
f = 30.*10**9 #inHz
a = 1. #in cm
b = 1.
P_max = 746. #in watts
#calculations
wl_o = c/f
wl_c = 2*a
Z = 120*math.pi/math.sqrt(1-(wl_o/wl_c)**2)
E_max = math.sqrt(P_max*4*Z/(a*b/10000))
#---output---#
print 'Peak value of electric field (in kV/m) =',round(E_max/1000,4)
import math
#Given:
c = 3*10**10 #in cm/s
a = 2.3 #in cm
b = 1 #in cm
f = 9.375*10**9 #in Hz
#calculations
wl_o = c/f
P_bd_TE11 = 597 * 2.3 * 1 * (1-(wl_o/(2*a))**2)**0.5
#---output---#
print 'Breakdown power for dominant mode (in kW) =',round(P_bd_TE11,4)
import math
#Given:
d = 5 #in cm
c = 3*10**10 #in cm/s
f = 9*10**9 #inHz
#Dominant mode is TE11:
#calculations
wl_o = c/f
wl_c = math.pi*d/1.841
f_c = c/wl_c
P_bd_TE11 = 1790*(d/2)**2*(1-(f_c/f)**2)**0.5
#---output---#
print 'Breakdown power (in kW) =',round(P_bd_TE11/1000,4)