# Chapter3: Linear Application of IC Op-Amps¶

## Ex3.1:pg-95¶

In :
#Given
R1=2.2#kohm
G=-100 #Voltage gain
Rf=-G*R1#kohm
print "Value of Rf: ",Rf ,"kohm"

Value of Rf:  220.0 kohm


## Ex3.2:pg-95¶

In :
#Given
Vin=2.5 #mV
R1=2 #kohm
Rf=200 #kohm
G=-Rf/R1 #Gain
Vo=G*Vin/1000.0 #V
print "Output Voltage Vo=",Vo

Output Voltage Vo= -0.25


## Ex3.3:pg-96¶

In :
#Given
G=-10 #Gain
Ri=100 #kohm input resistance
R1=Ri #kohm
R2=-G*R1 #kohm
print R1,"is the Value of R1 in kohm "
print int(R2/1000),"the Value of R2 in Mohm "

100 is the Value of R1 in kohm
1 the Value of R2 in Mohm


## Ex3.4:pg-119¶

In :
import math
#Given
FT1=1  #Filter Transmission
FT2=0.99  #Filter Transmission
FT3=0.9  #Filter Transmission
FT4=0.1  #Filter Transmission
A1= int(-20*math.log10(FT1))  #dB
A2= round(-20*math.log10(FT2),3)  #dB
A3= round(-20*math.log10(FT3),3)  #dB
A4= -20*math.log10(FT4)  #dB
print "For filter transmission=1, Attenuation(dB)=", A1
print "For filter transmission=0.99, Attenuation(dB)=",A2
print "For filter transmission=0.9, Attenuation(dB)=",A3
print "For filter transmission=0.1, Attenuation(dB)=",A4
#Answer in the book is wrong for 0.99 filter transmission.

For filter transmission=1, Attenuation(dB)= 0
For filter transmission=0.99, Attenuation(dB)= 0.087
For filter transmission=0.9, Attenuation(dB)= 0.915
For filter transmission=0.1, Attenuation(dB)= 20.0


## Ex3.5:pg-119¶

In :
#Given
import math
fo=2 #kHz
Ap=10.0 #Band pass gain
C=0.1 #micro F(have to choose C, 0.01<C<1)
R2=round(1/(2*math.pi*fo*math.pow(10,3)*C*math.pow(10,-6)),1) #ohm
R1=R2/Ap #ohm
print "Design values are :"
print C,"is the Capacitance(micro F)"
print int(round(R1)),"is the Resistance R1(ohm)"
print round(R2/1000.0,1),"is the Resistance R2(kohm)"
#Answer in the book is wrong R2 should be .8kohm instead of 8kohm.

Design values are :
0.1 is the Capacitance(micro F)
80 is the Resistance R1(ohm)
0.8 is the Resistance R2(kohm)


## Ex3.6:pg-129¶

In :
import math
#Given
fo=1  #kHz
Ap=1.586  #Band pass gain
C=0.005 #micro F C1=C2=0.005(Assumed)
R=round(1/(2*math.pi*fo*math.pow(10,3)*C*math.pow(10,-6)),2) #ohm
Rf=10  #kohm(Assumed)
Ri=Rf/(Ap-1)  #kohm
print "Design values are :"
print round(R/1000,2)," is the Resistance in kohm, R1=R2=R"
print round(Ri,2),"is the Resistance Ri(kohm)"
print Rf,"is the Resistance Rf(kohm)"
print C,"is the Capacitance(micro F), C1=C2=C"

Design values are :
31.83  is the Resistance in kohm, R1=R2=R
17.06 is the Resistance Ri(kohm)
10 is the Resistance Rf(kohm)
0.005 is the Capacitance(micro F), C1=C2=C


## Ex3.7:pg-134¶

