Chapter 3 : Op-amp with Negative Feedback

example 3.1, Page No. 90

In [47]:
# parameters of practical invertig amplifier

import math
#VAriable declaration
R1 = 470                 # Resistor R1
Rf = 4.7*10**3           # feedback resistor
A  = 2*10**5             # Open loop gain
Rin= 2*10**6             # input resistance
Ro = 75                  # output resistance
f  = 5                   # single break frequency
V  = 15                  # dual supply voltage

#Calculations
K = Rf/(R1+Rf)
B = R1/(R1+Rf)
B = math.floor(B*10000)/10000 
Af = (-A*Rf)/(R1+Rf+R1*A)
Rinf = R1+(Rf*Rin/(Rf+Rin+A*Rin))
Rof = Ro/(1+A*B)
ff = f*(1+A*B)

#Result
print("Closed loop voltage gain with feedback = %.0f\nInput resistane with feedback = %.4f ohm"%(math.floor(Af),Rinf))
print("Output resistance with feedback = %.2f m-ohm\nBandwidth with feedback = %.3f KHz"%(Rof*1000,ff/1000))
Closed loop voltage gain with feedback = -10
Input resistane with feedback = 470.0235 ohm
Output resistance with feedback = 4.13 m-ohm
Bandwidth with feedback = 90.905 KHz

example 3.2, Page No. 91

In [24]:
# inverting Op-amp design

import math
#Variable declaration
Af = -30.0               # voltage gain
Rf = 1*10**6             # feedback resistance

#Calcaculation
R1 = -Rf/Af

#Result
print("R1 = %.2f k-ohm\nlet us choose, R1 = 30 k-ohm + 3.3 k-ohm......standard values(refer fig. 3.7)"%(R1/1000))
R1 = 33.33 k-ohm
let us choose, R1 = 30 k-ohm + 3.3 k-ohm......standard values(refer fig. 3.7)

example 3.3, Page No. 91

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

example 3.4, Page No. 95

In [29]:
# Value of feedback resistance

import math
#Variable declaration
Af = 61               # gain with feedback
R1 = 1000             # resistor R1


#Calculations
Rf = (Af-1)*R1

#Result
print("Rf = %d k-ohm"%(Rf/1000))
Rf = 60 k-ohm

example 3.5, Page No.95

In [48]:
# parameters of non-invertig amplifier

import math
#VAriable declaration
R1 = 1000.0              # Resistor R1
Rf = 10*10**3            # feedback resistor
A  = 2*10**5             # Open loop gain
Rin= 2*10**6             # input resistance
Ro = 75                  # output resistance
f  = 5                   # single break frequency
V  = 12                  # dual supply voltage

#Calculations
B = R1/(R1+Rf)
#B = math.floor(B*10000)/10000 
Af = A/(1+A*B)
Rinf = Rin*(1+A*B)
Rof = Ro/(1+A*B)
ff = f*(1+A*B)

#Result
print("Closed loop voltage gain with feedback = %.3f\nInput resistane with feedback = %.2f G-ohm"%(Af,math.floor((Rinf/10**9)*100)/100))
print("Output resistance with feedback = %.2f m-ohm\nBandwidth with feedback = %.2f KHz"%(Rof*1000,ff/1000))
Closed loop voltage gain with feedback = 10.999
Input resistane with feedback = 36.36 G-ohm
Output resistance with feedback = 4.12 m-ohm
Bandwidth with feedback = 90.91 KHz

example 3.6, Page No. 96

In [42]:
# inverter parameters

import math
#Variable declaration
A  = 2*10**5             # Open loop gain
Rin= 2*10**6             # input resistance
Ro = 75                  # output resistance
f  = 5                   # single break frequency


#Calculations
Af  = -1                 # inverter gain
Rf = 330.0               # Rf = R1, Value assumed
R1 = Rf
B = R1/(R1+Rf)
Rof = Ro/(A*B)
BW = f*(A*B)

#Result
print("Af = %.0f\nRif = %.0f ohm\nRof = %.5f ohm\nfF = %.1f MHz"%(Af,Rf,Rof,BW/10**6))
Af = -1
Rif = 330 ohm
Rof = 0.00075 ohm
fF = 0.5 MHz

example 3.7, Page No. 96

In [68]:
# parameters of invertig and non-inverting amplifier

import math
#VAriable declaration
R1_n = 1000.0            # Resistor R1 in case of non-inverting ampliflier
Rf_n = 10*10**3          # feedback resistor in case of non-inverting ampliflier
R1_i = 470.0             # Resistor R1 in case of inverting ampliflier
Rf_i = 4.7*10**3         # feedback resistor in case of inverting ampliflier
A  = 2*10**5             # Open loop gain
Ri = 2*10**6             # input resistance
Ro = 75                  # output resistance
f  = 5                   # single break frequency
V  = 15                  # dual supply voltage
Vos = 13                 # output voltage swing

