# Chapter 9 Oscillators¶

## Ex 9_1 PG-9.13¶

In [1]:
from __future__ import division
from math import sqrt, pi
R=4.7e3 #  each resistance of the RC phase shift oscillator
C=0.47e-6 #  each capacitance of the RC phase shift oscillator
f=1/(2*pi*sqrt(6)*R*C) #
print "\n Therefore frequency of oscillation is %.3f Hz \n"%(f)

 Therefore frequency of oscillation is 29.414 Hz



## Ex 9_2 PG-9.13¶

In [2]:
from __future__ import division
from math import sqrt, pi
f=900e3 #  frequency of oscillation
C=1e-12 #  each capacitance of the RC phase shift oscillator
R=1/(2*pi*sqrt(6)*f*C) #
print "\n each resistance of the RC phase shift oscillator is %.3f kohm \n"%(R*1e-3)
G=29 #  opamp gain Rf/R1=29
R1=1e3 #
print "\n R1=%.0f kohm \n"%(R1*1e-3)
Rf=G*R1 #
print "\n Rf=%.0f kohm \n"%(Rf*1e-3)
print "the design circuit is shown "

 each resistance of the RC phase shift oscillator is 72.194 kohm

R1=1 kohm

Rf=29 kohm

the design circuit is shown


## Ex 9_3 PG-9.14¶

In [3]:
from __future__ import division
from math import sqrt, pi
f=1e3 #  frequency of oscillation
C=0.1e-6 #  We choose the value of each capacitance of the RC phase shift oscillator
R=1/(2*pi*sqrt(6)*f*C) #
print "\n  each resistance of the RC phase shift oscillator is %.3f ohm \n"%(R)
print " The standard value of R=680 ohm"

  each resistance of the RC phase shift oscillator is 649.747 ohm

The standard value of R=680 ohm


## Ex 9_4 PG-9.14¶

In [4]:
from __future__ import division
from math import sqrt, pi
R=5e3 #  each resistance of the RC phase shift oscillator
C=0.1e-6 #  each capacitance of the RC phase shift oscillator
f=1/(2*pi*sqrt(6)*R*C) #
print "\n Therefore frequency of oscillation is %.3f Hz \n"%(f)

 Therefore frequency of oscillation is 129.949 Hz



## Ex 9_5 PG-9.20¶

In [5]:
from __future__ import division
from math import sqrt, pi
L=100e-6 #
f=500e3 #
print "We know that for a colpitts oscillator f=1/(2*pi*sqrt(L*Ceq))"
Ceq=1/(f**2*4*pi**2*L)
Ceq1=Ceq*1e9 #
print "\n Ceq = %.5f nF \n"%(Ceq1)
#  C1=C2=C
C=Ceq1*2 #  Ceq=(C*C)/(C+C)
print "\n Therefore C = %.5f nF \n"%(C)

We know that for a colpitts oscillator f=1/(2*pi*sqrt(L*Ceq))

Ceq = 1.01321 nF

Therefore C = 2.02642 nF



## Ex 9_6 PG-9.20¶

In [6]:
from __future__ import division
from math import sqrt, pi
L=50e-6 #
C1=150e-12 #
C2=1.5e-9 #
Ceq=(C1*C2)/(C1+C2) #
f=1/(2*pi*sqrt(L*Ceq)) #
f=f*1e-6 #
print "\n Therefore frequency of oscillation is %.3f MHz \n"%(f)

 Therefore frequency of oscillation is 1.927 MHz



## Ex 9_7 PG-9.21¶

In [7]:
from __future__ import division
from math import sqrt, pi
C=1000e-12 #
C1=C #
C2=C #
f=500e3 #
Ceq=(C1*C2)/(C1+C2) #
L=1/(4*pi**2*f**2*Ceq) #  since f=1/(2*pi*sqrt(L*Ceq)) #
L=L*1e6 #
print "\n Therefore L=%.3f micro H \n"%(L)

 Therefore L=202.642 micro H



## Ex 9_8 PG-9.21¶

In [8]:
from __future__ import division
from math import sqrt, pi
C1=100e-12 #
C2=50e-12 #
f=10e6 #
Ceq=(C1*C2)/(C1+C2) #
L=1/(4*pi**2*f**2*Ceq) #  f=1/(2*pi*sqrt(L*Ceq)) #
L=L*1e6 #
print "\n Therefore inductor L = %.1f microH \n"%(L)

 Therefore inductor L = 7.6 microH



## Ex 9_9 PG-9.24¶

