Chapter 2 - Oscillators

Example 2.1 Page No. 2-70

In [3]:
from math import pi
omega = 2.0*10**3  # rad/sec
f=(omega)/(2.0*pi)  # in Hz)
print "Therefore, f = omega / 2pi = %0.2f Hz"%f
Therefore, f = omega / 2pi = 318.31 Hz

Example 2.2 Page No. 2-70

In [4]:
from math import sqrt,pi
from __future__ import division  
print "Refering to equation(1),"
ri=(25*57*1.8)/((57*1.8)+(25*1.8)+(25*57))  # in k-ohm
print "  R''_i = R1 || R2 || h_ie =%0.2f kohm"%ri
print "Now  R''_i + R3 = R"
r3=7.1-1.631  # in k-ohm
print "Therefore,  R3 = R - R''_i =%0.2f kohm"%r3
k=20/7.1
print "  K = R_C / R =%0.2f"%k
print "Now  f = 1 / 2*pi*R*C*sqrt(6+4K)"
c=(1/(sqrt(6+(4*2.816))*2*pi*7.1*10*10**6))*10**12  # in pF
print "Therefore,  C = %0.2f pF"%c
print "  h_fe >= 4K + 23 + 29/K"
hfe=(4*2.816)+23+(29/2.816)
print "  h_fe >=%0.2f"%hfe
Refering to equation(1),
  R''_i = R1 || R2 || h_ie =1.63 kohm
Now  R''_i + R3 = R
Therefore,  R3 = R - R''_i =5.47 kohm
  K = R_C / R =2.82
Now  f = 1 / 2*pi*R*C*sqrt(6+4K)
Therefore,  C = 539.50 pF
  h_fe >= 4K + 23 + 29/K
  h_fe >=44.56

Example 2.3 Page No. 2-71

In [5]:
from __future__ import division  
from math import sqrt,pi
print "The given values are, R = 4.7 k-ohm and C = 0.47 uF"
f=1/(2*pi*sqrt(6)*(4.7*10**3)*(0.47*10**-6))  # in Hz
print "  f = 1 / 2*pi*sqrt(6)*R*C =%0.2f Hz"%f
The given values are, R = 4.7 k-ohm and C = 0.47 uF
  f = 1 / 2*pi*sqrt(6)*R*C =29.41 Hz

Example 2.4 Page No. 2-71

In [6]:
from math import sqrt,pi
from __future__ import division  
print "f = 1 kHz"
print "Now  f = 1 / 2*pi*sqrt(6)*R*C"
print "Choose  C = 0.1 uF"
r=1/(sqrt(6)*2*pi*0.1*1*10**-3)  # in ohm
print "Therefore,  R = %0.2f ohm"%r
print "Choose  R = 680 ohm    standard value"
f = 1 kHz
Now  f = 1 / 2*pi*sqrt(6)*R*C
Choose  C = 0.1 uF
Therefore,  R = 649.75 ohm
Choose  R = 680 ohm    standard value

Example 2.5 Page No. 2-72

In [7]:
from math import sqrt,pi
from __future__ import division  
print "Using the expression for the frequency"
print "Now,  f = 1 / 2*pi*R*C*sqrt(6)"
f=(1/(sqrt(6)*2*pi*9.7*5*10**6))*10**9  # in nF
print "Therefore,  C = %0.2f nF"%f
print "Now using the equation(27)"
print "  |A| = g_m * R_L"
print "Therefore,  |A| >= 29"
print "Therefore,  g_m * R_L >= 29"
rl=(29/(5000*10**-6))*10**-3  # in k-ohm
print "Therefore,  R_L >= 29 / g_m = %0.2f kohm"%rl
print "  R_L = R_D*r_d / R_D+r_d"
rd=(40)/4.8823
print "  Therefore,  R_D = %0.2f k-ohm"%rd
print "While for minimum value of R_L = 5.8 k-ohm"
print "                           R_D = 6.78 k-ohm"
Using the expression for the frequency
Now,  f = 1 / 2*pi*R*C*sqrt(6)
Therefore,  C = 1.34 nF
Now using the equation(27)
  |A| = g_m * R_L
Therefore,  |A| >= 29
Therefore,  g_m * R_L >= 29
Therefore,  R_L >= 29 / g_m = 5.80 kohm
  R_L = R_D*r_d / R_D+r_d
  Therefore,  R_D = 8.19 k-ohm
While for minimum value of R_L = 5.8 k-ohm
                           R_D = 6.78 k-ohm

Exmaple 2.6 Page No. 2-73

In [8]:
from __future__ import division  
from math import sqrt,pi
print "The circuit is Wien bridge oscillator using op-amp. The gain of the op-amp is"
a=1+3
print "A = 1 + R3/R4 =%0.2f"%a
print "So  A > 3"
print "This satisfies the required oscillating condition. The feedback is given to non-inverting terminal ensuring the zero phase shift. Hence the circuit will work as the oscillator."
f=1/(2*pi*5.1*0.001)
print "f = 1 / 2*pi*R*C = %0.2f kHz"%f
print "This will be the frequency of oscillations"
The circuit is Wien bridge oscillator using op-amp. The gain of the op-amp is
A = 1 + R3/R4 =4.00
So  A > 3
This satisfies the required oscillating condition. The feedback is given to non-inverting terminal ensuring the zero phase shift. Hence the circuit will work as the oscillator.
f = 1 / 2*pi*R*C = 31.21 kHz
This will be the frequency of oscillations

Example 2.7 Page No. 2-73