#Calculations
#(i) Non-inverting amplifier
B = R1_n/(R1_n+Rf)
Af = 1+(Rf_n/R1_n)
Rinf = Ri*(1+A*B)
Rof = Ro/(1+A*B)
ff = f*(1+A*B)
ff =ff/1000        # KHz
VooT = Vos/(1+A*B)
#(ii) Inverting amplifier
B_i = R1_i/(R1_i+Rf)
Af_i = -(Rf_i/R1_i)
Rinf_i = R1_i
Rof_i = Ro/(1+A*B_i)
ff_i = f*(1+A*B_i)
ff_i =ff_i/1000        # KHz
VooT_i = Vos/(1+A*B_i)

#Result
print("(i) Non-inverting amplifier:")
print(" Closed loop voltage gain with feedback = %.0f\n Input resistane with feedback = %.4f ohm"%(math.floor(Af),Rinf/10**9))
print(" Output resistance with feedback = %.5f ohm\n Bandwidth with feedback = %.2f KHz"%(Rof,math.ceil(ff*100)/100))
print(" Total output offset voltage with feedback = +/- %.3f mV"%(VooT*1000))

print("\n(ii) Inverting amplifier:")
print(" Closed loop voltage gain with feedback = %.0f\n Input resistane with feedback = %.0f ohm"%(math.floor(Af_i),Rinf_i))
print(" Output resistance with feedback = %.5f ohm\n Bandwidth with feedback = %.2f KHz"%(Rof,math.ceil(ff*100)/100))
print(" Total output offset voltage with feedback = +/- %.3f mV"%(VooT*1000))
(i) Non-inverting amplifier:
 Closed loop voltage gain with feedback = 11
 Input resistane with feedback = 36.3656 ohm
 Output resistance with feedback = 0.00412 ohm
 Bandwidth with feedback = 90.92 KHz
 Total output offset voltage with feedback = +/- 0.715 mV

(ii) Inverting amplifier:
 Closed loop voltage gain with feedback = -10
 Input resistane with feedback = 470 ohm
 Output resistance with feedback = 0.00412 ohm
 Bandwidth with feedback = 90.92 KHz
 Total output offset voltage with feedback = +/- 0.715 mV

example 3.8, Page No. 97

In [76]:
# inverting amplifier parameters

import math
#variable declaration
Rf = 500*10**3            # feedback resistance
R1 = 5*10**3              # R1 resistance
Vi = 0.1                  # input voltage


#Calculation
Af = -Rf/R1
Ri = R1
Ro = 0
Vout = Af*Vi
Iin = Vi/R1

#Result
print("Af = %d\nRi = %d k-ohm\nRo = %d ohm\nVout = %d V\nIin = %.2f mA"%(Af,Ri/1000,Ro,Vout,Iin*1000))
Af = -100
Ri = 5 k-ohm
Ro = 0 ohm
Vout = -10 V
Iin = 0.02 mA

example 3.9, Page No.97

In [79]:
# input ippedance, Voltage gain and power gain(refer fig. 3.15)

import math
#Variable declaration
Rf = 1*10**6           # feedback resistance
Rin = 1*10**6          # input resistance

#Calculations
Av = -Rf/Rin
Ai = 1                #unity gain inverter
Ap = abs(Av*Ai)

#Result
print("(i) Given amplifier is an inverting amplifier,therefore, Av = %.0f"%Av)
print("(ii) Because it is a unity gain inverter, so Ai = %.0f"%Ai)
print("(iii) Power gain of op-amp circuit, Ap = %.0f"%Ap)
(i) Given amplifier is an inverting amplifier,therefore, Av = -1
(ii) Because it is a unity gain inverter, so Ai = 1
(iii) Power gain of op-amp circuit, Ap = 1

example 3.10, Page No. 98

In [85]:
# inverting op-amp circuit design

import math
# Variable declaartion
Av = -8                # voltage gain
Vin = -1               # input voltage
I1 = 15*10**-6         # maximum current through R1 and Rf

#Calculations
R1 = abs(Vin)/I1
R1std = 68*10**3       # standard value
Rf = -Av*R1

#Result
print("R1 = %.2f K-ohm\t\t(we use %.0f  K-ohm as standard value)"%(R1/1000,R1std/1000))
print("Rf = %f K-ohm"%(Rf/1000))
#Answer for Rf is wrong in the book
R1 = 66.67 K-ohm		(we use 68  K-ohm as standard value)
Rf = 533.333333 K-ohm

example 3.11, Page No. 98

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