#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';
#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'
#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;
#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'
#given
r1=2e3;#ohm
rf1=8e3;#ohm
A=45;
#determine gain
a=1+(rf1/r1)
gain=A/(1+A/a);
print 'gain amplifer ',gain
#given
r1=1e3;#ohm
r2=100e3;#ohm
rf1=90e3;#ohm
#determine cmrr
ac=10e3/(r1+r2);#common mode gain
ad=(rf1+r1*((r2)/(r1+r2)*2))/r1;#differential mode gaih
print 'commom mode rejection ratio ',ad/ac#error in book
#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'
#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'
#given
rf1=10e3;#ohm
r1=2e3;#ohm
r2=5e3;#ohm
#determine output voltage
print 'output voltage ',-rf1/r1,'v1 +',rf1/r2,'v2'
#given
freq=1e3;#hz
c=0.1e-6;#farad
#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'
#given
fc=3e3;#hz
q=30;
af=20;
c=0.1e-6;#farad
#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'
#given
fc=1.5e3;#hz
c=0.01e-6;#farad
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'
#given
f1=500;#hz
f2=2.2e3;#hz
a=5;
c=0.1e-6;#farad
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'
#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"
#given
freq=100;#hz
c=0.1e-6;#farad
#determine r1 r2
r2=29;#assume
r1=((0.065/(freq*c))*10)*r2
print 'R1=',round(r1/1e3,3),'Kohm'
print 'R2= 29 ohm'
#given
freq=15.9e3;#hz
a=1.5;
#determine rf1 r1
c=0.001e-6;#farad
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'
#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'
#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
c=1e-6;#farad
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';
#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
#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'
#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'
#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'
#given
freq=200;#hz
vi=2;#volt
c1=0.1e-6;#farad
freqb=2000;#hz
#determine cf1 rf1 r1
rf1=1/(2*3.14*freq*c1);#feedback resistance
r1=1/(2*3.14*c1*freqb);#input resistance
cf1=r1*c1/rf1;#feedback capacitance
print'Rf ',round(rf1/1e3,3),' Kohm'
print'R1 ',round(r1,3),'ohm'
print'Cf ',round(cf1*1e6,3),' μfarad'#error in book