In [9]:
from __future__ import division  
from math import sqrt,pi
print "The frequency of the oscillator is given by,"
print "  f = 1 / 2*pi*sqrt(R1*R2*C1*C2)"
print "For    f = 10 kHz,"
r2=(1/(4*(pi**2)*(100*10**6)*(10*10**3)*(0.001*10**-12)))  # in k-ohm
print "Therefore, R2 = %0.2f kohm"%r2
print "For    f = 50 kHz,"
r2=(1/(4*(pi**2)*(2500*10**6)*(10*10**3)*(0.001*10**-12)))  # in k-ohm
print "Therefore,  R2 = %0.2f k-ohm"%r2
print "So minimum value of R2 is 1.013 k-ohm while the maximum value of R2 is 25.33 k-ohm"
The frequency of the oscillator is given by,
  f = 1 / 2*pi*sqrt(R1*R2*C1*C2)
For    f = 10 kHz,
Therefore, R2 = 25.33 kohm
For    f = 50 kHz,
Therefore,  R2 = 1.01 k-ohm
So minimum value of R2 is 1.013 k-ohm while the maximum value of R2 is 25.33 k-ohm

Example 2.8 Page No. 2-74

In [10]:
from math import sqrt,pi
from __future__ import division  
print "The frequency is given by,"
print "  f = 1 / 2*pi*sqrt(C*L_eq)"
leq=(2*10**-3)+(20*10**-6)
print "where  L_eq = L1 + L2 =%0.2f kHz"%leq
print "For  f = f_max = 2050 kHz"
c=(1/(4*(pi**2)*((2050*10**3)**2)*0.00202))*10**12  # in pF
print "Therefore,  C = %0.2f pF"%c
print "For  f = f_min = 950 kHz"
c=(1/(4*(pi**2)*((950*10**3)**2)*0.00202))*10**12  # in pF
print "Therefore,  C = %0.2f pF"%c
print "Hence C must be varied from 2.98 pF to 13.89 pF, to get the required frequency variation."
The frequency is given by,
  f = 1 / 2*pi*sqrt(C*L_eq)
where  L_eq = L1 + L2 =0.00 kHz
For  f = f_max = 2050 kHz
Therefore,  C = 2.98 pF
For  f = f_min = 950 kHz
Therefore,  C = 13.89 pF
Hence C must be varied from 2.98 pF to 13.89 pF, to get the required frequency variation.

Example 2.9 Page No. 2-75

In [13]:
from math import sqrt,pi
from __future__ import division  
print "The given values are,"
print "L1 = 0.5 mH,  L2 = 1 mH,  C = 0.2 uF"
print "Now  f = 1 / 2*pi*sqrt(C*L_eq)"
leq=0.5+1  # in mH
print "and  L_eq = L1 + L2 =%0.2f mH"%leq
f=(1/(2*pi*sqrt(1.5*0.2*10**-9)))*10**-3  # in kHz
format(5)
print "Therefore,  f =%0.2f kHz"%f
The given values are,
L1 = 0.5 mH,  L2 = 1 mH,  C = 0.2 uF
Now  f = 1 / 2*pi*sqrt(C*L_eq)
and  L_eq = L1 + L2 =1.50 mH
Therefore,  f =9.19 kHz

Example 2.10 Page No. 2-75

In [14]:
from math import sqrt,pi
from __future__ import division  
print "L1 = 20 uH,  L2 = 2 mH"
leq=(20*10**-6)+(2*10**-3)
print "Therefore,  L_eq = L1 + L2 =%0.2f H"%leq
print "For f = f_max = 2.5 MHz"
print "f = 1 / 2*pi*sqrt(C*L_eq)"
c=(1/(((2*pi*2.5*10**6)**2)*(2.002*10**-3)))*10**12
print "Therefore,  C = %0.2f pF"%c
print "For f = f_min = 1 MHz"
c=(1/(((2*pi*1*10**6)**2)*(2.002*10**-3)))*10**12
print "Therefore,  C = %0.2f pF"%c
print "This C must be varied from 2.0244 pF to 12.6525 pF"
L1 = 20 uH,  L2 = 2 mH
Therefore,  L_eq = L1 + L2 =0.00 H
For f = f_max = 2.5 MHz
f = 1 / 2*pi*sqrt(C*L_eq)
Therefore,  C = 2.02 pF
For f = f_min = 1 MHz
Therefore,  C = 12.65 pF
This C must be varied from 2.0244 pF to 12.6525 pF

Example 2.11 Page No. 2-76

In [17]:
from math import sqrt,pi
from __future__ import division  
print "The equivalent capacitance is given by,"
ceq=(150*1.5*10**-21)/((150*10**-12)+(1.5*10**-9))  # in F
print "C_eq = C1*C2 / C1+C2 =%0.2f F"%ceq
print "Now,  f = 1 / 2*pi*sqrt(L*C_eq)"
f=(1/(2*pi*sqrt(50*136.363*10**-18)))*10**-6  # in MHz
print "f = %0.2f MHz"%f
The equivalent capacitance is given by,
C_eq = C1*C2 / C1+C2 =0.00 F
Now,  f = 1 / 2*pi*sqrt(L*C_eq)
f = 1.93 MHz

Example 2.12 Page No. 2-77