In :
import math
#Given
fo=3  #kHz
Ap=4  #Band pass gain
alfa=1.414  #for butterworth filter
C1=0.01  #micro F(Assumed)
C2=round(math.pow(alfa,2)*C1/4.0,3)  #micro F
R=round(1/(2*math.pi*fo*math.pow(10,3)*math.sqrt(C1*math.pow(10,-6)*C2*math.pow(10,-6))*1000.0),3)  #kohm
Rf=2*R  #kohm(Assumed)
print "Design values are :"
print C1,"is the Capacitance C1(micro F)"
print C2,"is the Capacitance C2(micro F)"
print R,"is the Resistance R(kohm)"
print "For offset minimization, Resistance Rf(kohm)=",Rf
Ri=10.0  #kohm(Assumed)
Rf=(Ap-1)*Ri  #kohm
print "For additional band pass gain:"
print Ri,"is the Resistance Ri(kohm)"
print Rf,"is the Resistance Rf(kohm)"
#Answer in the book is incorrect for C2.

Design values are :
0.01 is the Capacitance C1(micro F)
0.005 is the Capacitance C2(micro F)
7.503 is the Resistance R(kohm)
For offset minimization, Resistance Rf(kohm)= 15.006
10.0 is the Resistance Ri(kohm)
30.0 is the Resistance Rf(kohm)


## Ex3.8:pg-136¶

In :
import math
#Given
fo=2 #kHz
alfa=1.414 #for butterworth filter
Ap=3-alfa #band pass gain
RfBYRi=(Ap-1) #op-amp gain
C=0.05 #micro F(Assumed)
R=round(1/(2*math.pi*fo*10**3*C*10**-6)/1000,1) #kohm
#For offset minimization 2*R=Rf||Ri
Rf=round(2*R*RfBYRi+2*R,2) #kohm
Ri=round(Rf/RfBYRi,3) #kohm
print "Design values are :"
print C,"is the Capacitance C(micro F)"
print R,"is the Resistance R(kohm)"
print Rf,"is the Resistance Rf(kohm)"
print Ri,"is the Resistance Ri(kohm)"

Design values are :
0.05 is the Capacitance C(micro F)
1.6 is the Resistance R(kohm)
5.08 is the Resistance Rf(kohm)
8.669 is the Resistance Ri(kohm)


## Ex3.9:pg-139¶

In :
#Ex 3.9
import math
fo=1.2 #kHz
alfa=1.414 #for butterworth filter
Ap=3-alfa #band pass gain
RfBYRi=(Ap-1) #op-amp gain
C=0.03 #micro F(have to choose C, 0.01<C<1)
R=round(1/(2*math.pi*fo*10**3*C*10**-6)/1000,1) #kohm
#For offset minimization 2*R=Rf||Ri
Rf=round(2*R*RfBYRi+2*R,2) #kohm
Ri=round(Rf/RfBYRi,1) #kohm
print "Design values are :"
print C,"is the Capacitance(micro F)"
print R,"is the Resistance R(kohm)"
print Rf,"is the Resistance Rf(kohm)"
print Ri,"is the Resistance Ri(kohm)"

Design values are :
0.03 is the Capacitance(micro F)
4.4 is the Resistance R(kohm)
13.96 is the Resistance Rf(kohm)
23.8 is the Resistance Ri(kohm)


## Ex3.10:pg-141¶

In :
 #Ex 3.10
import math
fL=200  #Hz
fH=1*1000  #Hz
Ap=4  #band pass gain
BW=fH-fL  #Hz
f0=math.sqrt(fH*fL)  #Hz
fc=math.sqrt(fH*fL)  #Hz
Q=fc/BW  #Quality factor
print round(Q,2),"is the Quality factor "
print "As Q<12   it is wide band filter "
print fL,"is the Design values for high pass section with Ap1=2 & fL(Hz) : "
Ap1=2  #band pass gain for high pass section
C=0.033  #micro F(have to choose C, 0.01<C<1)
R=int(1/(2*math.pi*fL*C*10 **-6)/1000.0)  #kohm
RfBYRi=(Ap-1)  #op-amp gain
Rf=2*R  #kohm
Ri=2*R  #kohm
print C,"is the Capacitance(micro F) "
print R,"is the Resistance R(kohm) "
print Rf,"=Resistance Rf(kohm) "
print Ri,"=Resistance Ri(kohm) "
print fH,"=Design values for low pass section with Ap2=2 & fH(Hz) : "
Ap2=2  #band pass gain for low pass section
C=0.033  #micro F(have to choose C, 0.01<C<1)
k=fL/fH  #scaling factor
Rdash=0.2*R  #kohm
Ri=2*Rdash  #kohm
Rf=Ri  #kohm(for Ap2=2)
print C,"=Capacitance(micro F) "
print Rdash,"=Resistance Rdash(kohm) "
print Rf,"=Resistance Rf(kohm) "
print Ri,"=Resistance Ri(kohm) "
print "For design purpose use rounded value 10 kohm for Rf & Ri "

