## Example 18-1, Page 672¶

In [71]:
Vout=13.5                       #As per figure 18-7b(V)
Aov=100000                       #open loop voltage gain

V2=Vout/Aov                      #required input voltage(V)

print 'Required input voltage V2 = ',V2*10**6,'uV'

Required input voltage V2 =  135.0 uV


## Example 18-2, Page 672¶

In [76]:
CMRR_dB=40                          #As per figure 18-7a at 100KHz(dB)

CMRR=10**(CMRR_dB/20)

print 'Common-mode rejection ratio = ',CMRR

Common-mode rejection ratio =  100


## Example 18-3, Page 673¶

In [77]:
Av1=1000                        #Voltage gain as per figure 18-7c for 1KHZ
Av10=100                        #Voltage gain as per figure 18-7c for 10KHZ
Av100=10                        #Voltage gain as per figure 18-7c for 100KHZ

print 'Voltage gain for 1KHZ = ',Av1
print 'Voltage gain for 1KHZ = ',Av10
print 'Voltage gain for 1KHZ = ',Av100

Voltage gain for 1KHZ =  1000
Voltage gain for 1KHZ =  100
Voltage gain for 1KHZ =  10


## Example 18-4, Page 673¶

In [79]:
Vout=0.25                         #output changes in 0.1us (V)
t=0.1                             #time for output change(us)

SR=Vout/t                         #slew rate(V/us)

print 'Slew rate SR = ',SR,'V/us'

Slew rate SR =  2.5 V/us


## Example 18-5, Page 673¶

In [4]:
import math
SR=15                             #slew rate(V/us)
Vp=10                             #Peak output voltage(V)

fmax=1000*SR/(2*math.pi*Vp)        #power bandwidth (KHz)

print 'Power bandwidth = ',round(fmax),'KHz'

Power bandwidth =  239.0 KHz


## Example 18-6, Page 673¶

In [2]:
import math

SR1=0.5                           #Slew rate1(V/us)
SR2=5                             #Slew rate2(V/us)
SR3=50                            #Slew rate3(V/us)
Vp=8                              #peak voltage(V)

fmax1=1000*SR1/(2*math.pi*Vp)        #power bandwidth1 (KHz)
fmax2=1000*SR2/(2*math.pi*Vp)        #power bandwidth2 (KHz)
fmax3=SR3/(2*3*math.pi*Vp)             #power bandwidth3 (MHz)

print 'Power bandwidth1 = ',math.ceil(fmax1),'KHz'
print 'Power bandwidth2 = ',math.ceil(fmax2),'KHz'
print 'Power bandwidth3 = ',math.ceil(fmax3),'MHz'

Power bandwidth1 =  10.0 KHz
Power bandwidth2 =  100.0 KHz
Power bandwidth3 =  1.0 MHz


## Example 18-7, Page 678¶

In [90]:
Vin=10                            #input voltage(mV)
Rf=75                             #feedback path resistance Rf (KOhm)
R1=1.5                            #inverting input resistance R1(KOhm)
Funity=1                          #Funity (MHz)

Av_CL=-Rf/R1                       #closed loop voltage gain
f2_CL1=Funity/-Av_CL               #closed loop bandwidth1(KHz)
Vout1=Av_CL*Vin                    #output voltage1(mV)
Vout2=-Vin                         #output voltage2(mV)

print 'Output voltage for 1KHz = ',Vout1,'mVpp'
print 'Output voltage for 1MHz = ',Vout2,'mVpp'

Output voltage for 1KHz =  -500.0 mVpp
Output voltage for 1MHz =  -10 mVpp


## Example 18-8, Page 679¶

In [2]:
Vin=10                            #input voltage(mV)
Rf=75                             #feedback path resistance Rf (KOhm)
R1=1.5                            #inverting input resistance R1(KOhm)
Iinb=80*10**-9                    #bias current(A)
Iino =20*10**-9                   #Iin(off)  (A)
Vino=2.0                          #Vin(off) (mV)
Av=50                             #voltage gain
RB1=0                             #resistance at noninverting input(KOhm)

RB2=R1*Rf/(Rf+R1)                            #thevenin resistance at inverting input(KOhm)
V1err=(RB1-RB2)*Iinb*10**6                   #dc error input1 (mV)
V2err=(RB1+RB2)*(Iino/2)*10**6               #dc error input2 (mV)
V3err=Vino                                   #dc error input3 (mV)
Verror=Av*(abs(V1err)+V2err+V3err)           #output error voltage(mV)

print 'output error voltage Verror = ',round(Verror,2),'mV'

output error voltage Verror =  106.62 mV


## Example 18-9, Page 679¶