In [18]:
from math import sqrt,pi
from __future__ import division  
print "The given values are,"
print "   L = 100 uH,   C1 = C2 = C   and   f = 500 kHz"
print "Now,    f = 1 / 2*pi*sqrt(L*C_eq)"
ceq=1/(4*(pi**2)*(100*10**-6)*((500*10**3)**2))  # in F
print "Therefore, C_eq = %0.2f F"%ceq
print "but    C_eq = C1*C2 / C1+C2    and C1 = C2 = C"
print "Therefore,  C_eq = C / 2"
c=1.0132*2
print "Therefore,  C = %0.2f nF"%c
The given values are,
   L = 100 uH,   C1 = C2 = C   and   f = 500 kHz
Now,    f = 1 / 2*pi*sqrt(L*C_eq)
Therefore, C_eq = 0.00 F
but    C_eq = C1*C2 / C1+C2    and C1 = C2 = C
Therefore,  C_eq = C / 2
Therefore,  C = 2.03 nF

Example 2.13 Page No. 2-78

In [21]:
from math import sqrt,pi
from __future__ import division  
print "Given, C1 = 100 pF,  C2 = 50 pF,  f = 10 MHz,  L = ?"
ceq=(5000*10**-24)/(150*10**-12)
print "C_eq = C1*C2 / C1+C2 = %0.2f F "%ceq
print "f = 1 / 2*pi*sqrt(L*C_eq)"
l=(1/(4*(pi**2)*(33.33*10**-12)*((10*10**6)**2)))*10**6  # in F
print "Therefore, L = %0.2f uH"%l
Given, C1 = 100 pF,  C2 = 50 pF,  f = 10 MHz,  L = ?
C_eq = C1*C2 / C1+C2 = 0.00 F 
f = 1 / 2*pi*sqrt(L*C_eq)
Therefore, L = 7.60 uH

Example 2.14 Page No. 2-79

In [23]:
from math import sqrt,pi
from __future__ import division  
print "For a tuned collector oscillator,"
print "f_r = 1 / 2*pi*sqrt(L*C)"
print "where  L = 30 uH  and f_r to be varied 300 kHz to 1.5 MHz"
print "For  f_r = 300 kHz"
c1=(1/(4*(pi**2)*(30*10**-6)*((300*10**3)**2)))*10**9  # in nF
print "Therefore, C1 =%0.2f nF"%c1
print "For  f_r = 1.5 MHz"
c2=(1/(4*(pi**2)*(30*10**-6)*((1.5*10**6)**2)))*10**12  # in pF
print "Therefore, C2 = %0.2f pF"%c2
print "Hence C must be varied over 375.264 pF to 9.3816 nF, to achieve frequency variations"
For a tuned collector oscillator,
f_r = 1 / 2*pi*sqrt(L*C)
where  L = 30 uH  and f_r to be varied 300 kHz to 1.5 MHz
For  f_r = 300 kHz
Therefore, C1 =9.38 nF
For  f_r = 1.5 MHz
Therefore, C2 = 375.26 pF
Hence C must be varied over 375.264 pF to 9.3816 nF, to achieve frequency variations

Example 2.15 Page No. 2-79

In [24]:
from math import sqrt,pi
from __future__ import division  
fs=(1/(2*pi*sqrt(0.4*0.085*10**-12)))*10**-6  # in MHz
print "(i)  f_s(in MHz) = 1 / 2*pi*sqrt(L*C) =%0.2f MHz"%fs
ceq=0.085/1.085  # in pF
print "(ii)  C_eq = C*C_M / C+C_M =%0.2f pF"%ceq
fp=(1/(2*pi*sqrt(0.4*0.078*10**-12)))*10**-6  # in MHz  (the answer in textbook is wrong)
print "Therefore,  f_p = 1 / 2*pi*sqrt(L*C_eq) =%0.2f MHz"%fp
inc=((0.899-0.856)/0.856)*100  # in percentage
print "(iii)  %% increase =%0.2f"%inc
q=(2*pi*0.4*0.856*10**6)/(5*10**3)
print "(iv)  Q = omega_s*L / R = 2*pi*f_s*L / R =%0.2f"%q
(i)  f_s(in MHz) = 1 / 2*pi*sqrt(L*C) =0.86 MHz
(ii)  C_eq = C*C_M / C+C_M =0.08 pF
Therefore,  f_p = 1 / 2*pi*sqrt(L*C_eq) =0.90 MHz
(iii)  % increase =5.02
(iv)  Q = omega_s*L / R = 2*pi*f_s*L / R =430.27

Example 2.16 Page No. 2-80

In [25]:
from math import sqrt,pi
from __future__ import division  
print "    C_M = 2 pF"
fs=(1/(2*pi*sqrt(2*0.01*10**-12)))*10**-6  # in MHz
print "Now  f_s = 1 / 2*pi*sqrt(L*C) =%0.2f MHz"%fs
ceq=(2*0.01*10**-24)/(2.01*10**-12)  # in F
print "  C_eq = C_M*C / C_M+C =%0.2f F"%ceq
fp=(1/(2*pi*sqrt(2*9.95*10**-15)))*10**-6  # in MHz
print "  f_p = 1 / 2*pi*sqrt(L*C_eq) =%0.2f"%fp
print "So f_s and f_p values are almost same."
    C_M = 2 pF
Now  f_s = 1 / 2*pi*sqrt(L*C) =1.13 MHz
  C_eq = C_M*C / C_M+C =0.00 F
  f_p = 1 / 2*pi*sqrt(L*C_eq) =1.13
So f_s and f_p values are almost same.

Example 2.17 Page No. 2-80

