#Example 4.1
#Design a Compensating Network for the opamp LM307.
#The opamp uses +10 V and -10 V supply voltages.
#Variable declaration
V=10 #Supply voltage
Vio=10*10**-3 #Input offset voltage
Rc=10 #Assumption
#calculation
Rb=(V/Vio)*Rc
Ra=Rb/2.5 #Since Rb>Rmax,let us choose Rb=10*Rmax where Rmax=Ra/4
#Result
print "Resistance Rb is",Rb/10**3,"kilo ohms"
print "Resistance Ra is ",Ra/10**3,"kilo ohms"
#Example 4.2
#The opamp in the circuit of figure 4-13 is the LM307 with Vio=10 mV dc maximum.
#What is the maximum possible output offset voltage, Voo, caused by
#the input offset voltage Vio?
#Variable declaration
R1=1*10**3
Rf=10*10**3
Vio=10*10**-3 #Input offset voltage
#calculation
Aoo=1+Rf/R1 #To find max value of Voo,we reduce input voltage vin to zero.
Voo=Aoo*Vio #Max output offset voltage
#Result
print "Max output offset voltage is",Voo*10**3,"milli Volts"
#Example 4.3
#Design an input offset voltage-compensating network for the circuit in
#figure 4-13
from __future__ import division #to perform decimal division
#Variable declaration
R1=1*10**3
Rf=10*10**3
Rc=10
#calculation
Af=1+Rf/(R1+Rc) #Closed loop gain of non-inverting amplifier
#Result
print "Closed loop gain of non-inverting amplifier is",round(Af)
#Example 4.4
#a) For the inverting amplifier of Figure 4-19, determine the maximum possible
#output offset voltage due to input offset voltage Vio and input bias current Ib
#The opamp is a type 741.
#b) What value of ROM is needed to reduce the effect of input bias current Ib.
from __future__ import division #to perform decimal division
#Variable declaration
R1=470
Rf=47*10**3
Vio=6*10**-3 #Input offset voltage
Ib=500*10**-9 #Input bias current
Vs=15 #Supply voltage
#calculation
Voo=(1+Rf/R1)*Vio #Max output offset voltage due to input offset voltage Vio
VoIb=Rf*Ib #Max output offset voltage due to input offset voltage Ib
ROM=R1*Rf/(R1+Rf) #Parallel combination of R1 and Rf
#Result
print "Max output offset voltage due to Vio is",round(Voo*10**3),"milli Volts"
print "Max output offset voltage due to Ib is ",round(VoIb*10**3,1),"milli Volts"
print "Parallel combination of R1 and Rf,i.e ROM is ",round(ROM,2),"Ohms"
#Example 4.5
#Repeat example 4.4 if R1 replaced by 1 kilo Ohm and Rf replaced by 100 kilo Ohm
from __future__ import division #to perform decimal division
#Variable declaration
R1=1*10**3
Rf=100*10**3
Vio=6*10**-3 #Input offset voltage
Ib=500*10**-9 #Input bias current
Vs=15 #Supply voltage
#calculation
Voo=(1+Rf/R1)*Vio #Max output offset voltage due to input offset voltage Vio
VoIb=Rf*Ib #Max output offset voltage due to input offset voltage Ib
ROM=R1*Rf/(R1+Rf) #Parallel combination of R1 and Rf
#Result
print "Max output offset voltage due to Vio is",round(Voo*10**3),"milli Volts"
print "Max output offset voltage due to Ib is ",round(VoIb*10**3,1),"milli Volts"
print "Parallel combination of R1 and Rf,i.e ROM is ",round(ROM,2),"Ohms"
#Example 4.6
#For the inverting amplifier in figure 4-21, determine the maximum output offset
#voltage VoIio caused by the input offset current Iio.
#The opamp is a type 741
from __future__ import division #to perform decimal division
#Variable declaration
Iio=200*10**-9 #Input offset current
Rf=100*10**3
#calculation
VoIio=Rf*Iio #Max output offset voltage due to input offset voltage Ib
#Result
print "Max output offset voltage due to Ib is ",round(VoIio*10**3),"milli Volts"
#Example 4.7
#Compute the maximum possible output offset voltages in the amplifier circuits
#shown in the figure 4-22. The opamp is MC1536 with the following specifications.
#Vio=7.5 mV maximum, Iio=50 nA maximum,Ib=250 nA maximum at TA=25 degree celcius
from __future__ import division #to perform decimal division
#Variable declaration
R1=1*10**3
Rf=10*10**3
Vio=7.5*10**-3 #Max input offset voltage
Iio=50*10**-9 #Max input offset current
Ib=250*10**-9 #Max input bias current
#calculation
# For figure 4.22(a)
VooT1=(1+Rf/R1)*Vio+(Rf*Ib) #Since the current generated output offset voltage is due to input bias current Ib
# For figure 4.22(b)
VooT2=(1+Rf/R1)*Vio+(Rf*Iio) #Since the current generated output offset voltage is due to input offset current Ib
#Result
print "Max output offset voltage due to Ib is ",VooT1*10**3,"milli Volts"
print "Max output offset voltage due to Iio is ",VooT2*10**3,"milli Volts"
#Example 4.8_a
#Refer to the inverting amplifier in figure 4-24. The opamp is the LM307 with
#the following specifications.
#delta_Vio/delta_T =30 microVolt/degree celcius maximum
#delta_Iio/delta_T= 300 pA/degree celcius
#Vs=15 V, R1=1 Kilo Ohm, Rf=100 Kilo Ohm,Rl=10 Kilo Ohm
#Assume that the amplifier is nulled at 25 degree celcius. Calculate the value
#of the error voltage Ev and output voltage at 35 degree celcius if
#a) Vin= 1 mV dc
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=30*10**-6 #Change in input offset voltage
delta_T=1 #Unit change in temperature
delta_Iio=(300*10**-12) #Change in input offset current
Vs=15
R1=1*10**3
Rf=100*10**3
Rl=10*10**3
Vin=1*10**-3 #Input voltage
k=25 #Amplifier is nulled at 25 deg
T=35-k #Change in temperature
#calculation
Ev=(1+Rf/R1)*(delta_Vio/delta_T)*T + Rf*(delta_Iio/delta_T)*T #Error voltage
Vo1=-(Rf/R1)*Vin+Ev #Output voltage
Vo2=-(Rf/R1)*Vin-Ev #Output voltage
#Result
print "Error voltage is ",round(Ev*10**3,1),"mV"
print "Output voltage 1 is ",round(Vo1*10**3,1),"mV"
print "Output voltage 2 is ",round(Vo2*10**3,1),"mV"
#Example 4.8_b
#Refer to the inverting amplifier in figure 4-24. The opamp is the LM307 with
#the following specifications.
#delta_Vio/delta_T =30 microVolt/degree celcius maximum
#delta_Iio/delta_T= 300 pA/degree celcius
#Vs=15 V, R1=1 Kilo Ohm, Rf=100 Kilo Ohm,Rl=10 Kilo Ohm
#Assume that the amplifier is nulled at 25 degree celcius. Calculate the value
#of the error voltage Ev and output voltage at 35 degree celcius if
#a) Vin= 10 mV dc
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=30*10**-6 #Change in input offset voltage
delta_T=1 #Unit change in temperature
delta_Iio=(300*10**-12) #Change in input offset current
Vs=15
R1=1*10**3
Rf=100*10**3
Rl=10*10**3
Vin=10*10**-3 #Input voltage
k=25 #Amplifier is nulled at 25 deg
T=35-k #Change in temperature
#calculation
Ev=(1+Rf/R1)*(delta_Vio/delta_T)*T + Rf*(delta_Iio/delta_T)*T #Error voltage
Vo1=-(Rf/R1)*Vin+Ev #Output voltage
Vo2=-(Rf/R1)*Vin-Ev #Output voltage
#Result
print "Error voltage is ",round(Ev*10**3,1),"mV"
print "Output voltage 1 is ",round(Vo1*10**3,1),"mV"
print "Output voltage 2 is ",round(Vo2*10**3,1),"mV"
#Example 4.8_a
#Design of Compensating Network
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=30*10**-6 #Change in input offset voltage
delta_T=1 #Unit change in temperature
delta_Iio=(300*10**-12) #Change in input offset current
Vs=15
R1=1*10**3
Rf=100*10**3
Rl=10*10**3
Vin=1*10**-3 #Input voltage
k=25 #Amplifier is nulled at 25 deg
T=35-k #Change in temperature
#calculation
Ev=(1+Rf/R1)*(delta_Vio/delta_T)*T + Rf*(delta_Iio/delta_T)*T #Error voltage
Vo1=-(Rf/R1)*Vin+Ev #Output voltage
Vo2=-(Rf/R1)*Vin-Ev #Output voltage
#Result
print "Error voltage is ",Ev,"Volts"
print "Output voltage 1 is ",Vo1,"Volts"
print "Output voltage 2 is ",Vo2,"Volts"
#Example 4.9_a
#Refer again to the amplifier circuit in figure 4-24.Use the same circuit
#specifications that are given in example 4-8. Assume that the amplifier is
#nulled at 25 degree celcius. If Vin is a 10 mV peak sine wave at 1 kilo Hz
#Calculate Ev and Vo at 55 degree celcius.
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=30*10**-6 #Change in input offset voltage
delta_T=1 #Unit change in temperature
delta_Iio=(300*10**-12) #Change in input offset current
Vs=15
R1=1*10**3
Rf=100*10**3
Rl=10*10**3
Vin=10*10**-3 #Input voltage
k=25 #Amplifier is nulled at 25 deg
T=55-k #Change in temperature
#calculation
Ev=(1+Rf/R1)*(delta_Vio/delta_T)*T + Rf*(delta_Iio/delta_T)*T #Error voltage
Vo1=-(Rf/R1)*Vin+Ev #Output voltage
Vo2=-(Rf/R1)*Vin-Ev #Output voltage
#Result
print "Error voltage is ",round(Ev*10**3,1),"mV"
print "Output voltage 1 is ",round(Vo1*10**3,1),"mV"
print "Output voltage 2 is ",round(Vo2*10**3,1),"mV"
#Example 4.9_b
#Refer again to the amplifier circuit in figure 4-24.Use the same circuit
#specifications that are given in example 4-8. Assume that the amplifier is
#nulled at 25 degree celcius. If Vin is a 10 mV peak sine wave at 1 kilo Hz
#Draw the output voltage waveform at 55 degree celcius.
from __future__ import division #to perform decimal division
%matplotlib inline
from matplotlib.pyplot import ylabel, xlabel, title, plot, show
import matplotlib.pyplot as plt
import math
import numpy as np
#calculation
x=np.arange(0,2*math.pi,0.1) #x coordinate
y=-1000*np.sin(x)+91.8 #y coordinate
#result
plt.plot(x,y)
plt.ylabel('voltage')
plt.xlabel('time')
plt.title(r'$output waveform$')
plt.show()
#Example 4.10_a
#Repeat example 4-8 for the noniverting amplifier shown in figure 4-26.
#Assume that Rc<<R1.
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=30*10**-6 #Change in input offset voltage
delta_T=1 #Unit change in temperature
delta_Iio=(300*10**-12) #Change in input offset current
Vs=15
R1=1*10**3
Rf=100*10**3
Rl=10*10**3
Vin=1*10**-3 #Input voltage
k=25 #Amplifier is nulled at 25 deg
T=35-k #Change in temperature
#calculation
Ev=(1+Rf/R1)*(delta_Vio/delta_T)*T + Rf*(delta_Iio/delta_T)*T #Error voltage
Vo1=(1+Rf/R1)*Vin+Ev #Output voltage
Vo2=(1+Rf/R1)*Vin-Ev #Output voltage
#Result
print "Error voltage is ",round(Ev*10**3,1),"mV"
print "Output voltage 1 is ",round(Vo1*10**3,1),"mV"
print "Output voltage 2 is ",round(Vo2*10**3,1),"mV"
#Example 4.10_b
#Repeat example 4-8 for the noniverting amplifier shown in figure 4-26.
#Assume that Rc<<R1.
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=30*10**-6 #Change in input offset voltage
delta_T=1 #Unit change in temperature
delta_Iio=(300*10**-12) #Change in input offset current
Vs=15
R1=1*10**3
Rf=100*10**3
Rl=10*10**3
Vin=10*10**-3 #Input voltage
k=25 #Amplifier is nulled at 25 deg
T=35-k #Change in temperature
#calculation
Ev=(1+Rf/R1)*(delta_Vio/delta_T)*T + Rf*(delta_Iio/delta_T)*T #Error voltage
Vo1=(1+Rf/R1)*Vin+Ev #Output voltage
Vo2=(1+Rf/R1)*Vin-Ev #Output voltage
#Result
print "Error voltage is ",round(Ev*10**3,1),"mV"
print "Output voltage 1 is ",round(Vo1*10**3,1),"mV"
print "Output voltage 2 is ",round(Vo2*10**3,1),"mV"
#Example 4.11_a
#The amplifier in figure 4-28(b) is nulled when the low dc supply voltage is
#20 mV.
#Because of poor regulation,low dc voltage varies with time from 18 V to 22 V.
#a) Determine the change in the output offset voltage caused by the change in
#supply voltages
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=15.85*10**-6 #Change in input offset voltage
delta_V=1 #Unit change in supply voltage
V=2 #Change in supply voltage
R1=1*10**3
Rf=100*10**3
#calculation
delta_Voo=(1+Rf/R1)*(delta_Vio/delta_V)*V #Change in output offset voltage
#Result
print "Change in Output offset voltage is ",round(delta_Voo*10**3,2),"mV"
#Example 4.11_b
#The amplifier in figure 4-28(b) is nulled when the low dc supply voltage is
#20 mV.
#Because of poor regulation,low dc voltage varies with time from 18 V to 22 V.
#b) Determine the output voltage Vo if Vin=10 mV dc. The opamp is the LM307
#with SVRR=96 dB.
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=15.85*10**-6 #Change in input offset voltage
delta_V=1 #Unit change in supply voltage
V=2 #Change in supply voltage
R1=1*10**3
Rf=100*10**3
Vin=10*10**-3
#calculation
delta_Voo=(1+Rf/R1)*(delta_Vio/delta_V)*V #Output offset voltage
Vo1=(-Rf/R1)*Vin+delta_Voo #Total output offset voltage 1
Vo2=(-Rf/R1)*Vin-delta_Voo #Total output offset voltage 2
#Result
print "Total Output offset voltage 1 is ",round(Vo1*10**3,1),"mV"
print "Total Output offset voltage 2 is ",round(Vo2*10**3,1),"mV"
#Example 4.11_b
#Design of Compensating Network
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=15.85*10**-6 #Change in input offset voltage
delta_V=1 #Unit change in supply voltage
V=2 #Change in supply voltage
R1=1*10**3
Rf=100*10**3
Vin=10*10**-3
#calculation
delta_Voo=(1+Rf/R1)*(delta_Vio/delta_V)*V #Output offset voltage
Vo1=(-Rf/R1)*Vin+delta_Voo #Total output offset voltage 1
Vo2=(-Rf/R1)*Vin-delta_Voo #Total output offset voltage 2
#Result
print "Total Output offset voltage 1 is ",round(Vo1,4),"Volts"
print "Total Output offset voltage 2 is ",round(Vo2,4),"Volts"
#Example 4.12
#Referring to figure 4-28(b), suppose that the circuit is nulled when the voltage
#across terminals +Vcc and -Vee measures 20 V dc. Also suppose that because of
#poor filtering, 10 mV rms ac ripple is measured across terminals +Vcc and -Vee.
#While the input signal Vin=0V, how much ripple voltage can we expect at the
#output if the opamp is the LM307.
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=15.85*10**-6 #Change in input offset voltage
delta_V=1 #Unit change in supply voltage
V=10*10**-3 #Change in supply voltage
R1=1*10**3
Rf=100*10**3
#calculation
delta_Voo=(1+Rf/R1)*(delta_Vio/delta_V)*V #Output offset voltage
#Result
print "Change in Output offset voltage 1 is ",round(delta_Voo*10**6),"uV rms"
#Example 4.13
#Suppose that the circuit in figure 4-24 is initially nulled. Assume also that
#room temperature and the voltage terminals +Vcc and -Vee remain constant.
#Determine the maximum possible chnage in output offset voltage after one month
#if the opamp is the LH0041C.
#Assume that R1=1kilo Ohm, Rf=100 kilo Ohm and Rl=10 kilo Ohm.
from __future__ import division #to perform decimal division
#Variable declaration
delta_Vio=5*10**-6 #Change in input offset voltage
delta_t=1 #Unit change in time
delta_Iio=2*10**-9 #Change in input offset current
t=4 #Time elapsed(weeks)
R1=1*10**3
Rf=100*10**3
Rl=10*10**3
#calculation
delta_Voot=(1+Rf/R1)*(delta_Vio/delta_t)*t+Rf*(delta_Iio/delta_t)*t #Output offset voltage
#Result
print "Change in Output offset voltage 1 is ",round(delta_Voot*10**3,2),"mV"