In [1]:

```
from __future__ import division
# find the total offset voltage of feedback op-amp
Vos = 4 # #mV # input offset volt
Ios = 150*10**-3 # # input offset current
R1 = 5 # #kilo ohm # input resistance
R2 = 500 # #kilo ohm # feedback resistance
# the output voltage (Vo) of an op-amp circuit due to input offset voltage (Vos) is
Vo1 = ((R1+R2)/(R1)*Vos) #
print ' the output voltage (Vo) of an op-amp circuit due to input offset voltage (Vos) is = %0.2f'%Vo1,' mV '#
# the output voltage (Vo) of an op-amp circuit due to input offset current (Ios) is
Vo2 = R2*Ios #
print ' the output voltage (Vo) of an op-amp circuit due to input offset current (Ios) is = %0.2f'%Vo2,' mV '#
# the total offset voltage is
Vo = Vo1+Vo2 #
print ' the total offset voltage (Vo) of an op-amp circuit is = %0.2f'%Vo,' mV '#
```

In [2]:

```
# find the total offset voltage of feedback op-amp
Vos = 2 # #mV # input offset volt
Ios = 20*10**-3 # # input offset current
R1 = 10 # #kilo ohm # input resistance
R2 = 250 # #kilo ohm # feedback resistance
# the output voltage (Vo) of an op-amp circuit due to input offset voltage (Vos) is
Vo1 = ((R1+R2)/(R1)*Vos) #
print ' the output voltage (Vo) of an op-amp circuit due to input offset voltage (Vos) is = %0.2f'%Vo1,' mV '#
# the output voltage (Vo) of an op-amp circuit due to input offset current (Ios) is
Vo2 = R2*Ios #
print ' the output voltage (Vo) of an op-amp circuit due to input offset current (Ios) is = %0.2f'%Vo2,' mV '#
# the total offset voltage is
Vo = Vo1+Vo2 #
print ' the total offset voltage (Vo) of an op-amp circuit is = %0.2f'%Vo,' mV '#
```

In [3]:

```
from __future__ import division
# find the input offset voltage of an op-amp circuit
Vo = 90.2 # #mV # output voltage
R1 = 2 # #kilo ohm # input resistence
R2 = 150 # #kilo ohm # feedback resistence
# the input offset voltage (Vos) of an op-amp circuit is defined as
Vos = ((R1)/(R1+R2)*Vo) #
print 'the input offset voltage (Vos) of an op-amp circuit is = %0.3f'%Vos,' mV '#
```

In [4]:

```
from __future__ import division
# find the output voltage of an op-amp circuit
Vos = 1 # #mV # input offset volt
R1 = 10 # #kilo ohm # input resistance
R2 = 350 # #kilo ohm # feedback resistance
# the output voltage due to the input offset voltage of the op-amp circuit is defined by
Vo1 = ((R1+R2)/(R1)*Vos) #
print 'the output voltage due to the input offset voltage is = %0.2f'%Vo1,' mV '#
```

In [5]:

```
from __future__ import division
# Determine the bias current effect with and without current compensation method
R1 = 10 # #kilo ohm
R2 = 100 # #kilo ohm
Ib1 = 1.1*10**-3 #
Ib2 = 1*10**-3 #
# the output voltage of the circuit due to bias current is
Vo = Ib1*R2 #
print 'the output voltage of the circuit due to bias current is = %0.2f'%Vo,' V '#
#Bias compensated resistor is given by
R3 = (R1*R2)/(R1+R2) #
print 'Bias compensated resistor is = %0.2f'%R3,' kilo ohm '#
#Bias compensated output voltage is given by
Vo = R2*(Ib1-Ib2)#
print 'Bias compensated output voltage is = %0.2f'%Vo,' V '#
```

In [6]:

```
from __future__ import division
# find the input offset current of an op-amp circuit
Vo = 12*10**-3# # V # output voltage
R1 = 2*10**3 # # ohm # input resistence
R2 = 150*10**3# # ohm # feedback resistence
# the output voltage (Vo) of an op-amp circuit due to input offset current (Ios) is
# Vo = R2*Ios #
Ios = Vo/R2 *1e9 # nA
print 'the output voltage (Vo) of an op-amp circuit due to input offset current (Ios) is = %0.f'%Ios,'nA '#
```

In [7]:

