Chapter 12: Integrated Citcuits and Operational Amplifiers¶

example 12.1, Page No.442¶

In [5]:
# dc currents and voltage of differential amplifier

import math
# Variable declaration
Vcc = 12              # collector voltage
Vee = -12             # emitter voltage
Rc = 4.1*10**3        # Collector resistance
Re = 3.8*10**3        # emitter resistance
Vbe = 0.7             # voltage across base-emitter junction

#Calculations
Ie = (Vcc-Vbe)/Re
Ic = 0.5*Ie
Vo = Vcc-Ic*Rc

#Result
print("Ie = %.4f mA\nIc = %.3f mA\nVo = %.1f V"%(Ie*1000,Ic*1000,Vo))

Ie = 2.9737 mA
Ic = 1.487 mA
Vo = 5.9 V


example 12.2, Page No.442¶

In [39]:
# Differential amplifier parameters

import math
#Variable declaration
Vcc = 12              # collector voltage
Vee = -12             # emitter voltage
Rc = 1*10**6          # Collector resistance
Re = 1*10**6          # emitter resistance
Vbe = 0.7             # voltage across base-emitter junction
vi = 2.1*10**-3       # AC input voltage
beta = 75

#Calculations
#(a)
Ie = (Vcc-Vbe)/Re
ie = 0.5*Ie
re = (25*10**-3)/ie
re_dash = 4420.0#value used in the book
#(b)
g = Rc/(2*re_dash)
g = math.floor(g*10)/10
#(c)
vo = g*vi
vo = math.floor(vo*10000)/10000
#(d)
Zi = 2*beta*re
#(e)
cmg = Rc/(re+2*Re)
cmg = math.ceil(cmg*1000)/1000
#(f)
cmrr = g/cmg
#(g)
cmrr_db = 20*math.log10(cmrr)

#Result
print("(a) re = %d ohm\n(b) voltage gain for differential input = %.1f\n(c) AC output voltage = %.4f V"%(re,g,vo))
print("(d) input impedance = %d k-ohm\n(e) CMRR = %.2f\n(g) CMRR' = %.1f dB"%(Zi/1000,cmrr,cmrr_db))

#Answer for re is wong in the book

(a) re = 4424 ohm
(b) voltage gain for differential input = 113.1
(c) AC output voltage = 0.2375 V
(d) input impedance = 663 k-ohm
(e) CMRR = 226.65
(g) CMRR' = 47.1 dB


example 12.3, Page No. 447¶

In [44]:
# Op-amp with negative feedback

import math
#Variable declaration
Ag = 100000.0         # open loop gain of Op-amp
fb = 0.01             # feed back factor
vi = 2*10**-3         # input voltage

#Calculations
# a
g = Ag/(1+(fb*Ag))
# b
v = vi*g
# c
Ev = v/Ag

#Result
print("(a) Closed loop gain = %.1f \n(b) Output = %.4f V\n(c) Error voltage = %.3f*10^-6 V"%(g,v,Ev*10**6))

(a) Closed loop gain = 99.9
(b) Output = 0.1998 V
(c) Error voltage = 1.998*10^-6 V


example 12.4, Page No. 447¶

In [49]:
# Op-amp with negative feedback

import math
#Variable declaration
Ag = 15000.0         # open loop gain of Op-amp
fb = 0.01             # feed back factor
vi = 2*10**-3         # input voltage

#Calculations
# a
g = Ag/(1+(fb*Ag))
# b
v = vi*g
# c
Ev = v/Ag

#Result
print("(a) Closed loop gain = %.3f \n(b) Output = %.4f V\n(c) Error voltage = %.3f*10^-5 V"%(g,v,Ev*10**5))
print("\nComparison conclusion:\nA decrease in open loop gain causes a corresponding increase in error voltage,")
print("thus keeping the output voltage nearly constant.")

(a) Closed loop gain = 99.338
(b) Output = 0.1987 V
(c) Error voltage = 1.325*10^-5 V

