Chapter 7:Operational Amplifiers

Example 7.1,Page number 361

In [9]:
#Variable declaration
V1=120                   #negative terminal Vn(uV)
V2=80                    #positive terminal Vp(uV)
Ad=10**3                 #difference mode gain


#Calculations
Vd=V1-V2                #difference mode signal(uV)  
Vc=(V1+V2)/2            #common mode signal(uV)

#Part a
CMRR=100.                    #common mode rejection ratio
Vo=Ad*Vd*(1+(Vc/(CMRR*Vd)))  #output voltage(mV)
          
#Part b
CMRR=10**5.                    #common mode rejection ratio
Vo1=Ad*Vd*(1+(1/CMRR)*(Vc/Vd)) #output voltage(mV) 

#Results
print"output voltage is",round(Vo/1E+3),"mV"
print"output voltage is",round(Vo1/1E+3),"mV"
output voltage is 41.0 mV
output voltage is 40.0 mV

Example 7.2,Page number 365

In [10]:
#Variable declaration
deltavi=0.5             #change in vi(V)
deltat=10               #change in time(us)
s=1                     #slew rate(V/us)

#Calculations
Kvf=(s*deltat)/deltavi  #closed loop gain of amplifier

#Results
print"closed loop gain of amplifier is",Kvf
closed loop gain of amplifier is 20.0

Example 7.3,Page number 365

In [18]:
import math

#Variable declaration
f=50*10**3.                  #OPAMP freequency(Hz)
Vm=0.02                      #maximum value of signal voltage(V)
S=.5*10**6                     #slew rate(V/s)

#Calculations
Kvf=S/(2*(math.pi)*f*Vm)    #closed loop gain of amplifier

#Results
print"closed loop gain of amplifier is",round(Kvf)
closed loop gain of amplifier is 80.0

Example 7.4,Page number 369

In [9]:
#Variable declaration
Ic=100              #current at quinscent point(uA)
beta=2000.          #current gain
Ad=250              #difference mode gain
CMRR=5000           #as 74 dB=5000,common mode rejection ratio(dB)

#Calculations
rpi=(25*beta)/Ic     #dynamic internal resistance(k ohms)  
gm=beta/rpi          #transconductance(mS)
Re=CMRR/gm           #emitter resistance(k ohms)
Rc=(Ad*2)/gm         #collector resistance(k ohms) from formula Ad=gmRc/2
Rin=2*rpi            #input resistance(k ohms)

#Results
print"Re is",Re,"k ohms"
print"Rc is",Rc,"k ohms"
print"input resistance is",Rin,"k ohms"
Re is 1250.0 k ohms
Rc is 125.0 k ohms
input resistance is 1000.0 k ohms

Example 7.6,Page number 371

In [3]:
#Variable declaration
Icq=.428            #current at quinscent point(uA)
beta=200.           #current gain
                    #as 74 dB=5000,common mode rejection ratio(dB)
Rc=10.              #collector resistance(k ohms)    
Re=16.              #emitter resistance(k ohms)   
Vcc=15.             #supply voltage(V)

#Calculations
#Part b
Ibq=Icq/beta         #Ib at Q(uA)
rpi=(25*beta)/Icq    #dynamic resistance(k ohms)
gm=beta/rpi          #transconductance

#Part b
vo1=Vcc-(Icq*Rc)    #terminal 1 voltage(V) 
vo2=vo1             #terminal 2 voltage(V) 

#Part c                  
Ad=(gm*Rc)/2        #differential mode gain
Ac=Rc/(2*Re)        #common mode gain
CMRR=Ad/Ac          #common mode rejection ratio

#Part d
Rid=2*rpi                     #differential input resistance(k ohms)
rpi=11.7                      #dynamic resistance(k ohms)
Ric=rpi+(2*(beta+1)*Re)       #common mode input resistance(k ohms)

#Results
print"Icq is",Icq,"mA,and Ibq is ",round((Ibq/1E-3),2),"uA"
print"vo1 and vo2 have same value as",vo1,"V"
print"",
print"Ad:",round(Ad/1E-3),",Ac:",round(Ac,3),"and CMRR is",round(CMRR/1E-3)
print"Rid is",round((Rid/1E+3),1),"K ohms and Ric is",round((Ric/1E+3),2)," Mohms"
Icq is 0.428 mA,and Ibq is  2.14 uA
vo1 and vo2 have same value as 10.72 V
 Ad: 86.0 ,Ac: 0.313 and CMRR is 274.0
Rid is 23.4 K ohms and Ric is 6.44  Mohms

Example 7.7,Page number 373

In [5]:
#Variable declaration
R1=10.                   #series resistance(K ohms)
Rf=10**3.                #feedback resistance(k ohms)   
vo=-5.                   #output voltage(V)
Ri=1000                  #input resistance(k ohms)
Av=2.5*10**5             #gain

#Calculations
v1=-vo*(R1/Rf)           #input signal voltage(V)
vi=-vo/Av                #inverting voltage(V)  
i1=((v1*10**-3)-vi)/R1   #current through R1(uA)
ii=vi/Ri                 #inverting current(uA)
iF=-ii                   #forward current(uA)

#Results
print"value of vi is",vi,"mV"
print"value of ii:",ii,"uA i1:,",i1,"uA and iF is",iF,"uA"
value of vi is 2e-05 mV
value of ii: 2e-08 uA i1:, 3e-06 uA and iF is -2e-08 uA

Example 7.8,Page number 374

In [45]:
#Variable declaration
Vs=4                    #source voltage(V)
R1=10.                   #resistance(k ohms)
Vb=Va=2                 #voltage at point A and point B
Rf=30                   #forward resistance(k ohms)