```
from __future__ import division
# Determine the bias current of inverting and non-inverting
Ios = 5 # #nA # input offset current
Ib = 30 # #nA # input bias current
# the input bias current of an op-amp is
#Ib =(Ib1+Ib2)/(2)#
# the offset current Ios is define as
#Ios = abs(Ib1-Ib2) #
Ib1=Ib-(Ios/2)#
print 'The current in the inverting input terminal is = %0.2f'%Ib1,' nA '#
Ib2 =Ib+(Ios/2)#
print 'The current in the non-inverting input terminal is= %0.2f'%Ib2,' nA '#
```

In [8]:

```
from __future__ import division
#determine the feedback transfer function of an op-amp for the following condition
# a) When open loop gain of 10**5 and the closed loop gain of 100
A = 10**5 # # open loop gain
Af = 100 # #closed loop gain
# Feedback transfer function is
beta =(1/Af)-(1/A)#
print 'Feedback transfer function is = %0.2f'%beta,''#
beta = 1/beta #
print 'OR 1/Beta is = %0.2f'%beta,''#
# For an open loop gain of -10**5 and closed loop gain of -100
A = -10**5 # # open loop gain
Af = -100 # #closed loop gain
# Feedback transfer function is
beta =(1/Af)-(1/A)#
print 'Feedback transfer function is = %0.2f'%beta,''#
beta = 1/beta #
print 'OR 1/Beta is = %0.2f'%beta,''#
```

In [9]:

```
from __future__ import division
#to determine open loop gain
beta = 0.0120 # # Feedback transfer function
Af = 80 # #closed loop gain
A = (Af)/(1-beta*Af) #
print 'open loop gain is = %0.2f'%A
```

In [10]:

```
from __future__ import division
# To Determine the percent of change in the closed loop gain Af of feedback op-amp circuit
A = 10**5 # # open loop gain
Af = 50 # # close loop gain
beta = 0.01999 # # feedback transfer function
dA = 10**4 # # the change in the open llop gain
# close loop gain
dAf = ((dA)/(1+dA*beta))#
print 'close loop gain dAf is = %0.2f'%dAf
# the percent change of closed loop gain
dAf = (((Af-dAf)/(Af))*100)#
print 'the percent change of closed loop gain dAf is = %0.2f'%dAf,'%'#
```

In [11]:

```
from __future__ import division
# To Determine the bandwidth of feedback amplifier
A = 10**4 # # open loop gain
Af = 50 # # close loop gain
wH = 628 # #(2*pi*100) # rad/sec # open loop bandwidth
# close loop gain of an op-amp is defined as
# Af = ((A)/(1+A*beta))#
# the feedback transfer function is given as
beta = (1/Af)-(1/A) #
print 'the feedback transfer function beta is = %0.4f'%beta
# closed loop bandwidth
wfH = wH*(1+beta*A)#
print 'the closed loop bandwidth wfH is = %0.f'%wfH
```

In [12]:

```
from __future__ import division
# To calculate unity gain bandwidth and maximum close loop gain
A = 10**5 # # open loop gain
fo = 10 # # Hz # dominant pole frequency
fdb = 20*10**3 # #Hz # 3-db frequency
# the unity gain bandwidth
f1 = fo*A #
print 'the unity gain bandwidth is = %0.e'%f1,'Hz'#
# the maximum close loop gain
ACL = (f1/fdb) #
print 'the maximum close loop gain ACL is = %0.2f'%ACL,''#
```

In [13]:

```
from __future__ import division
# To calculate unity gain bandwidth and maximum close loop gain
A = 10**3 # # open loop gain
fo = 60 # # Hz # dominant pole frequency
fdb = 12*10**3 # #Hz # 3-db frequency
# the unity gain bandwidth
f1 = fo*A #
print 'the unity gain bandwidth is = %0.f'%(f1/1e3),'kHz'#
# the maximum close loop gain
ACL = (f1/fdb) #
print 'the maximum close loop gain ACL is = %0.2f'%ACL,''#
```

In [14]:

```
from __future__ import division
# To determine the dominant pole frequency of an op-amp
Ao = 2*10**5 # # low frequency open loop gain
f = 5*10**6 # # Hz # pole frequency
ACL = 100 # # low frequency closed lkoop gain
p_margin = 80 #
# the dominant pole frequency of an op-amp
fPD = (ACL)*(f/Ao)/1e3
print 'the dominant pole frequency (fPD) of an op-amp is = %0.1f'%fPD,'kHz'#
```

In [15]:

```
from __future__ import division
# Determine the loop gain of compensated network
C = 0.0025*10**-6 # # farad
R = 10*10**3 # # ohm
F = 1*10**6 # # Hz
Ac1 = 100 #
angle1 = 90 #
# the close loop gain of a compensated network is defined as
# Ac = Acl*Acom #
#Acom = 1/(1+%(F/FL))#
FL = 1/(2*3.14*R*C)#
print 'FL = %0.2f'%(FL/1000),' KHz '# # Round Off Error
# Acom = 1/(1+%j(F/FL))#
# After putting value of F ,FL we get
# Acom = 1/(1+%j(158.7))# # 1+%j(158.7) Rectangular Form where real part is 1 and imaginary part is 158.7
# After converting rectangular from into polar from we get
print 'Acom = [ magnitude = 6.3*10**-3 angle = -89.6 degree ]'#
# Ac = Ac1*Acom # equation 1
# after putting Ac1 and Acom value in equation 1 we get Ac1 = 100 angle 90 and Acom = 6.3*10**-3 angle = -89.6
print 'Ac = [ magnitude = 0.68 angle = 0.4 degree ]'#
```

In [16]:

```
from __future__ import division
# Determine the loop gain of compensated network
C = 0.01*10**-6 # # farad
R = 15*10**3 # # ohm
F = 1*10**6 # # Hz
# the close loop gain of a compensated network is defined as
# Ac = Acl*Acom #
#Acom = 1/(1+%(F/FL))#
FL = 1/(2*3.14*R*C)#
print 'FL = %0.1f'%(FL/1000),' KHz '# # Round Off Error
# Acom = 1/(1+%j(F/FL))#
# After putting value of F ,FL we get
# Acom = 1/(1+%j(0.9))# # 1+%j(0.9) Rectangular Form where real part is 1 and imaginary part is 0.9
# After converting rectangular from into polar from we get
print 'Acom = [ magnitude = 0.68 angle = -47.7 degree ]'#
```

In [17]:

```
from __future__ import division
# to design compensating network
fp = 500*10**3 # # pole frequency
C = 0.02*10**-6 # # F # we choose
# loop gain of compensated network
# ACom =(1)/(1+j(f/fp))
# fp = (1/2*pie*R*C)
R = (1/(2*3.14*C*fp))#
print 'The compensating resistor value is = %0.2f'%R,' ohm '#
```

In [18]:

```
from __future__ import division
# Determine the loop gain of compensated network
C = 0.0025*10**-6 # # farad
R1 = 10*10**3 # # ohm
R2 = 20*10**3 # # ohm
F = 1*10**6 # # Hz
Ac1 = 100 #
angle1 = 90 #
# the close loop gain of a compensated network is defined as
# Ac = Acl*Acom #
#Acom = (1+%(F/FH))/(1+%(F/FL))#
FH = 1/(2*3.14*R1*C)#
print 'FH = %0.2f'%(FH/1000),' KHz '# # Round Off Error
FL = 1/(2*3.14*(R1+R2)*C)#
print 'FL = %0.2f'%(FL/1000),' KHz '# # Round Off Error
#Acom = (1+%(F/FH))/(1+%(F/FL))#
# After putting value of FH ,FL we get
# Acom = (1+%j(158.7))/(1+%j(471.7)
# After converting rectangular from into polar from we get
print 'Acom = [ magnitude = 0.34 angle = -0.24 degree ]'#
# Ac = Ac1*Acom # equation 1
# after putting Ac1 and Acom value in equation 1 we get Ac1 = 100 angle 90 and Acom = 0.34 angle = -0.24
print 'Ac = [ magnitude = 34 angle = 89.76 degree ]'#
```

In [19]:

```
from __future__ import division
# Determine the loop gain of compensated network
C = 0.01*10**-6 # # farad
R1 = 10*10**3 # # ohm
R2 = 15*10**3 # # ohm
F = 1*10**6 # # Hz
# the close loop gain of a compensated network is defined as
#Acom = (1+%(F/FH))/(1+%(F/FL))#
FH = 1/(2*3.14*R1*C)#
print 'FH = %0.2f'%(FH/1000),' KHz '# # Round Off Error
FL = 1/(2*3.14*(R1+R2)*C)#
print 'FL = %0.2f'%(FL/1000),' KHz '# # Round Off Error
#Acom = (1+%(F/FH))/(1+%(F/FL))#
# After putting value of FH ,FL we get
# Acom = (1+%j(658.9))/(1+%j(1.56*10**3)
# After converting rectangular from into polar from we get
print 'Acom = [magnitude = 0.4] '#
```

