from __future__ import division
# given data
# KCL at node (b) (6-V)/30+(8-V)/40+(0-V)/30=0
V=48/11 #in volts
print "Voltage V = %0.2f Volt"%V
# KCL at node (a) (3-V)/10+(4-V)/20=(V-Vo)/40
Vo=-(20-7*V) #in Volts
print "Output Voltage of the circuit Vo = %0.2f Volt"%Vo
from __future__ import division
from sympy import symbols, N
V1, V2 = symbols('V1 V2')
R1 = 11 # Kohm
R2 = 10 # Kohm
Ra = 99 # kohm
Ro = 100 # kohm
Va = Ra/(Ra+R1)*V1
Vo1 = (1+Ro/R2)*Va
A = Vo1/V1
Vo2 = -Ro/R2*V2
B = Vo2/V2
print "Value of A : ",N(A,2)
print "Value of B : ",N(B,2)
from __future__ import division
from sympy import symbols, N, solve
Va, R1, R3, Vb = symbols('Va R1 R3 Vb')
Ro = 100 # kohm
Voa = -2*Va
# Vo = Voa+Vob
eqn = Voa+Ro/R1*Va
R1 = solve(eqn, R1)[0] # kohm
print "value of R1 = %0.2f kohm"%R1
R2=R1 # kohm
V1 = R3*Vb/(R2+R3)
Vob = (1+Ro/R1)*V1
R3 = solve(Vob-Vb,R3)[0]
print "value of R2 = %0.2f kohm"%R2
print "value of R3 = %0.2f kohm"%R3
from sympy import symbols, solve, N
Vo = symbols('Vo')
R1 = 10 # kohm
R2 = 20 # kohm
Ro = 100 # kohm
V1 = -2 # V
V2 = +3 # V
I1 = V1/R1 # A
I2 = V2/R2 # A
If = (0-Vo)/Ro
eqn = I1+I2-If
Vo = solve(eqn, Vo)[0]
print "Output voltage, Vo =",N(Vo,2),"Volt"
import numpy as np
from sympy import symbols
Vo, Vx, Vy = symbols('Vo Vx Vy')
R1 = 2 # kohm
R2 = 2 # kohm
R3 = 2 # kohm
R4 = 8 # kohm
R5 = 1 # kohm
R6 = 7 # kohm
V1 = 1 # V
# Node X
Vz=1 # V
# KCL at node Y
eqn1 = 3*Vy-2*Vx-1
# KCL at node X
eqn2 = Vy-2*Vx+1
A=np.array([[-2,3],[-2,1]])
B=np.array([[1,-1]])
X=np.linalg.solve(A,B)
Vx = X[0][1] # V
Vo = Vx/R5*(R5+R6)
print "Output Voltage, Vo = %0.f V"%Vo
# given data
R1=10 #in Kohm
R4=8 #in Kohm
R5=3 #in Kohm
RF=45 #in Kohm
AD=(1+2*R4/R5)*(RF/R1)
print "Gain for the instrumention amplifier is : ",AD
# given data
VA=3 #in mV
VB=5 #in mV
R1=10 #in Kohm
R2=10 #in Kohm
R3=45 #in Kohm
R4=8 #in Kohm
R5=3 #in Kohm
RF=45 #in Kohm
I=(VA-VB)/R5 #in mA
VoA=VA+I*R4 #in mVs
VoB=VB-I*R4 #in mVs
print "Output of op-amp A1 = %0.2f mV" %VoA
print "Output of op-amp A2 = %0.2f mV" %VoB
Vo1=(1+RF/R1)*(R3/(R3+R2))*VoB
Vo2=-(RF/R1)*VoA
Vo=Vo1+Vo2 #in mV
print "Combined output of the circuit = %0.2f mV"%Vo
# Answer in the textbook is not accurate.
# given data
RF=10 #in Kohm
R1=10 #in Kohm
R2=R1 #in Kohm
R3=R1 #in Kohm
R5max=50 #in Kohm
ADmin=5 #unitless
ADmax=200 #unitless
#Formula : ADmin=1+2*R4/R5max
R4=(ADmin-1)*(R5max/2) #in Kohm
#Formula : ADmax=1+2*R4/R5min
R5min=(2*R4)/(ADmax-1) #in Kohm
print "Thus design values of resistors in Kohm are :"
print "R1 = ",R1,"kohm"
print "R2 = ",R2,"kohm"
print "R3 = ",R3,"kohm"
print "R4 = ",R4,"kohm"
print "RF = ",RF,"kohm"
print "R5min = %0.f kohm"%R5min
print "R5max = ",R5max,"kohm"
# given data
Vdc=10 #in Volt
R1=10 #in Kohm
R2=10 #in Kohm
R3=100 #in Kohm
RF=100 #in Kohm
# Part(i) Balance Bridge : RA=RB=RC=RT=150ohm and VAB=0
Vo = 0 # V
print "(i) Balance bridge have output voltage Vo = %0.f volt" %Vo
RA=150 #in ohm
RB=150 #in ohm
RC=150 #in ohm
RT=150 #in ohm
VAB=0 #in Volt
Vo=(-RF/R1)*VAB
# Part(ii) Unbalance Bridge : RT=200ohm
RT=200 #in ohm
VA=(RA/(RA+RT))*Vdc
VB=(RB/(RB+RC))*Vdc
VAB=VA-VB #in Volt
Vo=(-RF/R1)*VAB
print "(ii) Unbalance bridge have output voltage Vo = %0.1f Volt" %Vo
import numpy as np
# given data
Gain=10 #Unitless
fb=10 #in KHz
#Assuming fa=fb/10
fa=fb/10 #in KHz
# Formula : fa=1/(2*pi*RF*CF)
RFCF=1/(2*np.pi*fa)
#Assuming R1=1Kohm
R1=1 #in Kohm
RF=10*R1 #in Kohm
CF=RFCF/RF #in uF
Rcomp=(R1*RF)/(R1+RF) # in Kohm
print "Value of RF = %0.2f kohm"%RF
print "Value of CF = %0.3f uF"%CF
print "Value of Rcomp = %0.f ohm"%(Rcomp*1000)
#Using superposition theorem
CF=10 #in uF
R1=1/(3*CF*10**-6) #in KOhm
R2=1/(2*CF*10**-6) #in KOhm
print "Value of R1 = %0.2f kohm "%(R1/1000)
print "Value of R2 = %0.2f kohm "%(R2/1000)
import numpy as np
# given data
fa=1.5 #in KHz
fmax=1.5 #in KHz
C1=0.1 #in uF
RF=1/(2*np.pi*fa*C1) #in Kohm
fb=10*fa #in Khz
R1=1/(2*np.pi*fb*C1) #in Kohm
CF=(R1*C1)/RF #in uF
Rcomp=RF #in Kohm
print "Value of resistance RF = %0.2f kohm"%(RF)
print "Value of resistance R1 = %0.2f ohm"%(R1*1000)
print "Value of Capacitance CF = %0.2f uF"%(CF)
print "Value of resistance Rcomp = %0.2f kohm"%(Rcomp)
from __future__ import division
# given data
C1=0.1 #in uF
f=100 #in Hz
T=1/f #in sec
# Given also R1C1=0.2*T
R1=(0.2*T)/(C1*10**-6) #in ohm
RF=0.05/(C1*10**-6) #in ohm
CF=(R1*C1)/RF #in uF
print "Value of resistance R1 = %0.2f ohm"%(R1/1000)
print "Value of resistance RF = %0.2f kohm"%(RF/1000)
print "Value of Capacitance CF = %0.2e uF"%(CF)