In [26]:
from math import sqrt,pi
from __future__ import division  
print "R = 6 k-ohm,  C = 1500 pF,  R_C = 18 k-ohm"
k=18/6
print "Now    K = R_C / R =%0.2f"%k
print "Therefore,  f = 1 / 2*pi*R*C*sqrt(6+4K)"
f=(1/(2*pi*(6*10**3)*(1500*10**-12)*sqrt(6+12)))*10**-3  # in kHZ
print "  f = %0.2f kHz"%f
hfe=(4*3)+23+(29/3)
print "  (h_fe)min = 4K + 23 + 29/K =%0.2f"%hfe
R = 6 k-ohm,  C = 1500 pF,  R_C = 18 k-ohm
Now    K = R_C / R =3.00
Therefore,  f = 1 / 2*pi*R*C*sqrt(6+4K)
  f = 4.17 kHz
  (h_fe)min = 4K + 23 + 29/K =44.67

Example 2.18 Page No. 2-81

In [28]:
from sympy import symbols,solve
from math import sqrt,pi
from __future__ import division  
print "Refering to equation(1) of section 4.5.3, the input impedance is given by,"
print "R''_i = R1 || R2 || h_ie"
print "Now  R1 = 25 k-ohm,  R2 = 47 k-ohm,  and  h_ie = 2 k-ohm"
ri=(25*47*2)/((47*2)+(25*2)+(25*47))  # in k-ohm
print "Therefore,  R''_i = %0.2f kohm"%ri
print "  K = R_C / R"
print "Now  R_C = 10 k-ohm        ...given"
print "Now  f = 1 / 2*pi*R*C*sqrt(6+4K)"
print "Therefore,  R*sqrt(6+4K) = 31830.989"
print "Now  K = R_C / R = 10*10**3 / R"
print "Therefore,  R*sqrt(6+(40*10*10**3/R)) = 31830.989"
print "Therefore,  R**2*(6+(40*10*10**3/R)) = (31830.989)**2"
R=symbols('R')
p1=6*R**2+(40*10**3)*R-(31830.989)**2
t1=solve(p1,R)[1]
ans1=t1
print "Therefore,  R = %0.2f kohm            Neglecting negative value"%((-ans1)*10**-3)
k=10/16.74
print "Therefore,  K = R_C / R =%0.2f"%k
print "Therefore,  h_fe >= 4K + 23 + 29/K"
hfe=(4*0.5973)+23+(29/0.5973)
print "  h_fe >=%0.2f"%hfe
Refering to equation(1) of section 4.5.3, the input impedance is given by,
R''_i = R1 || R2 || h_ie
Now  R1 = 25 k-ohm,  R2 = 47 k-ohm,  and  h_ie = 2 k-ohm
Therefore,  R''_i = 1.78 kohm
  K = R_C / R
Now  R_C = 10 k-ohm        ...given
Now  f = 1 / 2*pi*R*C*sqrt(6+4K)
Therefore,  R*sqrt(6+4K) = 31830.989
Now  K = R_C / R = 10*10**3 / R
Therefore,  R*sqrt(6+(40*10*10**3/R)) = 31830.989
Therefore,  R**2*(6+(40*10*10**3/R)) = (31830.989)**2
Therefore,  R = -10.08 kohm            Neglecting negative value
Therefore,  K = R_C / R =0.60
Therefore,  h_fe >= 4K + 23 + 29/K
  h_fe >=73.94

Example 2.19 Page No. 2-82

In [29]:
from math import sqrt,pi
from __future__ import division  
ceq=((0.02*12*10**-24)/(12.02*10**-12))*10**12  # in pF
print "  C_eq = C1*C2 / C1+C2 =%0.2f pF"%ceq
fs=(1/(2*pi*sqrt(50*0.02*10**-15)))*10**-6  # in MHz
print "Therefore,  f_s(in MHz) = 1 / 2*pi*sqrt(L*C1) =%0.2f MHz"%fs
fp=(1/(2*pi*sqrt(50*0.01996*10**-15)))*10**-6  # in MHz
print "Therefore, f_p = 1 / 2*pi*sqrt(L*C_eq) =%0.2f MHz"%fp
print "Let C_s = 5 pF connected across the crystal"
c2=12+5
print "Therefore,  C''2 = C2 + C_x =%0.2f pF"%c2
ceq1=0.019976
print "Therefore,  C''_eq = C1*C''2 / C1+C''2 =%0.2f pF"%ceq1
fp1=5.03588
print "Therefore,  f''_p = 1 / 2*pi*sqrt(L*C_eq) =%0.2f MHz"%fp1
print "New C_x = 6 pF is connected then,"
c21=12+6
print "  C''''2 = C2 + C_x =%0.2f pF"%c21
ceq2=0.0199778
print "Therefore,  C''''_eq = C1*C''''2 / C1+C''''2 = %0.2f pF"%ceq2
fp2=5.035716
print "Therefore,  f''''_p = 1 / 2*pi*sqrt(L*C''''_eq) =%0.2f MHz"%fp2
c=(5.03588-5.035716)*10**6
print "Therefore,  Change = f''_p - f''''_p =%0.2f Hz"%c
  C_eq = C1*C2 / C1+C2 =0.02 pF
