import math
# Variable Declaration
Lr = 18; # return loss in db
# Calculations
# Lr = 20*math.log(1/float(p));
p = 1/10**(Lr/float(20)); # reflection co-efficient
swr = (1 + p)/(1 - p); # standing wave ratio
# Result
print'Reflection co-efficient is %3.3f\n'%p,'SWR = %3.2f'%(swr);
import math
# Variable Declaration
PW = 30*10**-6; # pulse width in sec
ips = 20*10**-6; # inter pulse separation
v = 3*10**8; # propagation speed in m/s
# Calculations
T = PW+ips+PW+ips+PW # time duration of the pulse train for having 3 pulses on the line at a time
l = v*T; # minimum length of cable required
# Result
print'Minimum length of cable required = %d km' %(l/float(1000));
import math
# Variable Declaration
RmsVmax = 100; # max value of RMS vtg
RmsVmin = 25; # min value of RMS vtg
Zl = 300; # load impedance in ohm
# Calculations
VSWR = RmsVmax/float(RmsVmin);
# wkt VSWR = Zl/float(Zo); assuming Zl > Zo
Zo = Zl/float(VSWR); # charecteristic impedance in ohm
p = (Zl - Zo)/float((Zl + Zo)); # reflection co-efficient
# Result
print'Reflection Co-efficient = %3.1f\n'%p, 'Charecteristic impedance = %d ohm' %Zo;
import math
# Variable Declaration
Zo = 75; # charecteristic impedance in ohm
Vref = 100; # reflected voltage
Pref = 100; # reflected power in watts
# Calculations
Zl = (Vref)**2 /float(Pref); # load impedance
p = (Zl - Zo)/float((Zl + Zo)); # reflection co-efficient
Pinc = Pref/float(p); # incident power
Pobs = Pinc - Pref # power obsorbed
# Result
print'Load Resistance = %d ohm\n'%Zl,'Reflection Co-efficient = %3.3f\n'%p,'incident power = %d watts\n'%Pinc,'power obsorbed = %d watts'%Pobs;
import math
# Variable Declaration
c = 3*10**8; # velocity in m/s
f = 100*10**6 # operating frequency in hz
Zin = 100;
Zl = 25;
# Calculations
lamda = c/float(f); # wavelength in m
Lreq = lamda/float(4); # required length in m
Zo = math.sqrt(Zin*Zl); #charecteristic impedance in ohm
# Result
print'Length of line required = %d cm\n'%(Lreq*10**2),'Charecteristic impedance = %d ohm',%Zo;
import math
#Variable Declaration
# in the first case when the line is lamda/2 long, the i/p impedance is same as the load resistance
Zl = 300; # load resistance in ohm
Zo = 75; # charecteristic impedance in ohm
# calculations
#Zi = Zo*((Zl + iZotanβl)/float((Zo + iZltanβl));
# = Zo*(((Zl/tanβl) + iZo))/((Zl/tanβl) + iZo)))
# for l = lamda/2 βl = (2* π/lamda)*(lamda/float(2)) = π
# therefore tanβl = 0 which gives Zi = Zl
# in the second case when the operating frequency is halved, the wavelength is douβled which means the same line is now lamda/4 long
# for l = lamda/4 ,βl = (2* π/lamda)*(lamda/4) = π/2
# therefore tanβl = ∞
Zi = (Zo**2)/float(Zl); # input impedance
#Result
print'Input impedance = %3.2f ohm'%Zi;
import math
# Given data
f = 100*10**6; # operating frequency in Hz
v = 2*10**8 ; # propagation velocity in m/s
Zo = 300; # charecteristic impedance in ohm
Zin = 300; # input impedance in ohm
l = 1; # length in m
V = 100;
# Calculations
lamda = v/float(f); # wavelength in m
if(lamda/float(2) == l):
Zl = Zin;
k = (V*Zin)/float((Zin+Zl));
#Vin = k*cos(2*%pi*f*t)
# since the line is lamda/2 long ,the signal undergoes a phase delay of βl = (2*π)/lamda *(lamda/2) = π
# Result
print 'Vin = %dcos(2π'%k,'%3.0et)'%f
print 'Vl = %dcos(2π'%k,'%3.0et-π)'%f
import math
# Variable Declaration
VSWR = 3; # voltage standing wave ratio
d = 20*10**-2 # separation b/w 2 successive minimas
er = 2.25; #dielectric constant
v = 3*10**8; # velocity in m/s
# Calculations
# VSWR = (1 + p)/float((1 - p));
p = (VSWR -1)/float((VSWR + 1)); # reflection co-efficient
lamda = 2*d; # wavelength of tx line
lamda_fr= lamda*math.sqrt(er); # free space wavelength
f = v/float(lamda_fr); # operating frequency in Hz
#Result
print'Magnitude of Reflection Co-efficient = %3.1f\n'%p,'Frequency of Operation = %3.0f Mhz'%(f/10**6);
import math
# Given data
C = 30; # per unit capacitance in pF/m
Vp = 260; # velocity of propagation in m/us
f = 500*10**6 # freq in Hz
Zl = 50; # terminating load impedance in ohm
# calculations
v = Vp/float(10**-6); # conversion from m/us to m/s
C1 = C*10**-12 # conversion from pF/m to F/m
# 1/math.sqrt(LC) = Vp
L = 1/float((v**2 * C1)); # per unit inductance
Zo = math.sqrt(L/float(C1)); # charecteristic impedance in ohm
lamda = v/float(f); # wavelength
b = (2*math.pi)/lamda # phase shift constant
p = (Zl - Zo)/float((Zl + Zo)); # Reflection coefficient
# Result
print'Per Unit inductance = %d nH/m\n'%(L*10**9);
print'Charecteristic Impedance = %d ohm\n'%Zo;
print'Phase shift Constant = %d rad/m\n'%b;
print'Reflection co-efficient = %3.3f'%abs(p);
import math
# Variable Declaration
a = 1.5*10**-2; # width of waveguide
b = 1*10**-2 #narrow dimension of waveguide
er = 4; #dielectric constant
f = 8*10**9; #frequency in Hz
c = 3*10**8; #velocity in m/s
#calculations
lamda_c = 2*a; #cut-off wavelength for TE10 mode
lamda = c/f #wavelength corresponding to given freq.
lamda_d = lamda/math.sqrt(er); #wavelength when waveguide filled with dielectric
if lamda_d < lamda_c :
print('8 Ghz frequency will pass through the guide');
# Variable Declaration
a = 4*10**-2; # width of waveguide
b = 2*10**-2 # narrow dimension of waveguide
er = 4; # dielectric constant
c = 3*10**8 # velocity in m/s
# Calculations
lamda_c = 2*a; # max cut-off wavelength
fcmin = c/lamda_c # min freq
lamda_d = lamda_c/math.sqrt(er); # wavelength if we insert dielectric
fc = c/lamda_d # min frequency in presence of dielectric
# Result
print'Minimum Frequency that can be passed with dielectric in waveguide is %3.1f Ghz'%(fc/float(10**9));
import math
# Variable Declaration
f = 1*10**9; # frequency in Hz
a = 5*10**-2; # wall separation
c = 3*10**8; # velocity of EM wave in m/s
m = 1; # for TE10
n = 0; # for TE10
# Calculations
# lamda0 = 2/math.sqrt((m/a)**2 + (n/b)**2)
lamda0 = (2*a)/m
lamda_frspc = c/float(f);
if lamda_frspc > lamda0:
print'1 Ghz signal cannot propagate in TE10 mode'
else:
print'1 Ghz signal can propagate in TE10 mode';
import math
# Variable Declaration
a = 30; # width of waveguide
b = 20; # narrow dimension of waveguide
c = 3*10**8; # velocity of EM wave in m/s
m = 1; # for TE10
n = 0; # for TE10
#Calculations
#lamda0 = 2/math.sqrt((m/a)**2 + (n/b)**2)
lamda0 = (2*a)/m; # longest cut-off wavelength in dominant mode TE10
# Result
print'longest cut-off wavelength = %d mm'%lamda0;
import math
# Variable Declaration
a = 4*10**-2; # width of waveguide
b = 2*10**-2; #narrow dimension of waveguide
c = 3*10**8; # velocity of EM wave in m/s
m1 = 1; # for TE10
m2 = 2; # for TE20
n = 0; # for TE10
# Calculations
lamda_c = 2*a # cutoff wavelength for TE10 mode
f1 = c/lamda_c # frequency in Hz
# the frequency range for single mode operation is the range of frequencies corresponding to the dominant mode and the second highest cutoff wavelength
lamda_c_2 = 2/math.sqrt((m2/a)**2 + (n/b)**2)
f2 = c/lamda_c_2; # freq at second largest cutoff wavelength
# Result
print'Therefore,single mode operating range = %3.2f Ghz'%(f1/float(10**9)),'to %3.1f Ghz\n' %(f2/float(10**9));
print'Note: instead of 3.75,3.5 is printed in textbook';
import math
# Variable Declaration
a = 7.2; # width of waveguide in cm
b = 3.4; # narrow dimension of waveguide in cm
c = 3*10**10; # free space velocity of EM wave in cm/s
f = 2.4*10**9; #frequency in Hz
#Calculation
lamda = c/f # free space wavelength in cm
lamda_c = 2*a # cutoff wavelength in cm
lamda_g = lamda/math.sqrt(1 - (lamda/lamda_c)**2); # guide wavelength in cm
vp = (lamda_g * c)/lamda # phase velocity in cm/s
vg = c**2/float(vp); # group velocity in cm/s
# Result
print'Group velocity = %3.1e cm/s\n'%vg, 'Phase Velocity = %3.1e cm/s'%vp;
import math
# Given data
# let 'a' and 'b' be the broad and narrow dimensions of the rectangular guide and 'r' be internal radius of circular guide
# Dominant mode in rectangular guide =TE10
# cutoff wavelength = 2a
# dominant mode in circular guide = TE11
# cut-off wavelength = 2*pi*r/1.841 = 3.41r
# for the two cut-off wavelengths to equal
# 2a = 3.41r
# a = 1.705r
# now area of cross section of rectangular guide = a*b
# assuming a= 2b,which is very reasonable assumption ,we get
# area of cross section of rectangular waveguide = a*a/2 = ((1.705^2)*r*r)/2 = 1.453r**2
# area of cross-section of circular guide = pi*r*r = 3.14r**2
# ratio of two cross sectional areas = (3.14r**2)/(1.453r**2) = 2.16
# output
print'Circular guide is 2.16 times larger in cross section as compared to rectangular guide';
import math
# Variable Declaration
a = 4*10**-2; # width of waveguide
b = 2*10**-2; # narrow dimension of waveguide
c = 3*10**8; # velocity of EM wave in m/s
f = 5*10**9 # operating frequency in Hz
m0 = 0; # for TE01
m1 = 1; # for TE10 / TE11 /TM11
n0 = 0; # for TE10
n1 = 1; # for TE11 or TM11
# Calculations
lamda = c/f; # operating wavelength
lamda_TE01 = 2/math.sqrt((m0/a)**2 + (n1/b)**2) # cutoff wavelength for TE01
lamda_TE10 = 2/math.sqrt((m1/a)**2 + (n0/b)**2) # cutoff wavelength for TE10
lamda_TE11 = 2/math.sqrt((m1/a)**2 + (n1/b)**2) # cutoff wavelength for TE11 or TM11
# Result
if lamda_TE01 >lamda:
print'TE01 propagates in the given guide at the given operating frequency';
elif lamda_TE10 >lamda:
print'TE10 propagates in the given guide at the given operating frequency';
elif lamda_TE11 >lamda:
print'TE11 propagates in the given guide at the given operating frequency';
import math
# Variable Declaration
a = 4*10**-2; # width of waveguide
b = 2*10**-2; # narrow dimension of waveguide
c = 3*10**8; # velocity of EM wave in m/s
d = 4*10**-2; # distance b/w field maxima and minima
# Calculations
lamda_c = 2*a; # cut-off wavelength in dominant mode
lamda_g = 4*d; # guide wavelength
# lamda_g = lamda0/float((math.sqrt(1 -(lamda0/lamda_c)**2)))
lamda0 = math.sqrt(((lamda_c * lamda_g)**2) / float((lamda_c**2 )+ (lamda_g**2)));
f0 = c/float(lamda0); # frequency of the wave
# Result
print'Frequency of the wave = %3.3f Ghz'%(f0/float(10**9));
import math
# Variable Declaration
a = 6; # width of waveguide in cm
b = 3; # narrow dimension of waveguide in cm
lamda = 4; # operating wavelength in cm
c = 3*10**8; # velocity of EM wave in cm/s
# Calculations
lamda_c = 2*a; # cut-off wavelength in dominant mode
lamda_g = lamda/(float((math.sqrt(1 - ((lamda/float(lamda_c))**2))))); # guide wavelength
Vp = (lamda_g/float(lamda))*c;
b = (2*math.pi)/float(lamda_g); # phase shift constant
#Result
print'Guide wavelength = %3.2f cm\n'%lamda_g;
print'Phase velocity = %3.2e m/s\n'%Vp;
print'Phase shift constant = %3.2f radians/cm'%b;
import math
# variable Declaration
er = 9; # relative permittivity
c = 3*10**10; # velocity of EM wave in free space
f = 2*10**9; # operating frequency in Ghz
a = 7; # width of waveguide in cm
b = 3.5; # narrow dimension of waveguide in cm
# calculations
lamda_c = 2*a; # cut-off wavelength in dominant mode
fc = c/float(lamda_c ); # cut-off frequency in Hz
lamda = c/float((math.sqrt(er)*f)); # operating wavelength
lamda_g = lamda/(math.sqrt(1 - ((lamda/float(lamda_c))**2))); # guide wavelength
Vp = (lamda_g/float(lamda))*c
# Result
print'Cut-off frequency = %3.3f Ghz\n'%(fc/float(10**9));
print'Phase velocity = %3.2e m/s\n'%(Vp/float(10**2));
print'Guide wavelength = %3.2f cm'%lamda_g;