# Chapter4 - Op-amps with negative feedback¶

## Ex 4.1 - page 91¶

In :
AOL=2*10**5 #unitless
fo=5 #Hz
ACL=100 #unitless
SF=AOL/ACL #unitless
fodash=SF*fo #Hz
fodash/=1000 #kHz
print "Bandwidth with feedback is %0.2f kHz" %fodash

Bandwidth with feedback is 10.00 kHz


## Ex 4.2 - page : 99¶

In :
from __future__ import division
AOL=2*10**5 #unitless
Ri=1.5 #kohm
Rf=12 #kohm
Rio=1 #Mohm
Ro=100 #ohm
fo=5 #Hz
Beta=Ri/(Ri+Rf) #unitless
SF=(1+AOL)*Beta #unitless
ACL=AOL/SF #unitless
print "Value of ACL is %0.2f" % ACL
#In case of ideal opamp
ACL=1+Rf/Ri #unitless
print "In case of ideal opamp, Value of ACL is %0.2f " %ACL
Rif=Rio*SF #kohm
print "Value of Rif is %0.2f Mohm" %Rif
print "This is a large value can be assumed as infity resistance."
Rof=Ro/SF #ohm
Rof*=1000  #mohm
print "Value of Rof is %0.2f mohm" %Rof
fodash=SF*fo #Hz
fodash/=1000 #kHz
print "Bandwidth with feedback, fo_dash is %0.f kHz" %fodash
#Answer for Rif in the book has mistake of unit.

Value of ACL is 9.00
In case of ideal opamp, Value of ACL is 9.00
Value of Rif is 22222.33 Mohm
This is a large value can be assumed as infity resistance.
Value of Rof is 4.50 mohm
Bandwidth with feedback, fo_dash is 111 kHz


## Ex 4.3 - page : 99¶

In :
from __future__ import division
import math
AOL=float("inf") #unitless
Rio=float("inf") #ohm
Ri=1.0 #kohm
Rf=15.0 #kohm
SF=float("inf") #unitless #as SF=1+AOL*Beta
Beta=Ri/(Ri+Rf) #unitless
ACL=1/Beta #unitless
print "Input impedence(ohm) for ideal opamp is %0.2f " %Rio
print "Gain of the circuit, ACL is %0.f " %ACL

Input impedence(ohm) for ideal opamp is inf
Gain of the circuit, ACL is 16


## Ex 4.4 - page : 100¶

In :
from __future__ import division
AOL=400 #unitless
Rio=500 #kohm
Ro=75 #ohm
ACL=100 #unitlessc
SF=AOL/ACL #unitless
Rif=Rio*SF #kohm
Rif/=1000 #Mohm
print "Input impedence, Rif is %0.2f Mohm " %Rif
Rof=Ro/SF #ohm
print "Output impedence, Rof is %0.2f ohm " %Rof

Input impedence, Rif is 2.00 Mohm
Output impedence, Rof is 18.75 ohm


## Ex 4.5 - page : 100¶

In :
from __future__ import division
ACL=200.0 #unitless
AOL=2*10.0**5 #unitless
Rio=2.0 #Mohm
Ro=75 #ohm
Ri=1 #kohm(Assumed)
SF=AOL/ACL #unitless
Beta=(SF-1)/AOL #unitless
Rf=Ri*(1-Beta)/Beta #kohm
print "Input impedence, Rif is %0.f kohm" %Ri
print "Feedback impedence, Rf is %0.f kohm " %Rf

Input impedence, Rif is 1 kohm
Feedback impedence, Rf is 199 kohm


## Ex 4.6 - page : 101¶

In :
from __future__ import division
AOL=50 #unitless
Beta=0.8 #unitless
deltaAOL=-20 #%(Change in open loop gain)
deltaBeta=15 #%(Change in feedback factor)
AOLnew=AOL+AOL*deltaAOL/100 #unitless(AOL after change)
Betanew=Beta+Beta*deltaBeta/100 #unitless(Beta after change)
ACL=AOLnew/(1+AOLnew*Betanew) #unitless
print "Close loop gain, ACL is %0.2f " %ACL

Close loop gain, ACL is 1.06


## Ex 4.7 - page : 102¶

In :
from __future__ import division
AOL=500 #unitless
Rio=300 #kohm
Ro=100 #ohm
ACL=AOL/(1+AOL) #unitless
Rif=Rio*(1+AOL)/1000 #Mohm
Rof=Ro/(1+AOL) #ohm
print "Close loop gain, ACL is %0.2f " %ACL
print "Value of Rif is %0.f Mohm " %Rif
print "Value of Rof is %0.1f ohm " %Rof