0.56 is the Quality factor
As Q<12   it is wide band filter
200 is the Design values for high pass section with Ap1=2 & fL(Hz) :
0.033 is the Capacitance(micro F)
24 is the Resistance R(kohm)
48 =Resistance Rf(kohm)
48 =Resistance Ri(kohm)
1000 =Design values for low pass section with Ap2=2 & fH(Hz) :
0.033 =Capacitance(micro F)
4.8 =Resistance Rdash(kohm)
9.6 =Resistance Rf(kohm)
9.6 =Resistance Ri(kohm)
For design purpose use rounded value 10 kohm for Rf & Ri


## Ex3.11:pg-144¶

In :
#Ex 3.11
import math
fL=200 #Hz
fH=1*1000 #Hz
Ap=4 #band pass gain
BW=fH-fL #Hz
f0=math.sqrt(fH*fL) #Hz
fc=math.sqrt(fH*fL) #Hz
Q=int(fc/BW) #Quality factor
print Q, "=Quality factor"
print "As Q<10   it is wide band filter"
print fH, "=Design values for low pass section with Ap2=2 & fH(Hz) :"
Ap2=2 #band pass gain for low pass section
C=0.03 #micro F(have to choose C, 0.01<C<1)
Rdash=round(1/(2*math.pi*fH*C*10**-6)/1000,1) #kohm
print C, "=Capacitance(micro F)"
print Rdash, "=Resistance Rdash(kohm)"
print "Value of Resistance Rf & Ri can be choosen as 10 kohm for filter design."
print fL, "=Design values for high pass section with Ap1=2 & fL(Hz) :"
Ap1=2 #band pass gain for high pass section
C=0.05 #micro F(have to choose C, 0.01<C<1)
R=round(1/(2*math.pi*fL*C*10**-6)/1000,1) #kohm
RfBYRi=(Ap-1) #op-amp gain
print C, "=Capacitance(micro F)"
print R, "=Resistance R(kohm)"
print "Value of Resistance Rf & Ri can be choosen as 10 kohm for filter design."

0 =Quality factor
As Q<10   it is wide band filter
1000 =Design values for low pass section with Ap2=2 & fH(Hz) :
0.03 =Capacitance(micro F)
5.3 =Resistance Rdash(kohm)
Value of Resistance Rf & Ri can be choosen as 10 kohm for filter design.
200 =Design values for high pass section with Ap1=2 & fL(Hz) :
0.05 =Capacitance(micro F)
15.9 =Resistance R(kohm)
Value of Resistance Rf & Ri can be choosen as 10 kohm for filter design.


## Ex3.12:pg-150¶

In :
#Ex 3.12
import math
fo=1.2*1000 #Hz
Q=4 #Quality factor
Ap=10 #band pass gain
C=0.05 #micro F(have to choose C, 0.01<C<1)
R2=round(2*Q/(2*math.pi*fo*C*10** -6)/1000,2) #kohm
R1=round(R2/2/Ap,2) #kohm
R3=round(R1/(4*math.pi**2*R1*1000*R2*1000*(C*10** -6)** 2*fo** 2-1),2) #kohm
print  "Design values are :"
print  C,"=  Capacitance(micro F)"
print  R1,"=  Resistance R1(kohm)"
print  R2,"=  Resistance R2(kohm)"
print  R3*1000,"=  Resistance R3(ohm)"
#Answer in the book is wrong for R3.

Design values are :
0.05 =  Capacitance(micro F)
1.06 =  Resistance R1(kohm)
21.22 =  Resistance R2(kohm)
480.0 =  Resistance R3(ohm)


## Ex3.13:pg-153¶