#Calculations
I=(Vs-Vb)/R1           #current(mA)
Vo=(-I*Rf)+Vb          #output voltage(V)  

#Result
print"output voltage",Vo,"V"
output voltage -4.0 V

Example 7.9,Page number 375

In [50]:
#Variable declaration
Rf=2              #as vs=2sinwt and vo=(1+Rf/Rs)*vb and vB=vA=vs
Rs=1


#Calculations
vo=(1+(Rf/Rs))*2       #output voltage(V)

#Result
print"output voltage",vo,"sinwt"
output voltage 6 sinwt

Example 7.10,Page number 377

In [6]:
#Variable declaration
Ro=100.                 #output resistance(ohms)
vo=10.                  #output voltage(V)
A=10**5.                #gain 
Ri=100*10**3            #input resistance(ohms) 
Rs=1*10**3.             #resistance(ohms)
Rl=10*10**3             #load resistance(ohms)

#Calculations
#Part i
iL=vo/Rl                  #load current(mA)
Avi=vo+(iL*Ro)            #voltage gain without feedback
vi=Avi/A                  #voltage(V)
ii=vi/Ri                  #current(A)  
vs=vo+ii*(Rs+Ri)          #source voltage(V)

#Part ii
Avf=vo/vs                #voltage gain with feedback  


#Part iii
Rif=vs/ii              #input resistance(ohms) 
Rof=Ro/A               #output resistance(ohms)

#Results
print"vs is",round(vs,4),"V"
print"vo/vs that is Avf is",Avf
print"input and output resistances are",Rif,Rof,"ohms"
vs is 10.0001 V
vo/vs that is Avf is 0.999989799104
input and output resistances are 9901091099.01 0.001 ohms

Example 7.11,Page number 382

In [6]:
#Variable declaration
Vb=Va=3                     #voltage at A and B 
R1=40*10**3.                #input resistance(ohms)
t=50*10**-3                 #time after switch is open(mS)
V1=5                        #input voltage(V)

#Calculations
#Part a
vo=-3                       #as Va=Vb=3

#Part b
i1=(V1-Vb)/R1               #input current(A)
vo1=(-250*t)-Va             #vo at 50 mS

#Result
print"output voltage",vo1,"V"
output voltage -15.5 V

Example 7.14,Page number 388

In [7]:
import math

#Variable declaration
BW=30*10**3               #specified bandwidth(k Hz)
fc=18*10**3               #centered frequency(Hz)
R1=20                     #resistance(k ohms) 
R2=180                    #resistance(k ohms)  
C=1.2*10**-9              #capacitance(F)
G=40                      #pass band gain(dB)
g=20                      #pass region gain(dB)

#Calculationsv
fc1=fc-(BW/2)             #high pass section frequency(Hz)
fc2=fc+(BW/2)             #low pass section frequency(Hz)
Rfc1=1/(2*math.pi*fc1*C)  #high pass section resistance(k ohms)
Rfc2=1/(2*math.pi*fc2*C)  #low pass section resistance(k ohms)
Gfc1=G-g                  #gain at frequency 0.3KHz(dB)
Gfc2=G-2*6                #gain at frequency 132KHz(dB)

#Results
print"R1 and R2 are",R1,"K ohms and",R2,"K ohms"
print"Rfc1 is",round(Rfc1/1E+3),"k ohms and Rfc2 is",round(Rfc2/1E+3),"k ohms"
print"filter gain at frequencies 0.3 KHz is",Gfc1,"dB and 132 k Hz are",Gfc2,"dB"
R1 and R2 are 20 K ohms and 180 K ohms
Rfc1 is 44.0 k ohms and Rfc2 is 4.0 k ohms
filter gain at frequencies 0.3 KHz is 20 dB and 132 k Hz are 28 dB

Example 7.21,Page number 402

In [11]:
#Variable declaration
R=250            #resistance(k ohms)

#Calculations
#part a
R1=-R/(-5)    #as vo=-5va+3vb(given),so when vb=0,vo/voa=-250/R1=-5

#part b
R2=R1/(2-1)   #as va=0
              #vx=(R1/R1+R)*vob=(1/6)*vb
              #vy=(R2/R1+R2)*vb
              #vx=vy
              #(1/6)*vob=(R2/R1+R2)*vb
              #vob=3vb
              #(1/6)*3=R2/(50+R2)
                
#Result
print"R1 and R2 are",R1,"K ohms and",R2,"K ohms"
R1 and R2 are 50 K ohms and 50 K ohms

Example 7.22,Page number 403

In [15]:
#Variable declaration
R1=10*10**3                       #resistance(k ohms)
C1=10**-6                         #capacitance(uF) 
C=0.1*10**-6                      #capacitance(uF) 
R=100*10**3                       #resistance(k ohms)   

#Calculations
#part b 
wc1=1/C1*R1                     #angular frequency(rad/s)
wc2=1/C*R                       #angular frequency(rad/s)
wc=wc1=wc2                      #angular frequency(rad/s)

#Results
print"wc1 is",wc1/1E+10,"rad/s"
print"wc2 is",wc2/1e+10,"rad/s"
wc1 is 100.0 rad/s
wc2 is 100.0 rad/s

Example 7.23,Page number 404

In [6]:
#Variable declaration
vo1=5                  #say (V)
K=25                   #proportionality constant  
Q=250                  #volume of fluid passed across metering point(cm^3) 
R1=2.5                  #output resistance(k ohms)

#Calculations
C1=(K*Q)/(R1*vo1)     #capacitor(nF)

#Results
print"C1 is",round(C1/1E+1),"uF"
print"vo1 is -5V when Q=250 cm^3"
C1 is 50.0 uF
vo1 is -5V when Q=250 cm^3