# Chapter 13 Waveform Generators¶

## Example 13.1 Pg 378¶

In [1]:
from math import sqrt, pi
from __future__ import division
# to design RC phase shift oscillator for the oscillation frequency f = 1 KHz
f =1 # # KHz
C = 0.01 # # uF

# The oscillation frequency of practical RC phase shift oscillator is defined as
#w = 1/(sqrt(6)*R*C)#

# gain of practical RC phase shift oscillator is
#A = R1/R = 29                                           equation 1
# the frequency selective element resistor
#R = 1/(sqrt(6)*w*C)#
R = 1/(sqrt(6)*2*pi*f*C)#
print 'the frequency selective element resistor is = %0.2f'%R,' K ohm '

# The feedback resistance
R1 = 29*R #                                                # from equation 1
print 'The feedback resistance is = %0.1f'%R1,' K ohm'

the frequency selective element resistor is = 6.50  K ohm
The feedback resistance is = 188.4  K ohm


## Example 13.2 Pg 379¶

In [2]:
from math import sqrt, pi
from __future__ import division
# to determine the oscillaton frequency of the phase shift oscillator
C = 0.05 #  # uF
R = 2.5 #  # K ohm

# the oscillator frequency of practical RC phase shift oscillator f
f = 1/(2*pi*(sqrt(6)*(R*C)))#
print 'the oscillator frequency of practical RC phase shift oscillator f is = %0.2f'%f,' KHz '

the oscillator frequency of practical RC phase shift oscillator f is = 0.52  KHz


## Example 13.3 Pg 380¶

In [3]:
from math import sqrt, pi
from __future__ import division
# to calculate the frequency of a wein bridge oscillator
C = 2400*10**-12 #  # F
R = 10*10**3 #  # ohm

# the oscillator frequency of practical RC phase shift oscillator f
f = 1/(2*pi*R*C)/1e3#
print 'the oscillator frequency of practical RC phase shift oscillator f is = %0.2f'%f,' kHz '

the oscillator frequency of practical RC phase shift oscillator f is = 6.63  kHz


## Example 13.4 Pg 380¶

In [4]:
from math import sqrt, pi
from __future__ import division
# to design the wien bridge oscillator for the oscillation frequency f = 1 KHz
f = 1 # # K ohm
C = 0.01 #  # uF

# the frequency f is define as
# f = 1/(2*pi*R*C)#

# the resistor R is
R = 1/(2*pi*f*C)#
print 'the resistor R is = %0.1f'%R,' K ohm '

# the loop gain of the wien bridge oscillator is unity which is defined as
# A = (1+(R2/R1))*(1/3) = 1 #
#  R2/R1 = 2 #
R1 = 10 #  # K ohm we assume
R2 = 2*R1 #
print 'The resistor R2 value is = %0.2f'%R2,' K ohm '

the resistor R is = 15.9  K ohm
The resistor R2 value is = 20.00  K ohm


## Example 13.5 Pg 382¶

In [5]:
from math import sqrt, pi
from __future__ import division
# to calculate the frequency of a wein bridge oscillator
C = 0.05*10**-6 #  # F
R = 20*10**3 #  # ohm
R1 = 10*10**3 #  # ohm
R2 = 20*10**3 #  #ohm

# the frequency of wien bridge oscillator f
f = 1/(2*pi*R*C)#
print 'the frequency of wien bridge oscillator f is = %0.3f'%f,' Hz '

the frequency of wien bridge oscillator f is = 159.155  Hz


## Example 13.6 Pg 382¶

In [6]:
from sympy import symbols, log, N
R, C = symbols('R C')
# Determine the frequency response of the astable multivibrator circuit
Vsat = 2.5 #
VT = 0.7 #

# The frequency of the astable multivibrator is
f = (1/(2*R*C*log((Vsat+VT)/(Vsat-VT))))#
print 'The frequency of the astable multivibrator is =',N(f,2)

The frequency of the astable multivibrator is = 0.87/(C*R)


## Example 13.7 Pg 383¶

In [7]:
from math import log
# Design astable multivibrator for the frequency f = 10 KHz
f = 10 # # K ohm
Vsat = 3 #
VT = 0.7 #

# The saturation voltage of an astable multivibrator is defined as
#  Vsat = (R1+R2/R1)+VT #
R1 = 10 #  # K ohm  we choose
R2 = ((Vsat/VT)-1)*R1 #
print 'The value of resistance R2 is = %0.2f'%R2,' K ohm '

# The frequency of an astable multivibrator is defined as
C = 0.01 #  # uF
# f = (1/(2*R*C*log(1+(2*R1/R2))))#

R = 1/(2*f*C*log(1+2*R1/R2))#
print 'The value of resistor R is = %0.2f'%R,' K ohm'

The value of resistance R2 is = 32.86  K ohm
The value of resistor R is = 10.52  K ohm


## Example 13.8 Pg 384¶

In [8]:
# to design astable multivibrator
f = 25*10**3 #

# The output frequency of practical astable multivibrator is defined as
#  f = 1/(2*R*C)#
C = 0.1*10**-6 # # uF   we choose
R = 1/(2*f*C)#
print 'The value of resistor R is = %0.2f'%R,'ohm '

The value of resistor R is = 200.00 ohm


## Example 13.9 Pg 385¶

In [9]:
# Design a monostable circuit with frequency f = 25 KHz
f =25*10**3 # # Hz

# The output frequency of monostable multivibrator is defined as
#  f = 1/(0.69*R*C)#
C = 0.1*10**-6 #
R = 1/(0.69*f*C)#
print 'The value of resistance R is = %0.1f'%R,' ohm '

# In the practical monostable multivibrator
#  ln(1+(R2/R1))= 0.69 #
R1 = 10*10**3 #  # we choose
R2 = R1*(1.99372-1)#
print 'The value of resistance R2 is = %0.2f'%(R2/1000),' K ohm ' # Round Off Error

The value of resistance R is = 579.7  ohm
The value of resistance R2 is = 9.94  K ohm


## Example 13.10 Pg 386¶

In [10]:
from math import log
# Determine the frequency of the monostable multivibrator
R1 = 5*10**3 #
R2 =15*10**3 #
C = 0.01*10**-6 #
R = 12*10**3 #

# the output of monostable multivibrator is defined as
f = 1/(R*C*(log(1+(R2/R1))))/1e3 # kHz
print 'the output of monostable multivibrator is = %0.2f'%f,' kHz'

the output of monostable multivibrator is = 6.01  kHz


## Example 13.11 Pg 386¶

In [11]:
from __future__ import division
# Determine the frequency of the monostable multivibrator
R1 = 5*10**3 #
R2 =15*10**3 #
C = 0.01 #
R = 25 #

# the output of monostable multivibrator is defined as
f = 1/(R*C)#
print 'the output of monostable multivibrator is = %0.2f'%f,' KHz'

the output of monostable multivibrator is = 4.00  KHz