In [3]:
Vin=10                             #input voltage(mV)
Rf=75                              #feedback path resistance Rf (KOhm)
R1=1.5                             #inverting input resistance R1(KOhm)
Iinb=500*10**-9                    #bias current(A)
Iino =200*10**-9                   #Iin(off)  (A)
Vino=6.0                           #Vin(off) (mV)
Av=50                              #voltage gain
RB1=0                              #resistance at noninverting input(KOhm)

RB2=R1*Rf/(Rf+R1)                            #thevenin resistance at inverting input(KOhm)
V1err=(RB1-RB2)*Iinb*10**6                   #dc error input1 (mV)
V2err=(RB1+RB2)*(Iino/2)*10**6               #dc error input2 (mV)
V3err=Vino                                   #dc error input3 (mV)
Verror=Av*(abs(V1err)+V2err+V3err)           #output error voltage(mV)

print 'output error voltage Verror = ',round(Verror,2),'mV'

output error voltage Verror =  344.12 mV


## Example 18-10, Page 683¶

In [30]:
import math

Vin=50                            #input voltage(mV)
Rf=3.9*10**3                      #feedback path resistance Rf (Ohm)
R1=100                            #inverting input resistance R1(Ohm)
Funity=1*10**6                    #Funity (Hz)

Av_CL=1+(Rf/R1)                    #closed loop voltage gain
f2_CL1=Funity/Av_CL                #closed loop bandwidth1(KHz)
Av_CL1=math.ceil(10**(12/20.0))    #Av for 12 dB at 250 KHz
Vout=Av_CL1*Vin                    #output voltage(mV)

print 'Output voltage for 250KHz = ',Vout,'mVpp'

Output voltage for 250KHz =  200.0 mVpp


## Example 18-11, Page 684¶

In [2]:
Vin=10                             #input voltage(mV)
Rf=3.9*10**3                       #feedback path resistance Rf (Ohm)
R1=100                             #inverting input resistance R1(Ohm)
Iinb=500*10**-9                    #bias current(A)
Iino =200*10**-9                   #Iin(off)  (A)
Vino=6.0*10**-3                    #Vin(off) (V)
Av=40                              #voltage gain
RB1=0                              #resistance at noninverting input(KOhm)

RB2=R1*Rf/(Rf+R1)                            #thevenin resistance at inverting input(KOhm)
V1err=(RB1-RB2)*Iinb                         #dc error input1 (mV)
V2err=(RB1+RB2)*(Iino/2)                     #dc error input2 (mV)
V3err=Vino                                   #dc error input3 (mV)
Verror=Av*(abs(V1err)+V2err+V3err)           #output error voltage(mV)

print 'output error voltage Verror = ',Verror*1000,'mV'

output error voltage Verror =  242.34 mV


## Example 18-12, Page 687¶

In [4]:
Vin1=100*10**-3                            #input voltage1(V)
Vin2=200*10**-3                            #input voltage2(V)
Vin3=300*10**-3                            #input voltage3(V)
Rf=100.0                                   #feedback path resistance Rf (KOhm)
R1=20.0                                    #inverting input resistance R1(KOhm)
R2=10.0                                    #inverting input resistance R2(KOhm)
R3=50.0                                    #inverting input resistance R3(KOhm)

Av1_CL=-Rf/R1                              #closed loop voltage gain
Av2_CL=-Rf/R1                              #closed loop voltage gain
Av3_CL=-Rf/R1                              #closed loop voltage gain
Vout=Av1_CL*Vin1+Av2_CL*Vin2+Av3_CL*Vin3   #output voltage1(mV)
RB2=(R1**-1+R2**-1+R3**-1+Rf**-1)**-1      #thevenin resistance at inverting input(KOhm)

print 'Output voltage = ',Vout,'Vpp'
print 'thevenin resistance at inverting input RB2 = ',round(RB2,2),'KOhm'

Output voltage =  -3.0 Vpp
thevenin resistance at inverting input RB2 =  5.56 KOhm


## Example 18-13, Page 688¶

In [5]:
Vin=10                             #ac voltage source (mVpp)
Av=1                               #voltage gain
Funity=1                           #unity frequency (MHz)

Vout=Av*Vin                        #output voltage(V)
f2_CL=Funity                       #bandwidth(MHz)

print 'Output voltage = ',Vout,'mVpp'
print 'Bandwidth f2(CL) = ',f2_CL,'MHz'

Output voltage =  10 mVpp
Bandwidth f2(CL) =  1 MHz


## Example 18-14, Page 688¶

In [5]:
RL=1.0                             #load resistance(Ohm)
Vz=0.01                            #voltage across Zout(CL) (mV)


Load current iout =  9.99 mA