Comparison conclusion:
A decrease in open loop gain causes a corresponding increase in error voltage,
thus keeping the output voltage nearly constant.


example 12.5, Page No. 448¶

In [53]:
# input/output impedances

import math
#variable declaration
g = 100000.0                  # open loop gain
Zi = 2*10**6                  # input impedance
Zo = 75                       # output impedance
beta = 0.01                   # feedback factor

#Calculations
D = 1+ beta*g
Zi_cl = Zi*D
Zo_cl = Zo/D

#Result
print("Closed loop input impedance = %.0f M-ohm\nClosed loop output impedance = %.4f ohm"%(Zi_cl/10**6,Zo_cl))

Closed loop input impedance = 2002 M-ohm
Closed loop output impedance = 0.0749 ohm


example 12.6, Page No.448¶

In [56]:
# closed loop gain and disensitivity

import math
#Variable declaration
g = 100000.0              # open loop gain
beta = 0.001              # feedback factor

#calculations
clg = g/(1+ beta*g)
D = 1+g*beta

# Result
print("Closed loop gain = %.1f \nDesensitivity = %.0f "%(clg,D))

Closed loop gain = 990.1
Desensitivity = 101


example 12.7, Page No.448¶

In [60]:
# closed loop gain and upper cut off frequency

import math
#Variable declaration
f = 10**6            # unity gain frequency
alg = 100000.0       # open loop gain
b1 = 0.001           # feedback factor in case 1
b2 = 0.01            # feedback factor in case 2
b3 = 0.1             # feedback factor in case 3

#calculations
# a
f1 = f/alg
# b
g2 = alg/(1+alg*b1)
f2 = f/g2
# c
g3 = alg/(1+alg*b2)
f3 = f/g3
# d
g4 = alg/(1+alg*b3)
f4 = f/g4

#Result
print("Open loop,\tgain = %.0f \tf2 = %d Hz"%(alg,f1))
print("Closed loop,\tgain = %.1f \tf2 = %d Hz"%(g2,f2))
print("Closed loop,\tgain = %.1f \tf2 = %d Hz"%(g3,f3))
print("Closed loop,\tgain = %.3f \tf2 = %d Hz"%(g4,f4))

Open loop,	gain = 100000 	f2 = 10 Hz
Closed loop,	gain = 990.1 	f2 = 1010 Hz
Closed loop,	gain = 99.9 	f2 = 10010 Hz
Closed loop,	gain = 9.999 	f2 = 100010 Hz


example 12.8, Page No.449¶

In [63]:
# Slew rating

import math
#Variable declaration
Imax = 10*10**-6          # maximum current
C = 4000*10**-12           # capacitance in pF

#Calculations
sr = Imax/C

#Result
print("Slew rate = %.1f V/ms"%(sr/1000))

Slew rate = 2.5 V/ms


example 12.9, Page No. 449¶

In [70]:
# slew rate distortion

import math
#Variable declaration
sr = 0.4            # Slew rate
V = 6               # peak value of voltage
f = 10*10**3        # frequency

#Calculations
slope = 2*math.pi*f*V

#Result
print("Initial slope of sine wave =%.5f V/micro-sec"%(slope/10**6))
print("\nSince the slew rate of amplifier is %.1f V/micro-sec, there is no slew rate distortion."%(sr))

Initial slope of sine wave =0.37699 V/micro-sec

Since the slew rate of amplifier is 0.4 V/micro-sec, there is no slew rate distortion.


example 12.10, Page No. 449¶

In [72]:
# Slew rate distortion

import math
#Variable declaration
sr = 0.5*10**6            # slew rate
V = 10              # peak value of input signal
f = 10*10**3        # frequency

#calculations
# a
slope = 2*math.pi*f*V
# b
Vp = sr/(2*math.pi*f)

#Result
print("(a) Initial slope of sine wave = %.3f V/micro-sec"%(slope/10**6))
print("Since initial slope is more than the slew rate of amplifier, slew rate distortion will occur.")
print("\n(b) To eliminate slew rate distortion,\n Vp = %.2f V"%Vp)

