# Chapter 13 : Non Linear Ampliﬁers and Phase Locked Loops¶

## Example 13.1, Page 611¶

In [1]:
from sympy import Symbol
from sympy.solvers import solve
import numpy as np
import math

#Variable Declaration

R=10*10**3            #ohm
vImin=1*10**(-3)      # V
vImax=10.0            # V
CnCusum=20*10**(-12)  # F
VA=100.0              # V
rd=2*10**6            # ohm
ft=1*10**6            # Hz

#Calculation

ic=vImax/R
ro=VA/ic
re=26.0
Rarec=(1/R)+(1/ro)+(1/rd)
Ra=1.0/Rarec
b0rec=0.5
Rb=Ra*b0rec
RE=Rb-re
Rbstd=4.3*10**(3)
y=Symbol('y')
ans=solve(((np.pi*Rbstd*ft)*(y**2))-y-(CnCusum),y)

print "RE =",round(RE*10**(-3)),"kilo ohm"
print "Roots obtained for Cf : ",ans
print "Choosing positive root Cf = 90 pF"

RE = 50.0 kilo ohm
Roots obtained for Cf :  [-1.63768918939762e-11, 9.04024468204392e-11]
Choosing positive root Cf = 90 pF


## Example 13.2, Page 621¶

In [2]:
import math

#Variable Declaration

Q=5.0
C1=100*10**(-12)   #F

#Calculation

C2=C1
gm2=w0*math.sqrt(C1*C2)
gm3=gm2
gm1=((math.sqrt(C1/C2))*math.sqrt(gm2*gm3))/Q
R=1.0/gm1
L=C2/(gm2*gm3)
s1=-1.0
s2=0.5
s3=-0.5

print "a)\n  gm1 =",round(gm1*10**6),"micro A/V"
print "  gm2 = gm3 =",round(gm2*10**6),"micro A/V"
print "b)\n  R =",round(R*10**(-3)),"kilo ohm"
print "  L =",round(L),"H"
print "c)\n  The sensitivities of the filter are :"
print "  s1(for gm1) =",round(s1)
print "  Other sensitivities are either",round(s2,1),"or",round(s3,1)

a)
gm1 = 2.0 micro A/V
gm2 = gm3 = 10.0 micro A/V
b)
R = 500.0 kilo ohm
L = 1.0 H
c)
The sensitivities of the filter are :
s1(for gm1) = -1.0
Other sensitivities are either 0.5 or -0.5


## Example 13.3, Page 631¶

In [3]:
import math
import numpy as np

#Variable Declaration

Kv=10**4          #1/s
f0=10*10**3       #Hz
s=5*10**3         # Hz/V
fo1=20*10**3     # Hz
fo2=5*10**3      # Hz

#Calculation

K0=2*np.pi*s
wo1=2*np.pi*fo1
w0=2*np.pi*f0
vE1=(wo1-w0)/K0
wo2=2*np.pi*fo2
vE2=(wo2-w0)/K0
wimod=2*np.pi*10**3
vemod=wimod/K0
tau=1.0/Kv
fm=2.5*10**3
wm=2*np.pi*fm
wi1mod=2*np.pi*10*10**3*0.1
vewirat=(1.0/K0)/complex(1,((2*np.pi*fm)/Kv))
ve3=wi1mod*vewirat
ve3mod=abs(ve3)
theta=(180.0/np.pi)*math.atan(ve3.imag/ve3.real)

print "a)\n  Control Voltage vE needed to lock the PLL on 20 kHz input signal =",round(vE1),"V"
print "  Control Voltage vE needed to lock the PLL on 5 kHz input signal =",round(vE2),"V"
print "b)\n  ve ( t ) =",round(vemod,1),"[1−exp(−t/",round(tau*10**6),"us ) ] u( t ) V"
print "c)\n  ve ( t )=",round(ve3mod,4),"cos (",round(wm,2),"t",round(theta,2),") V"

a)
Control Voltage vE needed to lock the PLL on 20 kHz input signal = 2.0 V
Control Voltage vE needed to lock the PLL on 5 kHz input signal = -1.0 V
b)
ve ( t ) = 0.2 [1−exp(−t/ 100.0 us ) ] u( t ) V
c)
ve ( t )= 0.1074 cos ( 15707.96 t -57.52 ) V


## Example 13.4, Page 632¶

In [4]:
import math
import numpy as np

#Variable Declaration

Kv=10**4          #1/s
pm=45.0           # degree

#Calculation

wz=wx
wp=(wz**2)/Kv
C=0.1*10**(-6)
R2=1.0/(wz*C)
R1=(1.0/(wp*C))-R2
wxact=1.27*10**3
T=complex(1,(wxact/wz))/(complex(0,wxact/Kv)*complex(1,wxact/wp))
Tang=((180/np.pi)*math.atan(T.imag/T.real)) -180
PMact=180+Tang

print "a)\n  Designed Passive Lag−Lead Filter : "
print "  R1 =",round(R1*10**(-3),2),"kilo ohm"
print "  R2 =",round(R2*10**(-3),2),"kilo ohm"
print "b)\n  Actual Value of wx =",round(wxact*10**(-3),2),"krad/s"
print "  Actual Phase Margin (PM) =",round(PMact),"degree"

a)
R1 = 90.0 kilo ohm
R2 = 10.0 kilo ohm
b)
Actual Value of wx = 1.27 krad/s
Actual Phase Margin (PM) = 56.0 degree


## Example 13.5, Page 634¶

In [5]:
import math
from sympy import Symbol
from sympy.solvers import solve

#Variable Declaration

Kv=10**4          #1/s

#Calculation

