Chapter 2 Applications Of Operational Amplifier¶

Example 1 Page No: 2.86¶

In [1]:
#given
Rf=10;#ohm
gain1=0.1;
gain2=1;
gain3=10;
#determine r1,r1,r3

print 'R1=',Rf/gain1,'kohm';
print 'R2=',Rf/gain2,'kohm';
print 'R3=',Rf/gain3,'kohm';

R1= 100.0 kohm
R2= 10 kohm
R3= 1 kohm


Example 2 Page No: 2.86¶

In [1]:
#given
v1=5;#volt
v2=2;#volt
rf1=10e3;#ohm
r1=10e3;#ohm
#determine output voltage
v0=-((-v1*rf1/r1)-(-v2*rf1/r1));#output voltage
print 'output voltage ',v0,'volt'

output voltage  3.0 volt


Example 4 Page No: 2.87¶

In [7]:
#given
r1=10e3;#ohm
rf1=20e3;#ohm
r2=5e3;#ohm
#determine gain of amplifier
a1=1+rf1/r1;#gain
a2=-rf1/r1;
print 'switch off gain ',a1+a2;
print 'switch on gain',a2;

switch off gain  1.0
switch on gain -2.0


Example 5 Page No: 2.87¶

In [10]:
#given
v1=2;#volt
v2=3;#volt
r1=1e3;#ohm
rf1=5e3;#ohm
r2=8e3;#ohm
#determine output voltage
v11=v2*r2/(r2+r1);#output voltage
print 'output voltage ',(1+rf1/r1)*(v2-v1),'volt'

output voltage  6.0 volt


Example 6 Page No: 2.90¶

In [19]:
#given
r1=2e3;#ohm
rf1=8e3;#ohm
A=45;
#determine gain
a=1+(rf1/r1)
gain=A/(1+A/a);
print 'gain amplifer ',gain

gain amplifer  4.5


Example 7 Page No: 2.91¶

In [20]:
#given
r1=1e3;#ohm
r2=100e3;#ohm
rf1=90e3;#ohm
#determine cmrr
ac=10e3/(r1+r2);#common mode gain
print 'commom mode rejection ratio ',ad/ac#error in book

commom mode rejection ratio  929.0


Example 8 Page No: 2.92¶

In [52]:
#given
ii1=2e-3;#A
rf1=2e3;#ohm
r0=2e3;#ohm
#determine output current
i0=-(ii1+(ii1*rf1)/r0)#output current

print 'output current',i0*1e3,'mA'

output current -4.0 mA


Example 10 Page No: 2.94¶

In [1]:
#given
v1=5;#volt
v2=2;#volt
r1=10e3;#ohm
rf1=r1;#ohm
#determine output voltage
v01=-v1*(rf1/r1);#output voltage
v0=-(rf1/r1)*(v01+v1)

print 'output voltage ',v0,'volt'

output voltage  -0.0 volt


Example 11 Page No: 2.95¶

In [3]:
#given
rf1=10e3;#ohm
r1=2e3;#ohm
r2=5e3;#ohm
#determine output voltage
print 'output voltage ',-rf1/r1,'v1 +',rf1/r2,'v2'

output voltage  -5.0 v1 + 2.0 v2


Example 13 Page No: 2.97¶

In [7]:
#given
freq=1e3;#hz
#determine rf ri r1
r1=1/(2*3.14*freq*c)
print 'R1=',round(r1/1e3,3),'Kohm'
print 'Ri= 10 Kohm'
ri=10e3;
rf=(1.576-1)*ri;
print 'Rf=',rf/1000,'Kohm'

R1= 1.592 Kohm
Ri= 10 Kohm
Rf= 5.76 Kohm


Example 14 Page No: 2.97¶

In [10]:
#given
fc=3e3;#hz
q=30;
af=20;
#determine r1 r2 r3
r1=q/(2*3.14*fc*c*af)
r2=q/(2*3.14*fc*c*(2*q*q-af))
r3=q/(3.14*fc*c)/1e3;
print 'R1=',round(r1),'ohm'
print 'R2=',round(r2),'ohm'
print 'R3=',round(r3),'ohm'

R1= 796.0 ohm
R2= 9.0 ohm
R3= 32.0 ohm


Example 15 Page No: 2.98¶

In [12]:
#given
fc=1.5e3;#hz
r1=33e3;#ohm
#determine rf1
r=1/(2*3.14*fc*c)
rf1=2*r1
print 'R=  ',round(r/1e3),'Kohm'
print 'Rf1=',round(rf1/1e3),'Kohm'

R=   11.0 Kohm
Rf1= 66.0 Kohm


Example 16 Page No: 2.99¶