Therefore,  f_s(in MHz) = 1 / 2*pi*sqrt(L*C1) =5.03 MHz
Therefore, f_p = 1 / 2*pi*sqrt(L*C_eq) =5.04 MHz
Let C_s = 5 pF connected across the crystal
Therefore,  C''2 = C2 + C_x =17.00 pF
Therefore,  C''_eq = C1*C''2 / C1+C''2 =0.02 pF
Therefore,  f''_p = 1 / 2*pi*sqrt(L*C_eq) =5.04 MHz
New C_x = 6 pF is connected then,
  C''''2 = C2 + C_x =18.00 pF
Therefore,  C''''_eq = C1*C''''2 / C1+C''''2 = 0.02 pF
Therefore,  f''''_p = 1 / 2*pi*sqrt(L*C''''_eq) =5.04 MHz
Therefore,  Change = f''_p - f''''_p =164.00 Hz

Example 2.20 Page No. 2-82

In [30]:
from math import sqrt,pi
from __future__ import division  
ri=(22*68*2)/((68*2)+(22*2)+(22*68))
print "R''_i = R1 || R2 || h_fe =%0.2f kohm"%ri  #answer in textbook is wrong
print "Now  R''_i + R3 = R"
r3=6.8-1.8243
print "Therefore,  R3 = R - R''_i =%0.2f kohm"%r3
k=20/6.8
print "K = R_C / R = %0.2f"%k
print "Therefore,  f = 1 / 2*pi*RC*sqrt(6+4K)"
c=(1/(2*pi*6.8*50*sqrt(6+(4*2.9411))*10**6))*10**12
print "Therefore,  C = %0.2f pF"%c
hfe=(4*2.9411)+23+(29/2.9411)
print "And  h_fe >= 4 K + 23 + 29/K >=%0.2f"%hfe
R''_i = R1 || R2 || h_fe =1.79 kohm
Now  R''_i + R3 = R
Therefore,  R3 = R - R''_i =4.98 kohm
K = R_C / R = 2.94
Therefore,  f = 1 / 2*pi*RC*sqrt(6+4K)
Therefore,  C = 111.06 pF
And  h_fe >= 4 K + 23 + 29/K >=44.62

Example 2.21 Page No. 2-82

In [31]:
from __future__ import division  
print "The frequency of the oscillator is given by,"
print "  f = 1 / 2*pi*sqrt(R1*R2*C1*C2)"
print "For  f = 20 kHz,"
r2=(1/(4*(pi**2)*((20*10**3)**2)*(10*10**3)*((0.001*10**-6)**2)))*10**-3
print "Therefore,  R2 = %0.2f kohm"%r2
print "For  f = 70 kHz,"
r2=(1/(4*(pi**2)*((70*10**3)**2)*(10*10**3)*((0.001*10**-6)**2)))*10**-3
print "Therefore,  R2 = %0.2f kohm"%r2
print "So minimum value of R2 is 0.517 k-ohm while the maximum value of R2 is 6.33 k-ohm"
The frequency of the oscillator is given by,
  f = 1 / 2*pi*sqrt(R1*R2*C1*C2)
For  f = 20 kHz,
Therefore,  R2 = 6.33 kohm
For  f = 70 kHz,
Therefore,  R2 = 0.52 kohm
So minimum value of R2 is 0.517 k-ohm while the maximum value of R2 is 6.33 k-ohm

Example 2.22 Page No. 2-83

In [32]:
from __future__ import division  
print "For a Hartley oscillator,"
print "  f = 1 / 2*pi*sqrt(L_eq*C)        where L_eq = L1 + L2 + 2M"
leq=(1/(4*(pi**2)*((168*10**3)**2)*(50*10**-12)))*10**3  # in mH
print "Therefore,  L_eq =%0.2f mH"%leq
l2=((17.95*10**-3)-(15*10**-3)-(5*10**-6))*10**3  # in mH
print "Therefore,  L2 = %0.2f mH"%l2
hfe=((15*10**-3)+(5*10**-6))/((2.945*10**-3)+(5*10**-6))
print "Now    h_fe = L1+M / L2+M =%0.2f"%hfe
For a Hartley oscillator,
  f = 1 / 2*pi*sqrt(L_eq*C)        where L_eq = L1 + L2 + 2M
Therefore,  L_eq =17.95 mH
Therefore,  L2 = 2.95 mH
Now    h_fe = L1+M / L2+M =5.09

Example 2.24 Page No. 2-84

In [33]:
from __future__ import division  
print "(i)  Assume one perticular coupling direction for which,"
print "  L_eq = L1 + L2 + 2M = 0.25 mH"
f=(1/(2*pi*sqrt(0.25*100*10**-15)))*10**-6  # in MHz
print "Therefore,  f = 1 / 2*pi*sqrt(L_eq*C) =%0.2f MHz"%f
print "Let the direction of coupling is reversed,"
print "  L_eq = L1 + L2 - 2M = 0.15 mH"
fd=(1/(2*pi*sqrt(0.15*100*10**-15)))*10**-6  # in MHz
print "Therefore,  f'' = 1 / 2*pi*sqrt(L_eq*C) =%0.2f MHz"%fd
pc=((1.2994-1.00658)/1.00658)*100  # in percentage
print "Therefore,  %% change = f''-f/f * 100 = %0.2f "%pc
print "(ii)  Let us assume direction of coupling such that,"
print "  L_eq = L1 + L2 + 2M = 0.25 mH"
print "   C_t = Trim capacitor = 100 pF"
print "Therefore,  C_eq = C*C_t / C+C_t = 50 pF"
f1=(1/(2*pi*sqrt(0.25*50*10**-15)))*10**-6  # in MHz
print "Therefore,  f = 1 / 2*pi*sqrt(L_eq*C_eq) =%0.2f MHz"%f1
print "If now direction of coupling is reversed,"
print "  L_eq = L1 + L2 - 2M = 0.15 mH"
f2=(1/(2*pi*sqrt(0.15*50*10**-15)))*10**-6  # in MHz
print "Therefore,  f'' = 1 / 2*pi*sqrt(L_eq*C_eq) =%0.2f MHz"%f2
pc1=((1.83776-1.4235)/1.4235)*100
print "Therefore,  %% change = f''-f/f * 100 =%0.2f"%pc1
(i)  Assume one perticular coupling direction for which,
  L_eq = L1 + L2 + 2M = 0.25 mH
Therefore,  f = 1 / 2*pi*sqrt(L_eq*C) =1.01 MHz
Let the direction of coupling is reversed,
  L_eq = L1 + L2 - 2M = 0.15 mH
Therefore,  f'' = 1 / 2*pi*sqrt(L_eq*C) =1.30 MHz
Therefore,  % change = f''-f/f * 100 = 29.09 
(ii)  Let us assume direction of coupling such that,
  L_eq = L1 + L2 + 2M = 0.25 mH
   C_t = Trim capacitor = 100 pF
Therefore,  C_eq = C*C_t / C+C_t = 50 pF
Therefore,  f = 1 / 2*pi*sqrt(L_eq*C_eq) =1.42 MHz
If now direction of coupling is reversed,
  L_eq = L1 + L2 - 2M = 0.15 mH
Therefore,  f'' = 1 / 2*pi*sqrt(L_eq*C_eq) =1.84 MHz
Therefore,  % change = f''-f/f * 100 =29.10

Example 2.25 Page No. 2-84

In [35]:
from sympy import symbols,solve
from __future__ import division  
print "For RC phase shhift oscillator,"
print "  h_fe = 4K + 23 + 29/K           ...given h_fe = 150"
print "Therefore,  150 = 4K + 23 + 29/K"
print "Therefore,  4K**2 - 127K + 29 = 0"
K=symbols('K')
p1=4*K**2-127*K+29
t1=solve(p1,K)[0]
print "Therefore, K =%0.2f"%t1
print "  f = 1 / 2*pi*R*C*sqrt(6+4K)        ...given f = 5 kHz"
print "Therefore,Choose    C = 100 pF"
r=(1/(2*pi*(1000*10**-12)*(5*10**3)*sqrt(6+(4*0.23))))*10**-3  # in k-ohm
print "Therefore,  R = %0.2f kohm"%r
print "  K = R_C / R  i.e.  R_C = KR = 2.7 k-ohm"
print "Neglecting effect of biasing resistances assuming them to be large and selecting transistor with h_ie = 2 k-ohm"
print "  R''_i = h_ie = 2 k-ohm"
print "Therefore,Last resistance in phase network"
r3=12-2
print "  R3 = R - R''_i =%0.2f"%r3
print "Using the back to back connected zener diodes of 9.3 V (Vz) each at the output of emitter follower and using this at the output of the oscillator, the output amplitude can be controlled to 10 V i.e. 20 V peak to peak. The zener diode 9.3V and forward biased diode of 0.7 V gives total 10 V"
print "The designed circuit is shown in fig.2.58"
For RC phase shhift oscillator,
  h_fe = 4K + 23 + 29/K           ...given h_fe = 150
Therefore,  150 = 4K + 23 + 29/K
Therefore,  4K**2 - 127K + 29 = 0
Therefore, K =0.23
  f = 1 / 2*pi*R*C*sqrt(6+4K)        ...given f = 5 kHz
Therefore,Choose    C = 100 pF
Therefore,  R = 12.10 kohm
  K = R_C / R  i.e.  R_C = KR = 2.7 k-ohm
Neglecting effect of biasing resistances assuming them to be large and selecting transistor with h_ie = 2 k-ohm
  R''_i = h_ie = 2 k-ohm
Therefore,Last resistance in phase network
  R3 = R - R''_i =10.00
Using the back to back connected zener diodes of 9.3 V (Vz) each at the output of emitter follower and using this at the output of the oscillator, the output amplitude can be controlled to 10 V i.e. 20 V peak to peak. The zener diode 9.3V and forward biased diode of 0.7 V gives total 10 V
The designed circuit is shown in fig.2.58

Example 2.26 Page No. 2-85

In [36]:
from __future__ import division  
print "(1) f = 1 / 2*pi*sqrt(L*C_eq)"
ceq=(100*500)/600
print "Where  C_eq = C1*C2 / C1+C2 = %0.2f pF"%ceq
f=(1/(2*pi*sqrt(40*83.333*10**-15)))*10**-3
print "f = %0.2f kHz"%f
print "(2) The input voltage is not required for the oscillator. The feedback voltage, which is the part of the output voltage is enough to drive the oscillator"
print "V0 = 10 V"
print "For Colpitts oscillator, gain = C2 / C1"
gain=500/100
print "Therefore,  Gain =%0.2f"%gain
fv=10/5
print "Therefore,  Feedback voltage(in V) = V0 / Gain =%0.2f V"%fv
print "(3) Minimum gain = C2/C1 = 5"
print "h_fe(min) = C2/C1 = 5"
print "(4) Gain = 10 = C2/C1"
c1=500/10
print "Therefore,  C1 = %0.2f pF"%c1
print "(5) For C1 = 50 pF  and  C2 = 500 pF"
ceq=(50*500)/550
print "Where  C_eq = C1*C2 / C1+C2 =%0.2f pF"%ceq
f=(1/(2*pi*sqrt(40*45.4545*10**-15)))*10**-3
print "f = 1 / 2*pi*sqrt(L*C_eq) = %0.2f kHz"%f
(1) f = 1 / 2*pi*sqrt(L*C_eq)
Where  C_eq = C1*C2 / C1+C2 = 83.33 pF
f = 87.17 kHz
(2) The input voltage is not required for the oscillator. The feedback voltage, which is the part of the output voltage is enough to drive the oscillator
V0 = 10 V
For Colpitts oscillator, gain = C2 / C1
Therefore,  Gain =5.00
Therefore,  Feedback voltage(in V) = V0 / Gain =2.00 V
(3) Minimum gain = C2/C1 = 5
h_fe(min) = C2/C1 = 5
(4) Gain = 10 = C2/C1
Therefore,  C1 = 50.00 pF
(5) For C1 = 50 pF  and  C2 = 500 pF
Where  C_eq = C1*C2 / C1+C2 =45.45 pF
f = 1 / 2*pi*sqrt(L*C_eq) = 118.03 kHz

Example 2.27 Page No. 2-86

In [37]:
from __future__ import division  
print "The frequency required is, f = 1 MHz and for FET, u = 20"
print "Now  u = C2/C1  for oscillations"
print "Therefore,  20 = C2/C1"
print "Therefore,  C2 = 20*C1       ....(1)"
print "Let  C1 = 0.01 uF  hence  C2 = 0.2 uF"
ceq=((0.01*0.2)/(0.21))*10**3
print "Therefore,  C_eq = C1*C2 / C1+C2 =%0.2f nF"%ceq
print "Now  f = 1 / 2*pi*sqrt(L*C_eq)"
l=(1/(((2*pi*1*10**6)**2)*(9.5238*10**-9)))*10**6
print "Therefore,  L( = %0.2f uH"%l
print "The baising resistances can be selected as,"
print "R1 = 12 M-ohm  and  R2 = 8 M-ohm"
print "These resistances must be large"
print "The designed circuit is shown in the fig 2.59"
The frequency required is, f = 1 MHz and for FET, u = 20
Now  u = C2/C1  for oscillations
Therefore,  20 = C2/C1
Therefore,  C2 = 20*C1       ....(1)
Let  C1 = 0.01 uF  hence  C2 = 0.2 uF
Therefore,  C_eq = C1*C2 / C1+C2 =9.52 nF
Now  f = 1 / 2*pi*sqrt(L*C_eq)
Therefore,  L( = 2.66 uH
The baising resistances can be selected as,
R1 = 12 M-ohm  and  R2 = 8 M-ohm
These resistances must be large
The designed circuit is shown in the fig 2.59

Example 2.28 Page No. 2-87

In [38]:
from __future__ import division  
leq=500+5000+600
print "L_eq = L1 + L2 + 2M =%0.2f uH"%leq
f=(1/(2*pi*sqrt(150*6100*10**-18)))*10**-3
print "f = 1 / 2*pi*sqrt(C*L_eq) =%0.2f kHz"%f
L_eq = L1 + L2 + 2M =6100.00 uH
f = 1 / 2*pi*sqrt(C*L_eq) =166.38 kHz

Example 2.29 Page No. 2-87

In [39]:
from __future__ import division  
print "L_s = 0.8 H,  C_s = 0.08 pF,  R_s = 5 k-ohm,  C_M = 1 pF"
fs=(1/(2*pi*sqrt(0.8*0.08*10**-12)))*10**-3
print "f_s = 1 / 2*pi*sqrt(C_s*L_s) =%0.2f kHz"%fs
ceq=(0.08*10**-12)/1.08
print "C_eq = C_M*C_s / C_M+C_s =%0.2f F"%ceq
fp=(1/(2*pi*sqrt(0.8*7.4074*10**-14)))*10**-3
print "Therefore,  f_p = 1 / 2*pi*sqrt(C*L_eq) =%0.2f kHz"%fp
L_s = 0.8 H,  C_s = 0.08 pF,  R_s = 5 k-ohm,  C_M = 1 pF
f_s = 1 / 2*pi*sqrt(C_s*L_s) =629.12 kHz
C_eq = C_M*C_s / C_M+C_s =0.00 F
Therefore,  f_p = 1 / 2*pi*sqrt(C*L_eq) =653.80 kHz

Example 2.31 Page No. 2-88

In [40]:
from __future__ import division  
print "The series and parallel resonating frequencies are,"
print "f_s = 1 / 2*pi*sqrt(C*L)  while  f_p = 1 / 2*pi*sqrt(L*C_eq)"
print "f_p/f_s = 1/2*pi*sqrt(L*C_eq) * 2*pi*sqrt(LC) = sqrt(c/C_eq) but C_eq = C*C_M/C+C_M"
fp=sqrt(1+(0.04/2))
print "f_p/f_s = sqrt(C/(C*C_M/C+C_M)) = sqrt(C*(C+C_M)/C*C_M) = sqrt(1+(C/C_M)) =%0.2f"%fp
print "f_p = 1.00995*f_s"
inc=0.00995*100
print "Therefore,  %% increase = (1.00995*f_s-f_s / f_s)*100 =%0.2f"%inc,
The series and parallel resonating frequencies are,
f_s = 1 / 2*pi*sqrt(C*L)  while  f_p = 1 / 2*pi*sqrt(L*C_eq)
f_p/f_s = 1/2*pi*sqrt(L*C_eq) * 2*pi*sqrt(LC) = sqrt(c/C_eq) but C_eq = C*C_M/C+C_M
f_p/f_s = sqrt(C/(C*C_M/C+C_M)) = sqrt(C*(C+C_M)/C*C_M) = sqrt(1+(C/C_M)) =1.01
f_p = 1.00995*f_s
Therefore,  % increase = (1.00995*f_s-f_s / f_s)*100 =1.00

Example 2.32 Page No. 2-88

In [41]:
from __future__ import division  
print "C = 20 pF,  L2 = 1000 uH,  L1 = 100 uH,  M = 20 uH"
leq=100+1000+40
print "Therefore,  L_eq = L1 + L2 + 2M =%0.2f uH"%leq
f=(1/(2*pi*sqrt(1140*20*10**-18)))*10**-6
print  "Therefore,  f = 1 / 2*pi*sqrt(L_eq*C) =%0.2f MHz"%f
print "The feedback fraction beta is given by,"
b=100/1100
print "beta = V_f/V0 = X_L1 / X_L1+X_L2 = L1 / L1+L2 =%0.2f"%b
print "It is a Hartley oscillator"
C = 20 pF,  L2 = 1000 uH,  L1 = 100 uH,  M = 20 uH
Therefore,  L_eq = L1 + L2 + 2M =1140.00 uH
Therefore,  f = 1 / 2*pi*sqrt(L_eq*C) =1.05 MHz
The feedback fraction beta is given by,
beta = V_f/V0 = X_L1 / X_L1+X_L2 = L1 / L1+L2 =0.09
It is a Hartley oscillator

Example 2.33 Page No. 2-89

In [42]:
from __future__ import division  
print "Using the expression of the frequency,"
print "f = 1 / 2*pi*RC*sqrt(6)"
c=(1/(2*pi*10*sqrt(6)*10**6))*10**9
print "Therefore,  C = %0.2f nF"%c
print "For FET phase shift oscillator,"
print "|A| = g_m*R_L  and  |A| >= 29"
rl=(29/5000)*10**3
print "Therefore,  g_m*R_L >= 29  i.e.  R_L(in k-ohm) >=%0.2f"%rl
print "With R_L = 5.8 k-ohm,"
print "R_L = R_D*r_d / R_D+r_d"
rd=40/5.8965
format(7)
print "Therefore,  R_D =%0.2f kohm"%rd
Using the expression of the frequency,
f = 1 / 2*pi*RC*sqrt(6)
Therefore,  C = 6.50 nF
For FET phase shift oscillator,
|A| = g_m*R_L  and  |A| >= 29
Therefore,  g_m*R_L >= 29  i.e.  R_L(in k-ohm) >=5.80
With R_L = 5.8 k-ohm,
R_L = R_D*r_d / R_D+r_d
Therefore,  R_D =6.78 kohm

Example 2.34 Page No. 2-89

In [43]:
from __future__ import division  
print "The name of the oscillator is Pierce oscillator"
print "C1 = 1000 pF,  C2 = 100 pF,  f_s = 1 MHz"
ceq=(1000*100*10**-12)/1100
print "C_eq = C1*C2 / C1+C2 =%0.2f F"%ceq
print "At resonance, X_L  = X_Ceq  i.e.  2*pi*f*L = 1 / 2*pi*f*C_eq"
l=(1/(((2*pi*10**6)**2)*(90.909*10**-12)))*10**6
print "Therefore,  L = 1/(2*pi*f)**2*C_eq = %0.2f uH"%l
print "The fig 2.61(a) shows the electrical equivalent of the crystal"
print "At series resonance,"
print "X_L = X_C for crystal"
print "Therefore,  C = 90.909 pF for crystal"
print "The mounting capacitance is about 1 to 2 pF"
The name of the oscillator is Pierce oscillator
C1 = 1000 pF,  C2 = 100 pF,  f_s = 1 MHz
C_eq = C1*C2 / C1+C2 =0.00 F
At resonance, X_L  = X_Ceq  i.e.  2*pi*f*L = 1 / 2*pi*f*C_eq
Therefore,  L = 1/(2*pi*f)**2*C_eq = 278.63 uH
The fig 2.61(a) shows the electrical equivalent of the crystal
At series resonance,
X_L = X_C for crystal
Therefore,  C = 90.909 pF for crystal
The mounting capacitance is about 1 to 2 pF

Example 2.36 Page No. 2-90

In [44]:
from __future__ import division  
print "f = 2 kHz"
print "f = 1/ 2*pi*R*c*sqrt(6)              ...For phase shift oscillator"
print "Choose  C = 1 nF"
r=(1/(2*pi*2*sqrt(6)*10**-6))*10**-3
print "Therefore,  r = %0.2f kohm"%r
print "Select FET with g_m = 5000 us and r_d = 50 k-ohm"
print "For phase shift oscillator, |A| >= 29 and |A| = g_m*R_L"
print "Therefore,  g_m*R_L >= 29"
rl=(29/(5000*10**-6))*10**-3
print "i.e.  R_L(in k-ohm) >= 29/g_m >=%0.2f"%rl
print "Select  R_L = 6.8 k-ohm"
print "But  R_L = R_D*r_d / R_D+r_d"
rd=7.87
print "Therefore,  R_D = %0.2f kohm"%rd
f = 2 kHz
f = 1/ 2*pi*R*c*sqrt(6)              ...For phase shift oscillator
Choose  C = 1 nF
Therefore,  r = 32.49 kohm
Select FET with g_m = 5000 us and r_d = 50 k-ohm
For phase shift oscillator, |A| >= 29 and |A| = g_m*R_L
Therefore,  g_m*R_L >= 29
i.e.  R_L(in k-ohm) >= 29/g_m >=5.80
Select  R_L = 6.8 k-ohm
But  R_L = R_D*r_d / R_D+r_d
Therefore,  R_D = 7.87 kohm