# Ch-1 : Microwaves¶

## Page Number: 12 Example 1.2¶

In [41]:
from __future__ import division
import cmath
from math import pi
#Given
z0=50 #ohm
zg=50 #ohm
l=0.25 #m
f=4e9 #hz
zl=100 #ohm
vg=10 #V
c=3e8  #m/s

#(i) Voltage and current at any point
tg=(zg-z0)/(zg+z0)
tl=(zl-z0)/(zl+z0)
vi=z0*vg/(z0+zg) #V
print 'Voltage at any point = %0.2f V' %(vi)
ii=vg/(2*z0) #A
print 'Current at any point = %0.2f A'%(ii)

#(ii) Voltage at generator end
#Taking z=1
z=1
bet=w/c
vz=(vg/2)*cmath.exp(-1J*bet*(z+l))*(1+(tl*cmath.exp(2*1J*bet*z))) #V
print 'Voltage at generator end ={:.3f}'.format(vz),'V'
iz=ii*cmath.exp(-1J*bet*(z+l))*(1-(tl*cmath.exp(2*1J*bet*z))) #A
vz1=(vg/2)*cmath.exp(-1J*bet*(z+l))*(1+(tl*cmath.exp(2*1J*bet*z))) #V

z11=0
vl=(vg/2)*cmath.exp(-1J*bet*l)*(1+(tl*cmath.exp(2*1J*bet*z11))) #V
print 'Voltage at load end ={:.3f}'.format(vl),'V'

#(iii) Reflection coefficient
zx=0.25
tz=tl*cmath.exp(1J*2*bet*zx)
print 'Reflection coefficient:{:.3f}'.format(tz)

#(iv) VSWR
p=(1+tl)/(1-tl)
print 'VSWR:' ,p

#(v) Average power delivered to the load
vl=20/3
pl0=vl**2/(2*zl) #W
print 'Average power delivered to the load = %0.2f W' %pl0

Voltage at any point = 5.00 V
Current at any point = 0.10 A
Voltage at generator end =-0.833+4.330j V
Voltage at load end =-3.333-5.774j V
Reflection coefficient:-0.167-0.289j
VSWR: 2.0
Average power delivered to the load = 0.22 W


## Page Number: 14 Example 1.3¶

In [42]:
from math import log
#Given
pm=3
pl=4
l=24 #cm
l1=l/100 #m

#Attenuation
tin=(pm-1)/(pm+1)
tl=(pl-1)/(pl+1)
alp=(1/(2*l1))*log(tl/tin) #Np/m
print 'Attenuation in the line = %0.2f'%alp,'Mp/m'

Attenuation in the line = 0.38 Mp/m


## Page Number: 14 Example 1.4¶

In [3]:
from math import sqrt
#Given
c=3e8  #m/s
z0=200 #ohm
zl=800 #ohm
f=30e6 #hz

#Characterstic impedance
z00=sqrt(z0*zl) #ohm
print 'Characterstic impedance = %0.2f ohm' %z00

#Length of line
lam=c/f #m
l=lam/4 #m
print 'Length of line = %0.2f m' %l

Characterstic impedance = 400.00 ohm
Length of line = 2.50 m


## Page Number: 15 Example 1.5¶

In [44]:

#Given
l=1.2 #mH
r=8 #ohm
c=200e-12 #F

#(i) Resonant frequency
f0=(1/(2*pi))*sqrt(1/(l*c)) #hz
print 'Resonant frequency:%0.2f'%f0,'Hz'

#(ii) Impedance of circuit
print 'Impedance of circuit:',r,'ohm'

#(iii)Q factor of the circuit
q=1/(2*pi*f0*c*r)
print 'Q factor of the circuit:%0.2f'%q

#(iv) Bandwidth
df=f0/q #hz

print  'Bandwidth:%0.2f' %df,'Hz'

#The value of resonant frequency is calculated wrong in book
#Hence Q factor and bandwidth, all these answers dont match

Resonant frequency:10273.41 Hz
Impedance of circuit: 8 ohm
Q factor of the circuit:9682.46
Bandwidth:1.06 Hz


## Page Number: Example 1.6¶

In [46]:
from math import cos, sin
#Given
c=3e8  #m/s
le=25 #m
zl=40+(1J*30) #ohm
f=10e6 #hz
cap=40e-12 #F
l=300e-9 #H/m

#Input impedance
z0=sqrt(l/cap) #ohm
zl1=zl/z0
lam=c/f #m
zin=((zl1*cos(bet))+(1J*sin(bet)))/(cos(bet)+(1J*zl1*sin(bet))) #ohm
print 'Input impedance: {:.3f}'.format(zin), 'ohm'

#Reflection coefficient
t=(zl1-1)/(zl1+1)
print 'Reflection coefficient:{:.3f}'.format(t)

Input impedance: 0.577-0.577j ohm
Reflection coefficient:-0.295+0.307j


## Page Number: 16 Example 1.7¶

In [48]:
import cmath
#Given
c=3e8  #m/s
R=2.25 #ohm
L=1e-9 #H/m
C=1e-12 #F/m
f=0.5e9 #hz
G=0

#Characterstic impedance
z0=cmath.sqrt((R+(1J*w*L))/(G+(1J*w*C)))  #ohm
print 'Characterstic impedance:{:.3f}'.format(z0),'ohm'

#Propagation constant
gam=cmath.sqrt((R+(1J*w*L))*(G+(1J*w*C)))
print 'Propagation constant:{:.3f}'.format(gam)

Characterstic impedance:33.392-10.724j ohm
Propagation constant:0.034+0.105j


## Page Number: 20 Example 1.8¶