In :
#Ex 3.13
import math
fH=100 #Hz
fL=1*1000 #Hz
print  "This filter is a combination of -:"
print  "High pass filter having fH=100 Hz"
print  "Low pass filter having fL=1 kHz"
print  "And a summing amplifier"
#High pass filter
print  "Design values for high pass section :"
C=0.05 #micro F(have to choose C, 0.01<C<1)
R=round(1/(2*math.pi *fL*C*10 **-6)/1000,2) #kohm
Ap=2 #assumed
#Rf=Ri #for gain=2
Rf=10 #kohm(assumed)
Ri=10 #kohm(assumed)
print  C,"=  Capacitance(micro F)"
print  R,"=  Resistance R(kohm)"
print  "Value of Resistance Rf & Ri can be choosen as 10 kohm for filter design."
#Low pass filter
print  "Design values for low pass section :"
C=0.1 #micro F(have to choose C, 0.01<C<1)
Rdash=round(1/(2*math.pi *fH*C*10 **-6)/1000,2) #kohm
Ap=2 #assumed
#Rfdash=Ridash #for gain=2
Rf_dash=10 #kohm(assumed)
Ri_dash=10 #kohm(assumed)
print  C,"=  Capacitance(micro F)"
print  Rdash,"=  Resistance Rdash(kohm)"
print  "Value of Resistance Rf_dash & Ri_dash can be choosen as 10 kohm for filter design."

This filter is a combination of -:
High pass filter having fH=100 Hz
Low pass filter having fL=1 kHz
And a summing amplifier
Design values for high pass section :
0.05 =  Capacitance(micro F)
3.18 =  Resistance R(kohm)
Value of Resistance Rf & Ri can be choosen as 10 kohm for filter design.
Design values for low pass section :
0.1 =  Capacitance(micro F)
15.92 =  Resistance Rdash(kohm)
Value of Resistance Rf_dash & Ri_dash can be choosen as 10 kohm for filter design.


## Ex3.14:pg-156¶

In :
#Ex 3.14
import math
fN=50  #Hz
C=0.5  #micro F(have to choose C, 0.01<C<1)
R=round(1/(2*math.pi*fN*C*10 **-6)/1000,2)  #kohm
print "Design values are : "
print C ,"= Capacitance(micro F) "
print R ,"= Resistance R(kohm) "

Design values are :
0.5 = Capacitance(micro F)
6.37 = Resistance R(kohm)


## Ex3.15:pg-157¶

In :
#Ex 3.15
import math
fo=1*1000#Hz
fo_dash=1.5*1000#Hz
C=0.01#micro F(have to choose C, 0.01<C<1)
R=round(1/(2*math.pi*fo*C*10**-6)/1000,3)#kohm
K=1.2*1000/fo_dash#scaling factor
Rdash=round(K*R,3)#/kohm
print "Design values are :"
print C,"= Capacitance(micro F)"
print R,"= Resistance R(kohm)"
print Rdash,"= Resistance Rdash(kohm)"

Design values are :
0.01 = Capacitance(micro F)
15.915 = Resistance R(kohm)
12.732 = Resistance Rdash(kohm)


## Ex3.16:pg-179¶

In :
#Ex 3.16
Vf=0.0125 #V
Vo=0.5 #V
Beta=Vf/Vo #unitless
#A*Beta=1 for oscillation
A=1/Beta #gain
print A,"= Minimum Gain"

40.0 = Minimum Gain


## Ex3.17:pg-179¶

In :
#Ex 3.17
import math
R=50#kohm(R1=R2=R3=R)
C=60#pF(C1=C2=C3=C)
f=round(1/(2*math.pi*R*1000*C*10**-12*math.sqrt(6)),2)#Hz
print round(f/1000,3),"= Frequency of oscillation(kHz)"

21.658 = Frequency of oscillation(kHz)


## Ex3.18:pg-185¶

In :
#Ex 3.18
import math
f=2*1000#Hz
R=10#kohm(Assumed)(R1=R2=R)
C=1/(2*math.pi*R*1000*f)#F
print "Value of resistance R1=R2 can be choosen as 10 kohm"
print round(C*10**9,2),"= Cpacitance(nF)"
print "Value of resistance R4 can be choosen as 10 kohm & R3=2*R4=20 kohm for Beta to be 1/3"