(a) Initial slope of sine wave = 0.628 V/micro-sec
Since initial slope is more than the slew rate of amplifier, slew rate distortion will occur.

(b) To eliminate slew rate distortion,
Vp = 7.96 V


example 12.11, Page No.451¶

In [79]:
# inverting amplifier

import math
#Variable declaration
A = 100000.0                # open loop gain
Zo = 75.0                   # output impedance
f = 1.0*10**6               # unity gain frequency
R1 = 1.0*10**3              # Source Resistance
Rf = 100.0*10**3            # feedback resistance

#Calculations
# a
g = -Rf/R1
# b
beta = R1/(R1+Rf)
D = 1+(A*beta)
# c
f2 = beta*f
# d
Zi_cl = R1

#result
print("(a) Gain = %f\n(b) disensitivity = %.1f"%(g,D))
print("(c) closed loop upper cut off frequency = %.1f*10^3 Hz\n(d) closed loop input impedance = %.0f ohm"%(f2/1000,Zi_cl))

(a) Gain = -100.000000
(b) disensitivity = 991.1
(c) closed loop upper cut off frequency = 9.9*10^3 Hz
(d) closed loop input impedance = 1000 ohm


example 12.12, Page No. 453¶

In [84]:
# closed loop voltage gain, input/output impedance(refering to fig 12.11)

import math
# Variable declaration
R2 = 100.0*10**3          # Resistance R2
R1 = 100.0                # Resistance R1
A = 100000.0              # open loop gain
Zin = 2*10**6             # input impedance
Zo = 75                   # output impedance

# Calculations
g = (R1+R2)/R1
beta = R1/(R1+R2)
Zi_dash = (1+A*beta)*Zin
Zo_dash = Zo/(1+A*beta)

#Result
print("Closed loop gain = %.0f \nClosed loop input impedance = %.1f M-ohm\nClosed loop output impedance = %.3f ohm"%(g,Zi_dash/10**6,Zo_dash))

Closed loop gain = 1001
Closed loop input impedance = 201.8 M-ohm
Closed loop output impedance = 0.743 ohm


example 12.13, Page No.454¶

In [93]:
# Op-amp parameters(refering to fig. 12.13)

import math
#Variable declaration
A = 100000.0             # open loop gain
f = 1.0*10**6            # unity gain frequency
R3 = 150 *10**3          # Resistance R3
Ci = 1*10**-6            # inpuut capacitor
R2 = 100*10**3           # Resistance R2
Cb = 1*10**-6            # Bias capacitor
R1 = 1.0*10**3           # Resistance R1
Co = 1*10**-6            # output capacitance
Rl = 15*10**3            # load resistance

#Calculations
# a
A = (R1+R2)/R1
# b
beta = 1/A
f2 = f/A
# c
fc1 = 1/(2*math.pi*Ci*R3)
fc2 = 1/(2*math.pi*Cb*Rl)
fc3 = 1/(2*math.pi*Co*R1)

#Result
print("(a) Avf = %.0f \n\n(b) f2' =%.1f*10^3 Hz"%(A,f2/1000))
print("\n(c) The critical frequencies are,\n    fc = %.3f Hz\n    fc = %.2f Hz\n    fc = %.2f Hz"%(fc1,fc2,fc3))
print("\n(d) Evidently the lower cut off frequency is the highest of the above three critical frequencies, i.e. %.2f Hz"%fc3)

(a) Avf = 101

(b) f2' =9.9*10^3 Hz

(c) The critical frequencies are,
fc = 1.061 Hz
fc = 10.61 Hz
fc = 159.15 Hz

(d) Evidently the lower cut off frequency is the highest of the above three critical frequencies, i.e. 159.15 Hz


example 12.14, Page No.455¶

In [95]:
# output voltage(referring fig.12.14)