In [9]:
from __future__ import division
from math import sqrt, pi
L1=0.5e-3 #
L2=1e-3 #
C=0.2e-6 #
Leq=L1+L2 #  total inductance  for Hartley oscillator
f=1/(2*pi*sqrt(Leq*C)) #
print "\n Therefore frequency of oscillation is %.f Hz \n"%(f)
#  there is a slight difference between the answer given in the book
#  and the and output in the book they have taken the approximate value

 Therefore frequency of oscillation is 9189 Hz



## Ex 9_10 PG-9.24¶

In [10]:
from __future__ import division
from math import sqrt, pi
L1=2e-3 #
L2=20e-6 #
Leq=L1+L2 #  total inductance  for Hartley oscillator
fmax=2050e3 #  maximum frequency
fmin=950e3 #  minimum frequency
print "For f=fmax=2050kHz"
f=fmax #
C=1/(4*pi**2*f**2*Leq) #  since f=1/(2*pi*sqrt(Leq*C)) #
C=C*1e12
print "\n C=%.2f pF \n"%(C)
print "\n For f=fmin=950kHz"
f=fmin #
C1=1/(4*pi**2*f**2*Leq) #  since f=1/(2*pi*sqrt(Leq*C)) #
C1=C1*1e12
print "\n C=%.2f pF \n"%(C1)
print "\n Hence C must be varied between %.2f pF and %.2f pF \n"%(C,C1)

For f=fmax=2050kHz

C=2.98 pF

For f=fmin=950kHz

C=13.89 pF

Hence C must be varied between 2.98 pF and 13.89 pF



## Ex 9_11 PG-9.25¶

In [11]:
from __future__ import division
from math import sqrt, pi
L1=20e-6 #
L2=2e-3
Leq=L1+L2 #  total inductance  for Hartley oscillator
fmax=2.5e6 #  maximum frequency
fmin=1e6 #  minimum frequency
print "For f=fmax=2.5MHz"
f=fmax #
C=1/(4*pi**2*f**2*Leq) #  since f=1/(2*pi*sqrt(Leq*C)) #
C=C*1e12
print "\n C=%.3f pF \n"%(C)
print "\n For f=fmin=1MHz"
f=fmin #
C1=1/(4*pi**2*f**2*Leq) #  since f=1/(2*pi*sqrt(Leq*C)) #
C1=C1*1e12
print "\n C=%.3f pF \n"%(C1)
print "\n Hence C must be varied between %.3f pF and %.2f pF \n"%(C,C1)

For f=fmax=2.5MHz

C=2.006 pF

For f=fmin=1MHz

C=12.540 pF

Hence C must be varied between 2.006 pF and 12.54 pF



## Ex 9_12 PG-9.32¶

In [12]:
from __future__ import division
from math import sqrt, pi
L=0.4 #
C=0.085e-12 #
R=5e3 #
Cm=1e-12 #
f=1/(2*pi*sqrt(L*C)) #  series resonant frequency for crystal oscillator
print "\n series resonant frequency for crystal oscillator fs=%.3f MHz \n"%(f*1e-6)
Ceq=C*Cm/(C+Cm) #
fp=1/(2*pi*sqrt(L*Ceq)) #  parallel resonant frequency for crystal oscillator
print "\n parallel resonant frequency for crystal oscillator=%.3f MHz \n"%(fp*1e-6)
increase=(fp-f)/f*100 #
print "\n increase in parallel frequency fp=%.3f %% \n"%(increase)
w=2*pi*f #
Q=w*L/R #  Q factor
print "\n Therefore Q factor=%.3f \n"%(Q)
#  in the book fs=0.856MHz is wrong,correct answer is fs=.863MHz
#  in the book 1Jncrease=5.023% is wrong the correct answer is 1Jncrease=4.163%
#  in the Q=430.272  which is wrong the correct answer is Q=433.861

 series resonant frequency for crystal oscillator fs=0.863 MHz

parallel resonant frequency for crystal oscillator=0.899 MHz

increase in parallel frequency fp=4.163 %

Therefore Q factor=433.861



## Ex 9_13 PG-9.32¶

In [13]:
from __future__ import division
from math import sqrt, pi
C=0.01e-12 #
Cm=2e-12 #
L=2 #
R=2e3 #
fs=1/(2*pi*sqrt(L*C)) #  series resonant frequency for crystal oscillator
print "\n series resonant frequency for crystal oscillator fs=%.3f MHz \n"%(fs*1e-6)
Ceq=C*Cm/(C+Cm) #
fp=1/(2*pi*sqrt(L*Ceq)) #  parallel resonant frequency for crystal oscillator
print "\n parallel resonant frequency for crystal oscillator=%.3f MHz \n"%(fp*1e-6)

 series resonant frequency for crystal oscillator fs=1.125 MHz

parallel resonant frequency for crystal oscillator=1.128 MHz