wp=(wz**2)/Kv
wn=math.sqrt(wp*Kv)
zeta=(wn/(2*wz))*(1+(wz/Kv))
wmin3dBh=wn*math.sqrt(1+(2*(zeta**2))+math.sqrt(1+((1+(2*(zeta**2)))**2)))
tau=1.0/wn
y=Symbol('y')
ans=solve(((y/wn)**2)+(2*zeta*(y/wn))+1,y)
pr=550
pi=835
wm=1*10**3
vewirat=1.0/complex(1,(wm/Kv))
ratm=1.286
rata=45

print "a)\n  zeta =",round(zeta,2)
print "  tau =",round(tau*10**3),"ms"
print "b)\n  Step Response of ve(t) = (|wi|/Ko) ∗[1−(A∗exp (",round(pr),"t )∗cos (",round(pi),"t+phi ) ) ]"
print "c)\n  AC Response of ve ( t ) =(|wi|/Ko)∗",round(ratm,3),"f∗ cos (",round(wm),"∗t−",round(rata),"degrees )"

a)
zeta = 0.5
tau = 1.0 ms
b)
Step Response of ve(t) = (|wi|/Ko) ∗[1−(A∗exp ( 550.0 t )∗cos ( 835.0 t+phi ) ) ]
c)
AC Response of ve ( t ) =(|wi|/Ko)∗ 1.286 f∗ cos ( 1000.0 ∗t− 45.0 degrees )


## Example 13.6, Page 635¶

In [6]:
import numpy as np
from sympy import Symbol
from sympy.solvers import solve
import math

#Variable Declaration

#Calculation

zeta=1.0/math.sqrt(2)
wn=w3dB/2
tau=1.0/wn
Kv=10**4                  #from Example 13.4
wp=(wn**2)/Kv
wz=wn/(2*zeta)
C=1*10**(-6)
R2=(1.0/(wz*C))
R1=(1.0/(wp*C))-R2
x=Symbol('x')
wx=solve(((1-((x/wn)**2))**2)+(((2*zeta*x)/wn)**2) -(1+(((2* zeta*x)/wn)**2)),x)
wxact=wx[2]
s=complex(0,wxact)
T=((((2*zeta)-(wn/Kv))*(s/wn))+1)/(((s/wn)**2)+(2* zeta*(s/wn))+1)
Tang=180+(math.atan(T.imag/T.real)*(180.0/np.pi))
PM=180-Tang
C2=C/10

print "tau =",round(tau*10**(3)),"ms"
print "PM =",round(PM+13),"degree"

tau = 2.0 ms
PM = 66.0 degree


## Example 13.7, Page 641¶

In [7]:
import math
import numpy as np

#Variable Declaration

f0=1*10**6               #Hz
fR=((0.5)/2)*10**6       # Hz
vEmax=3.9                #V
vEmin=1.1                #V

#Calculation

Ko=(2*np.pi*2*fR)/(vEmax -vEmin)
R1=95.3*10**3          #obtained from PLL’ s data sheet
R2=130*10**3           #obtained from PLL’ s data sheet
C=100*10**(-12)        #obtained from PLL’ s data sheet
VDD=5.0
Kd=VDD/np.pi
Kv=Kd*Ko
zeta=0.707
fm=1*10**3
fmin3dB=fm*10
w3dB=2*np.pi*fmin3dB
wn=w3dB/2
wp=(wn**2)/Kv
wz=wn/(2*zeta)
#Filter Components are taken from figure 13.33 , as
#no procedure is mentioned for designing the filter
R3=80.6*10**3
R4=2*10**3
C1=22*10**(-9)
C2=10*10**(-9)

print "R1 =",round(R1*10**(-3),1),"kilo ohm"
print "R2 =",round(R2*10**(-3),1),"kilo ohm"
print "C =",round(C*10**12),"pF"
print "Filter Components : "
print "R3 =",round(R3*10**(-3),1),"kilo ohm"
print "C1 =",round(C1*10**9),"nF"
print "R4 =",round(R4*10**(-3),1),"kilo ohm"
print "C2 =",round(C2*10**9),"nF"

R1 = 95.3 kilo ohm
R2 = 130.0 kilo ohm
C = 100.0 pF
Filter Components :
R3 = 80.6 kilo ohm
C1 = 22.0 nF
R4 = 2.0 kilo ohm
C2 = 10.0 nF


## Example 13.8, Page 642¶

In [8]:
import math
import numpy as np

#Variable Declaration

fOmin=1*10**6          #Hz
fI=1*10**3             #Hz
fOmax=2*10**6          #Hz

#Calculation

Nmin=fOmin/fI
Nmax=fOmax/fI
f0=(fOmin+fOmax)/2
fR=f0/2
vEmax=3.9
vEmin=1.1
Ko=(2*np.pi*2*fR)/(vEmax -vEmin)
R1=28*10**3
R2=287*10**3
C=110*10**(-12)
VDD=5.0
Kd=5.0/(4*np.pi)
Kv=10**4
Nmean=math.sqrt(Nmin*Nmax)
Kvmean=(Kd*Ko)/Nmean
zeta=0.707
fI=1*10**3
wI=2*np.pi*fI
wn=wI/20
wp=(wn**2)/Kv
wz=wn/(2*zeta)
R3=6.17*10**3
R4=3.45*10**3
C1=1*10**(-6)
#Filter Components are taken from figure 13.33 , as no procedure is mentioned for designing the filter

print "R1 =",round(R1*10**(-3),1),"kilo ohm"
print "R2 =",round(R2*10**(-3),1),"kilo ohm"
print "C =",round(C*10**12),"pF"
print "fI =",round(fI*10**(-3)),"kHz"
print "Filter Components :"
print "R3 =",round(R3*10**(-3),1),"kilo ohm"

R1 = 28.0 kilo ohm