import math
# Variable declaration
v1 = 0.5                   # input voltage 1
v2 = 1.5                   # input voltage 2
v3 = 0.2                   # input voltage 3
R1 = 10.0*10**3            # resistance R1
R2 = 10.0*10**3            # resistance R2
R3 = 10.0*10**3            # resistance R3
Rf = 50.0*10**3            # feedback resistance

#Calculations
vo = -Rf*((v1/R1)+(v2/R2)+(v3/R3))

#Result
print("Output  Voltage = %.0f V"%vo)

Output  Voltage = -11 V


example 12.15, Page No.455¶

In [96]:
print("Theoretical example")

Theoretical example


example 12.16, Page No.456¶

In [97]:
print("Theoretical example")

Theoretical example


example 12.17, Page No. 457¶

In [99]:
# difference amplifier(referring fig. 12.18)

import math
#Variable declaration
R1 = 50.0*10**3           # Resistance R1
R2 = 10.0*10**3           # Resistance R2
Vs1 = 4.5                 # input voltage at channel 1
Vs2 = 5.0                 # input voltage at channel 2

#Calculations
vo = R1*(Vs2-Vs1)/R2

#Result
print("Output voltage = %.1f V"%vo)

Output voltage = 2.5 V


example 12.18, Page No.458¶

In [101]:
# CMRR in dB

import math
#Variable declaration
A = 50.0                   # gain of difference amplifier
v = 2.0                    # input voltage
vo = 5.0*10**-3            # output voltage

#Calculations
Vcom = 0.5*(v+v)
Acom = vo/Vcom
cmrr = A/Acom
cmrr = 20*math.log10(cmrr)

#Result
print("CMRR = %.2f dB"%(cmrr))

CMRR = 86.02 dB


example 12.19, Page No.458¶

In [102]:
print("Theoretical Example")

Theoretical Example


example 12.20, Page No.459¶

In [103]:
print("Theoretical Example")

Theoretical Example


example 12.21, Page No.466¶

In [112]:
# two pole high pass filter(referring fig. 12.32)

import math
#Variable declaration
R1 = 10.0*10**3          # Resistance R1
R2 = 5.6*10**3           # Resistance R2
R = 1.0*10**3            # Resistance R
C = 0.01 *10**-6         # capacitance
vi = 1.6*10**-3          # input voltage

#Calculations
# a
A = 1+(R2/R1)
# b
vo = A*vi
# c
pi = math.ceil(math.pi*10000)/10000
fc = 1/(2*pi*R*C)
# d
gain =  0.707*A

#Result
print("(a) midband gain = %.2f\n(b) output voltage = %.3f mV\n(c) fc = %.2f Hz\n(d) Gain = %.3f"%(A,vo*1000,fc,gain))

(a) midband gain = 1.56
(b) output voltage = 2.496 mV
(c) fc = 15915.46 Hz
(d) Gain = 1.103


example 12.22, Page No. 466¶

In [5]:
# Low pass filter(referring fig. 12.30)

import math
#Variable declaration
vi = 1.1*10**-3               # input voltage
R = 10*10**3                  # Resistance
C = 0.001*10**-6              # Capacitance
R1 = 10*10**3                 # Resistance R1
R2 = 5.6*10**3                # Resistance R2

#Calculations
# a
A = (R1+R2)/R1
vo1 = A*vi
# b
fc = 1/(2*math.pi*R*C)
# c
vo = 0.707*vo1

#Result
print("(a)  Avf = %.2f\n     Vo = %.3f*10^-3 V\n(b) fc = %.3f*10^3 Hz\n(c) at f = fc,\nVo = %.3f* 10^-3 V"%(A,vo1*1000,fc/1000,vo*1000))

(a)  Avf = 1.56
Vo = 1.716*10^-3 V
(b) fc = 15.915*10^3 Hz
(c) at f = fc,
Vo = 1.213* 10^-3 V


example 12.23, Page No.466¶

In [6]:
print("Theoretical example")

Theoretical example