Value of resistance R1=R2 can be choosen as 10 kohm
7.96 = Cpacitance(nF)
Value of resistance R4 can be choosen as 10 kohm & R3=2*R4=20 kohm for Beta to be 1/3


## Ex3.19:pg-185¶

In :
#Ex 3.19
import math
R=200#kohm(R1=R2=R)
C=200#pF(C1=C2=C)
f=1/(2*math.pi*R*1000*C*10**-12)#Hz
print round(f*10**-3,3),"= Frequency of oscillation(kHz)"
#Answer in the book is wrong

3.979 = Frequency of oscillation(kHz)


## Ex3.20:pg-187¶

In :
 #Ex 3.20
import math
import numpy
omegaBYomega0=[0, 0.5, 1, 5, 10, 100]
T=numpy.zeros(6);
G=numpy.zeros(6);
A=numpy.zeros(6);
f=numpy.zeros(6);
#T=omega0/sqrt(omega0**2+omega**2)  #Gain
for i in range(0,6):
T[i]=round(1/sqrt(1**2+omegaBYomega0[i]**2),3)  #Gain
G[i]=round(20*math.log10(T[i]),2)  #dB
A[i]=round(-20*math.log10(T[i]),2)  #dB
f[i]=round(-math.atan(omegaBYomega0[i])*180/math.pi,2)  #degree

print  "omega/omega0  T(j*omega)  (G(dB))  A(dB) f"
for i in range(0,6):
print omegaBYomega0[i],"\t\t\t\t",T[i],"\t\t\t\t",G[i],"\t\t\t\t",A[i],"\t\t\t\t",f[i]

omega/omega0  T(j*omega)  (G(dB))  A(dB) f
0 				1.0 				0.0 				-0.0 				-0.0
0.5 				0.894 				-0.97 				0.97 				-26.57
1 				0.707 				-3.01 				3.01 				-45.0
5 				0.196 				-14.15 				14.15 				-78.69
10 				0.1 				-20.0 				20.0 				-84.29
100 				0.01 				-40.0 				40.0 				-89.43


## Ex3.21:pg-188¶

In :
#Ex 3.21
import math
T1=round(1/math.sqrt(1+omega1**6))#Transfer function
T2=round(1/math.sqrt(1+omega2**6),3)#Transfer function
T3=round(1/math.sqrt(1+omega3**6),3)#Transfer function
f1=-math.atan((2*omega1-omega1**3)/real(1-2*omega1**2))*180/math.pi#degree
f2=-math.atan((2*omega2-omega2**3)/real(1-2*omega2**2))*180/math.pi#degree
f3=-math.atan((2*omega3-omega3**3)/real(1-2*omega3**2))*180/math.pi#degree
print "Value of T= ",T1,"& f1 for 0.1 rad/s:",round(f1,1),"degree"
print "Value of T= ",T2,"& f2 for 1 rad/s: ",f2-180,"degree"
print "Value of T= ",T3,"& f3 for 10 rad/s: ",round(f3,2),"degree"

Value of T=  1.0 & f1 for 0.1 rad/s: -11.5 degree
Value of T=  0.707 & f2 for 1 rad/s:  -135.0 degree
Value of T=  0.001 & f3 for 10 rad/s:  -78.52 degree


## Ex3.22:pg-189¶

In :
 #Ex 3.22
import math
f0=10*1000 #Hz(3-dB frequency)
DCgain=10 #dc gain
R1=10 #kohm
R2=DCgain*R1 #kohm
C=round(1/(2*math.pi*f0*R2*1000)*10**9,3) #nF
print "Design values are :"
print R2,"= Resistance R2(kohm) "
print C,"= Capacitance C(nF)"

Design values are :
100 = Resistance R2(kohm)
0.159 = Capacitance C(nF)


## Ex3.23:pg-190¶

In :
 #  Ex 3.23
import math
f0=100 #  Hz(3-dB frequency)
Ri_inf=100 #  kohm(High frequency input resistance)
Tinf=1 #  high frequency gain
R1=Ri_inf #  kohm
R2=Tinf*R1 #  kohm
C=round(1/(2*math.pi*f0*R2*1000)*10**9,1) #nF
print "Design values are :"
print R2,"= Resistance R1=R2(kohm) "
print C,"= Capacitance C(nF)"