In [20]:
#given
f1=500;#hz
f2=2.2e3;#hz
a=5;
rf1=10e3;#ohm
#determine r1 r2
r1=1/(2*3.14*f1*c)
r2=1/(2*3.14*f2*c)
print 'R1=',round(r1/1000,2),'Kohm'
print 'R2=',round(r2,1),'ohm'

R1= 3.18 Kohm
R2= 723.8 ohm


Example 17 Page No: 2.100¶

In [54]:
#given
R=100e3;#ohm
IB=1e-6;#A
Vt=25e-3;#volt
v0=0;#volt
#determine Vin
Vin=(v0*2.3*Vt)+(R*IB);#input voltage
print "Vin ",round(Vin,3)," volt"

Vin  0.1  volt


Example 18 Page No: 2.101¶

In [24]:
#given
freq=100;#hz
#determine r1 r2
r2=29;#assume
r1=((0.065/(freq*c))*10)*r2
print 'R1=',round(r1/1e3,3),'Kohm'
print 'R2= 29    ohm'

R1= 1885.0 Kohm
R2= 29    ohm


Example 19 Page No: 2.101¶

In [56]:
#given
freq=15.9e3;#hz
a=1.5;
#determine rf1 r1
r1=1/(2*3.14*freq*c)
rf1=(a-1)*(1/(2*3.14*freq*c))#feedback resistance
print 'R=',round(r1/1e3,1),'Kohm'
print'Rf=',round(rf1/1e3,1),'Kohm'

R1= 10.0 Kohm
Rf1= 5.0 Kohm


Example 20 Page No: 2.103¶

In [25]:
#given
v1=2;#volt
v2=3;#volt
v3=6;#volt
v4=8;#volt
rf1=50e3;#ohm
r1=40e3;#ohm
r2=25e3;#ohm
r3=10e3;#ohm
r4=20e3;#ohm
#determine output voltage
v0x=-(v1*rf1/r1)-(v2*rf1/r2);
vn=12e3*v3/(r3+12e3)+(7.5e3*v4/(r4+7.5e3));
v0y=(1+rf1/(r1*r2/(r1+r2)))*vn;
print 'output voltage ',round(v0x+v0y,1),'volt'

output voltage  14.7 volt


Example 22 Page No: 2.105¶

In [4]:
#given
%matplotlib inline
from matplotlib.pyplot import plot, text, xlabel, ylabel, show, axes, title, gca
from numpy import arange, nditer
rc1=1;
vi=5;#volt
r=1e6;#ohm
#determine output voltage
v0=-(1/rc1)*(vi*5)#output voltage
from array import array
x=array('f',[0,1,2,3,4,5,6])
y=array('f',[0,-5,-10,-15,-20,-25,-30])
plot(x,y)
title("Example 22")
xlabel("t in seconds")
ylabel("output voltage in volts")
print 'output voltage ',v0,'volt';

output voltage  -25 volt


Example 23 Page No: 2.106¶

In [45]:
#given
from array import array
vi=array('f',[10e-3,100e-3,1]);
r1=1e3;#ohm
i1=10e-13;#A
#determine output voltage
w=0;
import math
while w<3 : v0=-(0.02571)*(math.log(vi[w]/(i1*r1))); print'output voltage',round(vi[w],3),round(v0,3),'volt'; w=w+1;#error in book

output voltage 0.01 -0.414 volt
output voltage 0.1 -0.474 volt
output voltage 1.0 -0.533 volt


Example 24 Page No: 2.107¶

In [37]:
#given
k1=1.38e-23;#j/k
t1=298;#k
q=1.6e-19;#columb
vi=10e-3;#volt
ri=10e3;#ohm
#determine output voltage
import math
v0=-(k1*t1/q)*0.4343*math.log(vi/ri)/2.303;#output voltage
print 'output voltage ',round(v0,3),'volt'

output voltage  0.067 volt


Example 25 Page No: 2.108¶

In [39]:
#given
rf1=10e3;#ohm
vi=1e-2;#volt
#determine output voltage
import math
v0=math.exp(-vi/26e-3)*rf1*2.167;#output voltage
print'output voltage ',round(v0,2),'volt'

output voltage  14751.04 volt


Example 26 Page No: 2.109¶

In [18]:
#given
freq=1.5e3;#hz
bw=450;#hz
#determine qualityfactor f1 f2
q=freq/bw;#quality factor
import math
f1=freq*math.sqrt(1+(1/(4*q*q)))-freq/(2*q);#lower frequency
f2=freq*math.sqrt(1+(1/(4*q*q)))+bw/2;#upper frequency
print'quality factor  ',round(q,3)
print'lower frequency ',round(f1,3),'hz'
print'upper frequency ',round(f2,3),'hz'

quality factor   3.333
lower frequency  1291.781 hz
upper frequency  1741.781 hz


Example 29 Page No: 2.109¶

In [34]:
#given
freq=200;#hz
vi=2;#volt

Rf  7.962   Kohm