In [49]:

#Given
c=3e8  #m/s
f=3e9  #Hz
ZL=50-(1J*100)  #ohms
Z0=50  #ohm
#Wavelength
lam=c/f
print 'Wavelength:',lam*100, 'cm'

z=ZL/Z0

#From chart
zin=0.45+(1J*1.2)
yin=0.27-(1J*0.73)
ZINN=Z0*zin
print 'Line impedance:' ,ZINN,'ohm'
YINN=yin/Z0

Wavelength: 10.0 cm
Line impedance: (22.5+60j) ohm


## Page Number: 22 Example 1.9¶

In [50]:

#Given
ZL=75+(1J*100)  #ohms
Z0=50  #ohm

z=ZL/Z0

#(i) 0.051*lam
#From chart
r=4.6
Zi1=r*Z0
print 'Input impedance at 0.051 lam:' ,Zi1,'ohm'

#(ii) 0.102*lam
r1=1.5-(1J*2)
Zi2=r1*Z0
print 'Input impedance at 0.102 lam:' ,Zi2,'ohm'

#(iii) 0.301*lam
r2=0.22
Zi3=r2*Z0
print 'Input impedance at 0.301 lam:' ,Zi3, 'ohm'

Normalized load impedance: (1.5+2j)
Input impedance at 0.051 lam: 230.0 ohm
Input impedance at 0.102 lam: (75-100j) ohm
Input impedance at 0.301 lam: 11.0 ohm


## Page Number: 23 Example 1.10¶

In [51]:

#Given
ZL=15+(1J*20)  #ohms
Z0=50  #ohm

z=ZL/Z0

#From chart
T=0.6
print 'Reflection coefficient:' ,T

#VSWR
p=4
print 'VSWR:' ,p

Normalized load impedance: (0.3+0.4j)
Reflection coefficient: 0.6
VSWR: 4


## Page Number: 25 Example 1.11¶

In [52]:

#Given
Z0=50  #ohm
p=2.4

#From chart
zl=1.4+1J
L=Z0*zl

Load: (70+50j) ohm


## Page Number: 26 Example 1.12¶

In [53]:

#Given
Z0=50  #ohm
T=2.23

#From chart
zl=2+1J
ZLd=Z0*zl
print 'Normalized impedance:',ZLd, 'ohm'

#Impedance of device is by negating the real part
imp=-(ZLd.real)+((ZLd.imag)*1J)
print 'Impedance of device:' ,imp,'ohm'

Normalized impedance: (100+50j) ohm
Impedance of device: (-100+50j) ohm


## Page Number: 27 Example 1.13¶

In [54]:

#Given
p=3
m1=54  #cm
m2=204  #cm

#Point A
print 'Point A'
lam=4*(m2-m1)
dA=0.083*lam
L=m1-dA
print 'Location of stub:',L, 'cm'
IA=0.114*lam
print 'Length:' ,IA, 'cm'

#Point B
print 'Point B'
dB=0.083*lam
IB=0.386*lam
Lb=dB+m1
print 'Location of stub:',Lb, 'cm'

Point A
Location of stub: 4.2 cm
Length: 68.4 cm
Point B
Location of stub: 103.8 cm


## Page Number: 30 Example 1.15¶

In [55]:

#Given
Z0=50  #ohm
ZL=100  #ohms
f=10e9  #Hz
c=0.159e-12  #F

z=ZL/Z0

#From chart
zin=0.4+(1J*0.55)
ZINN=Z0*zin
print 'Normalized impedance:',ZINN, 'ohm'

Normalized load impedance: 2.0
Normalized impedance: (20+27.5j) ohm


## Page Number: 42 Example 1.16¶

In [56]:

#From given wave equation we can see
c=3e8  #m/s
u0=1  #let
e0=1/(9e16)

vp=w/bet #m/sec
print 'Phase velocity:%0.2f' %vp,'m/s'

e=1/(vp**2*u0)
er=e/(e0*u0)
print 'Dielectric constant:' ,er

Phase velocity:33333333.33 m/s
Dielectric constant: 81.0


## Page Number: 42 Example 1.17¶

In [59]:
#Given
c=3e8  #m/s
f=10e9 #hz
er=6
tandel=2e-4

vp=c/er #m/sec
print 'Phase velocity: %0.f'%vp,'m/sec'
al=(pi*f*tandel)/vp #Np/m
print 'Attenuation constant: %0.3f'%al,'Np/m'

#Answer for velocity is calculated wrong in book, hence answers dont match for both

Phase velocity: 50000000 m/sec
Attenuation constant: 0.126 Np/m


## Page Number: 43 Example 1.18¶

In [62]:
 #Given
er=2.2
n0=377 #ohm
n2=n0/sqrt(er) #ohm
n1=377 #ohm

#Reflection coefficient
t=(n2-n1)/(n2+n1)
print 'Reflection coefficient: %0.2f'%t

#Vswr
#Taking mod of reflection coefficient
t1=-t
p=(1+t1)/(1-t1)
print 'VSWR: %0.3f'%p

Reflection coefficient: -0.19
VSWR: 1.483


## Page Number: 43 Example 1.19¶

In [63]:
 #Given
sig=5 #mohm/m
er=80*8.85e-12
eaz=0.1
u=1.26e-6

az=-log(0.1)
#(i) Range at 25Khz
f=25e3 #Khz
a=w*(sqrt((u*er/2)*(sqrt(sig**2/(w**2*er**2)+1)-1)))
z=az/a #m
print 'Range at 25khz: %0.3f'%z, 'm'

#(ii) Range at 25Mhz
f1=25e6 #Mhz

Range at 25khz: 3.273 m