Design values are :
100 = Resistance R1=R2(kohm)
15.9 = Capacitance C(nF)


## Ex3.24:pg-190¶

In :
# Ex 3.24
import math
Ap=12 # dB(Pass band gain)
G=round(10**(Ap/20)) # gain(unitless)
Ri=100 # kohm(as high input impedence required)
R1=Ri # kohm
# Low pass filter design
ALP=-1
AHP=-4 # (to satisfy R2<=100 # kohm)
R2=-ALP*R1 # kohm
f0=10*1000 # Hz(3-dB frequency)
C=round(1/(2*math.pi*f0*R2*1000)*10**9,3) # nF
print "Design values for low pass filter "
print R2,"= Resistance R1=R2 in kohm "
print C,"= Capacitance C(nF)"
# High pass filter design
R3=25 # kohm(Assumed)
R4=-AHP*R3 # kohm
f0=100 # Hz(3-dB frequency)
C=round(1/(2*math.pi*f0*R3*1000)*10**9,1) # nF
print "Design values for high pass filter "
print R4,",",R3,"= Resistance R3 & R4 in kohm respectively "
print C,"= Capacitance C(nF)"

Design values for low pass filter
100 = Resistance R1=R2 in kohm
0.159 = Capacitance C(nF)
Design values for high pass filter
100 , 25 = Resistance R3 & R4 in kohm respectively
63.7 = Capacitance C(nF)


## Ex3.25:pg-192¶

In :
 #Ex 3.25
import math
C=10.0 #nF
R1=(math.tan(-fi1/2)/(C*10**-9*omega)/1000) #kohm
R2=math.tan(-fi2/2)/(C*10**-9*omega)/1000 #kohm
R3=math.tan(-fi3/2)/(C*10**-9*omega)/1000  #kohm
R4=math.tan(-fi4/2)/(C*10**-9*omega)/1000 #kohm
print "For phase shift=-30 degree, Resistance(kohm=",round(R1,2)
print "For phase shift=-90 degree, Resistance(kohm)=",round(R2,2)
print "For phase shift=-120 degree, Resistance(kohm)=",round(R3,2)
print "For phase shift=-150 degree, Resistance(kohm)=",round(R4,2)

For phase shift=-30 degree, Resistance(kohm= 2.68
For phase shift=-90 degree, Resistance(kohm)= 10.0
For phase shift=-120 degree, Resistance(kohm)= 17.32
For phase shift=-150 degree, Resistance(kohm)= 37.32


## Ex3.26:pg-194¶

In :
 # Ex 3.26
import math
fi1=math.atan(omega2/omega0)-math.atan(omega2/-omega0) # degree
fi2=math.atan(omega1/omega0)-math.atan(omega1/-omega0) # degree
print "For omega=0 phase shift(degree)=",int(fi1*180/math.pi)
print "For omega=infinity phase shift(degree)=",int(fi2*180/math.pi)

For omega=0 phase shift(degree)= 180
For omega=infinity phase shift(degree)= 0


## Ex3.28:pg-197¶

In :
#Ex 3.28
import math
f0=1*1000 #Hz
BW=2*math.pi*50 #Hz
C=10 #nF
Q=2*math.pi*f0/BW #quality factor
R=1/(2*math.pi*f0*C*10**-9)/1000 #kohm
R1=10 #kohm(Assumed)
RF=10 #kohm(Assumed)
R3BYR2=2*Q-1
R2=10 #kohm(Assumed)
R3=R3BYR2*R2 #kohm
print "Design values for KHN circuit:"
print RF,",",R1,"= Use Resistance R1 & RF in kohm"
print R2,"= Use Resistance R2 in kohm"
print R3,"= Resistance R3 in kohm"
K=2-1/Q #scaling factor
CenterFrequency=K*Q
print CenterFrequency,"= CenterFrequency "

Design values for KHN circuit:
10 , 10 = Use Resistance R1 & RF in kohm
10 = Use Resistance R2 in kohm
390.0 = Resistance R3 in kohm
39.0 = CenterFrequency