#Variable declaration
V1=120 #negative terminal Vn(uV)
V2=80 #positive terminal Vp(uV)
Ad=10**3 #difference mode gain
#Calculations
Vd=V1-V2 #difference mode signal(uV)
Vc=(V1+V2)/2 #common mode signal(uV)
#Part a
CMRR=100. #common mode rejection ratio
Vo=Ad*Vd*(1+(Vc/(CMRR*Vd))) #output voltage(mV)
#Part b
CMRR=10**5. #common mode rejection ratio
Vo1=Ad*Vd*(1+(1/CMRR)*(Vc/Vd)) #output voltage(mV)
#Results
print"output voltage is",round(Vo/1E+3),"mV"
print"output voltage is",round(Vo1/1E+3),"mV"
#Variable declaration
deltavi=0.5 #change in vi(V)
deltat=10 #change in time(us)
s=1 #slew rate(V/us)
#Calculations
Kvf=(s*deltat)/deltavi #closed loop gain of amplifier
#Results
print"closed loop gain of amplifier is",Kvf
import math
#Variable declaration
f=50*10**3. #OPAMP freequency(Hz)
Vm=0.02 #maximum value of signal voltage(V)
S=.5*10**6 #slew rate(V/s)
#Calculations
Kvf=S/(2*(math.pi)*f*Vm) #closed loop gain of amplifier
#Results
print"closed loop gain of amplifier is",round(Kvf)
#Variable declaration
Ic=100 #current at quinscent point(uA)
beta=2000. #current gain
Ad=250 #difference mode gain
CMRR=5000 #as 74 dB=5000,common mode rejection ratio(dB)
#Calculations
rpi=(25*beta)/Ic #dynamic internal resistance(k ohms)
gm=beta/rpi #transconductance(mS)
Re=CMRR/gm #emitter resistance(k ohms)
Rc=(Ad*2)/gm #collector resistance(k ohms) from formula Ad=gmRc/2
Rin=2*rpi #input resistance(k ohms)
#Results
print"Re is",Re,"k ohms"
print"Rc is",Rc,"k ohms"
print"input resistance is",Rin,"k ohms"
#Variable declaration
Icq=.428 #current at quinscent point(uA)
beta=200. #current gain
#as 74 dB=5000,common mode rejection ratio(dB)
Rc=10. #collector resistance(k ohms)
Re=16. #emitter resistance(k ohms)
Vcc=15. #supply voltage(V)
#Calculations
#Part b
Ibq=Icq/beta #Ib at Q(uA)
rpi=(25*beta)/Icq #dynamic resistance(k ohms)
gm=beta/rpi #transconductance
#Part b
vo1=Vcc-(Icq*Rc) #terminal 1 voltage(V)
vo2=vo1 #terminal 2 voltage(V)
#Part c
Ad=(gm*Rc)/2 #differential mode gain
Ac=Rc/(2*Re) #common mode gain
CMRR=Ad/Ac #common mode rejection ratio
#Part d
Rid=2*rpi #differential input resistance(k ohms)
rpi=11.7 #dynamic resistance(k ohms)
Ric=rpi+(2*(beta+1)*Re) #common mode input resistance(k ohms)
#Results
print"Icq is",Icq,"mA,and Ibq is ",round((Ibq/1E-3),2),"uA"
print"vo1 and vo2 have same value as",vo1,"V"
print"",
print"Ad:",round(Ad/1E-3),",Ac:",round(Ac,3),"and CMRR is",round(CMRR/1E-3)
print"Rid is",round((Rid/1E+3),1),"K ohms and Ric is",round((Ric/1E+3),2)," Mohms"
#Variable declaration
R1=10. #series resistance(K ohms)
Rf=10**3. #feedback resistance(k ohms)
vo=-5. #output voltage(V)
Ri=1000 #input resistance(k ohms)
Av=2.5*10**5 #gain
#Calculations
v1=-vo*(R1/Rf) #input signal voltage(V)
vi=-vo/Av #inverting voltage(V)
i1=((v1*10**-3)-vi)/R1 #current through R1(uA)
ii=vi/Ri #inverting current(uA)
iF=-ii #forward current(uA)
#Results
print"value of vi is",vi,"mV"
print"value of ii:",ii,"uA i1:,",i1,"uA and iF is",iF,"uA"
#Variable declaration
Vs=4 #source voltage(V)
R1=10. #resistance(k ohms)
Vb=Va=2 #voltage at point A and point B
Rf=30 #forward resistance(k ohms)
#Calculations
I=(Vs-Vb)/R1 #current(mA)
Vo=(-I*Rf)+Vb #output voltage(V)
#Result
print"output voltage",Vo,"V"
#Variable declaration
Rf=2 #as vs=2sinwt and vo=(1+Rf/Rs)*vb and vB=vA=vs
Rs=1
#Calculations
vo=(1+(Rf/Rs))*2 #output voltage(V)
#Result
print"output voltage",vo,"sinwt"
#Variable declaration
Ro=100. #output resistance(ohms)
vo=10. #output voltage(V)
A=10**5. #gain
Ri=100*10**3 #input resistance(ohms)
Rs=1*10**3. #resistance(ohms)
Rl=10*10**3 #load resistance(ohms)
#Calculations
#Part i
iL=vo/Rl #load current(mA)
Avi=vo+(iL*Ro) #voltage gain without feedback
vi=Avi/A #voltage(V)
ii=vi/Ri #current(A)
vs=vo+ii*(Rs+Ri) #source voltage(V)
#Part ii
Avf=vo/vs #voltage gain with feedback
#Part iii
Rif=vs/ii #input resistance(ohms)
Rof=Ro/A #output resistance(ohms)
#Results
print"vs is",round(vs,4),"V"
print"vo/vs that is Avf is",Avf
print"input and output resistances are",Rif,Rof,"ohms"
#Variable declaration
Vb=Va=3 #voltage at A and B
R1=40*10**3. #input resistance(ohms)
t=50*10**-3 #time after switch is open(mS)
V1=5 #input voltage(V)
#Calculations
#Part a
vo=-3 #as Va=Vb=3
#Part b
i1=(V1-Vb)/R1 #input current(A)
vo1=(-250*t)-Va #vo at 50 mS
#Result
print"output voltage",vo1,"V"
import math
#Variable declaration
BW=30*10**3 #specified bandwidth(k Hz)
fc=18*10**3 #centered frequency(Hz)
R1=20 #resistance(k ohms)
R2=180 #resistance(k ohms)
C=1.2*10**-9 #capacitance(F)
G=40 #pass band gain(dB)
g=20 #pass region gain(dB)
#Calculationsv
fc1=fc-(BW/2) #high pass section frequency(Hz)
fc2=fc+(BW/2) #low pass section frequency(Hz)
Rfc1=1/(2*math.pi*fc1*C) #high pass section resistance(k ohms)
Rfc2=1/(2*math.pi*fc2*C) #low pass section resistance(k ohms)
Gfc1=G-g #gain at frequency 0.3KHz(dB)
Gfc2=G-2*6 #gain at frequency 132KHz(dB)
#Results
print"R1 and R2 are",R1,"K ohms and",R2,"K ohms"
print"Rfc1 is",round(Rfc1/1E+3),"k ohms and Rfc2 is",round(Rfc2/1E+3),"k ohms"
print"filter gain at frequencies 0.3 KHz is",Gfc1,"dB and 132 k Hz are",Gfc2,"dB"
#Variable declaration
R=250 #resistance(k ohms)
#Calculations
#part a
R1=-R/(-5) #as vo=-5va+3vb(given),so when vb=0,vo/voa=-250/R1=-5
#part b
R2=R1/(2-1) #as va=0
#vx=(R1/R1+R)*vob=(1/6)*vb
#vy=(R2/R1+R2)*vb
#vx=vy
#(1/6)*vob=(R2/R1+R2)*vb
#vob=3vb
#(1/6)*3=R2/(50+R2)
#Result
print"R1 and R2 are",R1,"K ohms and",R2,"K ohms"
#Variable declaration
R1=10*10**3 #resistance(k ohms)
C1=10**-6 #capacitance(uF)
C=0.1*10**-6 #capacitance(uF)
R=100*10**3 #resistance(k ohms)
#Calculations
#part b
wc1=1/C1*R1 #angular frequency(rad/s)
wc2=1/C*R #angular frequency(rad/s)
wc=wc1=wc2 #angular frequency(rad/s)
#Results
print"wc1 is",wc1/1E+10,"rad/s"
print"wc2 is",wc2/1e+10,"rad/s"
#Variable declaration
vo1=5 #say (V)
K=25 #proportionality constant
Q=250 #volume of fluid passed across metering point(cm^3)
R1=2.5 #output resistance(k ohms)
#Calculations
C1=(K*Q)/(R1*vo1) #capacitor(nF)
#Results
print"C1 is",round(C1/1E+1),"uF"
print"vo1 is -5V when Q=250 cm^3"