In [20]:

```
from __future__ import division
# to design compensating network
fH = 10 # #k ohm # break frequency initiated by a zero
fL = 1 # #k ohm # break frequency initiated by a pole
C = 0.02# # uF # we choose
# loop gain of compensated network
# ACom =(1+j(f/fH))/(1+j(f/fL))
# fH = (1/2*pie*R1*C)
# fL = (1/2*pie*(R1+R2)*C)
R1 = (1/(2*3.14*C*fH))#
print 'The compensating first resistor R1 value is = %0.2f'%R1,' K ohm '#
R2 = ((1)/(2*3.14*C*fL))-(R1)#
print 'The compensating second resistor R2 value is = %0.2f'%R2,' K ohm '#
```

In [21]:

```
from __future__ import division
# To determine input output miller capacitances
A = 100 # #gain
Cm = 0.1 # # uF # compensated capacitor
# the input output miller capacitance are defined as
Cin = Cm*(A+1)#
print 'The input miller capacitance Cin value is = %0.2f'%Cin,'uF '#
Cout = (Cm*((A+1)/A))#
print 'The output miller capacitance Cout value is = %0.2f'%Cout,'uF '#
```

In [22]:

```
from __future__ import division
from math import pi
# To determine input output miller capacitances
A = 150 # #gain
Cm = 0.02 # # uF # compensated capacitor
# the input output miller capacitance are defined as
Cin = Cm*(A+1)#
print 'The input miller capacitance Cin value is = %0.2f'%Cin,'uF '#
Cout = (Cm*((A+1)/A))#
print 'The output miller capacitance Cout value is = %0.2f'%Cout,'uF '#
# In the miller compensating network input capacitance introduce a pole . The initiated frequency of miller compensating network by pole is define as
# fp = 1/(2*pi*R*Cin)#
R = 1 # # K ohm
fp = 1/(2*pi*R*Cout)#
print 'The initiated frequency of miller compensating network by pole is = %0.2f'%fp,' KHz '#
```

In [23]:

```
from __future__ import division
# To determine the slew rate of an op-amp
f = 1 # # MHz # unity frequency
Ic = 1*10**-6 # # uA # capacitor current
Vt = 0.7 # # V # threshold voltage
# the slew rate of an op-amp is defined as
# Slew rate = (dVo/dt)
Slewrate = 8*3.14*Vt*f #
print 'the slew rate of an op-amp is = %0.2f'%Slewrate,' V/u sec '#
# The compansated capacitance Cm is
gm = (Ic/Vt)#
Cm = (gm/4*3.14*f)*1e6 # pF
print 'The compansated capacitance value is = %0.2f'%Cm,'pF '#
```

In [24]:

```
from __future__ import division
# To determine the cut off frequency of an op-amp
f = 1*10**3 # # Hz # unity frequency
Av = 200 # # V/mV # dc gain
# the unity gain frequency of an op-amp is defined as
# f = Av*fc #
# cut off frequency
fc = (f/Av)#
print 'Cut -off frequency of an op-amp is = %0.2f'%fc,' Hz '#
```

In [25]:

```
from __future__ import division
# To find the maximum frequency of input signal in op-amp circuit
Vin = 25*10**-3 # # V # input voltage
Slewrate = 0.8/10**-6 # # V/uV # Slew rate of an op-amp
R2 = 350*10**3 # # ohm # feedback resistance
R1 = 10*10**3 # # ohm # input resistance
# the closed loop gain
# ACL = (mod (Vo/Vin)) = (mod(R2/R1))#
ACL = abs(R2/R1)#
print 'the closed loop gain ACL is = %0.2f'%ACL,' '#
# the output gain factor K is given as
K = ACL*Vin #
print 'The output gain factor K is = %0.2f'%K,' V'#
# the maximum frequency of an op-amp is
wmax = (Slewrate/K)#
fmax = wmax/(2*3.14)#
print 'The maximum frequency of an op-amp fmax = %0.2f'%(fmax/1000),' KHz'#
```

In [26]:

```
from __future__ import division
# To find the maximum frequency of op-amp circuit
Vin = 0.015 # # V # input voltage
Slewrate = 0.8 # # V/uV # Slew rate of an op-amp
R2 = 120*10**3 # # ohm # feedback resistance
R1 = 5*10**3 # # ohm # input resistance
# the closed loop gain
# ACL = (mod (Vo/Vin)) = (mod(R2/R1))#
ACL = abs(R2/R1)#
print 'the closed loop gain ACL is = %0.2f'%ACL,' '#
# the output gain factor K is given as
K = ACL*Vin #
print 'The output gain factor K is = %0.2f'%K,' V'#
# the maximum frequency of an op-amp is
wmax = (Slewrate/K)#
print 'The wmax is = %0.2f'%wmax,'*10**6 rad/sec'# # *10**6 because Slewrate is V/uV
# the signal frequency may be w = 500*10**3 rad/sec that is less than the maximum frequency value
```

In [27]:

```
from __future__ import division
# To determine the compensated capacitance of an op-amp
Slewrate = 10 # # V/u sec
Ic = 1*10**-3 # # mA # capacitor current
Vt = 0.7 # # V # threshold voltage
# the slew rate of an op-amp is defined as
# Slew rate = (dVo/dt)
# the unity frequency f is
f =(Slewrate/(8*3.14*Vt))#
f = f*10**6# # *10**6 because Slew rate is V/uV
print 'the unity frequency f is = %0.2f'%(f/1e3),'kHz '#
# The compansated capacitance Cm is
gm = (Ic/Vt)#
Cm = (gm)/(4*3.14*f)*1e9 #
print 'The compansated capacitance Cm value is = %0.1f'%Cm,'nF '#
```

In [28]:

```
from __future__ import division
# To find Slew rate of an op-amp
Iq = 15 # # uA # bias current
Cm = 30 # # pF # internal frequency compensated capacitor
Slewrate = (Iq/Cm)
print 'the Slew rate of an op-amp is = %0.2f'%Slewrate,' V/u sec'#
```

In [29]:

```
from __future__ import division
# To find Slew rate of an op-amp
Iq = 21 # # uA # bias current
Cm = 31 # # pF # internal frequency compensated capacitor
Slewrate = (Iq/Cm)#
print 'the Slew rate of an op-amp is = %0.2f'%Slewrate,' V/u sec'#
```

In [30]:

```
from __future__ import division
# To determine full power and small signal bandwidth of an op-amp with unity gain
f = 100*10**6 # # Hz unity gain bandwidth
ACL = 10**4 # # maximum closed loop gain
Slewrate = 0.51 # # V/u sec
Vp = 10 # # V peak volt
# The full power bandwidth
FPBW = (Slewrate/(2*3.14*Vp))#
FPBW = FPBW*10**6 # # *10**6 because Slew rate is V/uV
print 'The full power bandwidth FPBW is = %0.2f'%(FPBW/1e3),'kHz '#
# the 3-db frequency or small signal band width
f3db = (f/ACL)#
print 'The 3-db frequency or small signal band width f3db is = %0.f'%(f3db/1e3),'kHz '#
```

In [31]:

```
from __future__ import division
# To determine full power and small signal bandwidth of an op-amp with unity gain
f = 100*10**6 # # Hz unity gain bandwidth
ACL = 10**4 # # maximum closed loop gain
Slewrate = 0.51 # # V/u sec
Vp = 10 # # V peak volt
# The full power bandwidth
FPBW = (Slewrate/(2*3.14*Vp))#
FPBW = FPBW*10**6 # # *10**6 because Slew rate is V/uV
print 'The full power bandwidth FPBW is = %0.2f'%(FPBW/1e3),'kHz '#
# the 3-db frequency or small signal band width
f3db = (f/ACL)#
print 'The 3-db frequency or small signal band width f3db is = %0.f'%(f3db/1e3),'kHz '#
```

In [32]:

```
from __future__ import division
# To find Slew rate and closed loop gain of an op-amp
fu = 1*10**6 # # Hz # unity gain bandwidth
fmax = 5*10**3 # # KHz # full power bandwidth
F3db = 12*10**3 # # Hz # small signal bandwidth
Vp = 10 # # V # peak volt
# the full power bandwidth of an op-amp
# fmax=FPBW = (Slew rate/2*3.14*Vp)#
Slewrate = 2*3.14*Vp*fmax#
Slewrate = Slewrate*(10**-6)# # *10**-6 because Slewrate is V/u
print 'the Slew rate of an op-amp is = %0.2f'%Slewrate,' V/u sec '#
# # the 3-db frequency or small signal band width
#f3db = (f/ACL)#
#the closed loop gain ACL
ACL = fu/F3db #
print 'The closed loop gain ACL is = %0.2f'%ACL,' '#
```