Close loop gain, ACL is 1.00
Value of Rif is 150 Mohm
Value of Rof is 0.2 ohm


## Ex 4.8 - page : 111¶

In :
from __future__ import division
Iin=1 #mA
Rf=1 #kohm
IB=0 #for ideal opamp
If=Iin-IB #mA
Vout=-If*Rf #V
print "Output Voltage is %0.2f V " %Vout

Output Voltage is -1.00 V


## Ex 4.9 - page : 111¶

In :
from __future__ import division
I2=1 #mA
Rf=4.7 #kohm
#Case 1st
I1=500 #micro A
Vout1=-I1*10**-6*Rf*10**3 #V
print "For 500 uA current, Output Voltage is %0.2f V " %Vout1
#Case 2nd
I2=1 #mA
Vout2=-I2*10**-3*Rf*10**3 #V
print "For 1 mA current, Output Voltage is %0.2f V " %Vout2
deltaVout=Vout2-Vout1 #V
print "Variation in Output Voltage is %0.2f V " %deltaVout

For 500 uA current, Output Voltage is -2.35 V
For 1 mA current, Output Voltage is -4.70 V
Variation in Output Voltage is -2.35 V


## Ex 4.10 - page : 112¶

In :
from __future__ import division
AOL=2*10**5 #unitless
Rio=2 #Mohm
Ro=75 #ohm
Ri=1 #kohm
Rf=10 #kohm
ACL=-AOL*Rf/(Rf+Ri+AOL*Ri) #unitless(Exact)
print "Exact close loop voltage gain is %0.2f " %ACL
ACL=-Rf/Ri #unitless(Approximate)
print "Approximate close loop voltage gain is %0.2f " %ACL
Beta=Ri/(Ri+Rf) #unitless
SF=1+AOL*Beta #unitless
Rif=Rio*10**6/SF #ohm
print "Input impedence after feedback is %0.f ohm" %Rif
# Answer for last part wrong in the textbook.

Exact close loop voltage gain is -10.00
Approximate close loop voltage gain is -10.00
Input impedence after feedback is 110 ohm


## Ex 4.11 - page : 113¶

In :
from __future__ import division
Ri=2 #kohm
Rf=200 #kohm
#For 741C
fo=5 #Hz
AOL=2*10**5 #unitless
UGB=1 #MHz
ACL=-AOL*Rf/(Rf+Ri+AOL*Ri) #unitless(Exact)
print "Close loop voltage gain is %0.2f " %ACL
fodash=fo*AOL/-ACL #Hz
fodash/=1000   #kHz
print "Bandwidth, fo_dash is %0.f kHz " %fodash

Close loop voltage gain is -99.95
Bandwidth, fo_dash is 10 kHz


## Ex 4.12 - page : 113¶

In :
from __future__ import division
from math import sqrt
Beta=0.06 #feedback factor
fo=100 #Hz
AOL=40000 #unitless(at dc)
SFdc=1+AOL*Beta #sacrifice factor at dc
f=1 #kHz
f=f*10**3 #Hz
SF1=1+AOL*Beta/sqrt(1+f**2/fo**2) #sacrifice factor at 1 kHz
#(a)
ACL=AOL/SFdc #(unitless)exact close loop gain at dc
print "Exact close loop gain at dc is %0.2f " %ACL
#(b)
ACL=1/Beta #(unitless)approximate close loop gain at dc
print "Approximate close loop gain at dc is %0.2f " %ACL
#(c)
AOL=3980 #unitless(at dc)
ACL=AOL/SF1 #(unitless)exact close loop gain at 1kHz
print "Exact close loop gain at 1kHz is %0.2f " %ACL
# Answer not accurate in the textbook.

Exact close loop gain at dc is 16.66
Approximate close loop gain at dc is 16.67
Exact close loop gain at 1kHz is 16.60


## Ex 4.13 - page : 115¶

In :
from __future__ import division
Beta=0.04 #feedback factor
AOL=5000 #unitless(at dc)
Rio=40 #kohm
Ro=1 #kohm
SF=1+AOL*Beta #sacrifice factor at dc
Rif=Rio/SF*1000 #ohm
print "Input impedence is %0.f ohm " %Rif
Rof=Ro*1000/SF #ohm
print "Output impedence is %0.2f ohm " %Rof

Input impedence is 199 ohm
Output impedence is 4.98 ohm