print " Exact analysis :"
AI=(-50)/(1+((25*10**-6)*(10**3)))
print "Current gain, AI = -hfe / 1+hoe*RL = %0.2f"%AI
Ri=1000-((50*2*10**-4)/((25*10**-6)+(1/1000))) #in ohm
print "Input resistance, Ri = hie - (hfe*hre / hoe+(1/RL)) = %0.2f ohm"%Ri
Av=(-48.78)*(1000/990.24)
print "Voltage gain, Av = AI*(RL/Ri) = %0.2f "%Av
Yo=(25*10**-6)-((100*10**-4)/(1000+800)) #in mho
print " Yo = hoe - (hfe*hre / hie+Rs) = %0.2f mho"%Yo
Ro=1/Yo #in ohm
x1=Ro*10**-3
print " Ro(k-ohm) = 1/Yo = %0.2f kohm"%x1
print " Approximate analysis"
print " AI = -hfe = -50"
print " Ri = hie = 1 k-ohm"
Av=-(50.*1000)/1000
print " Av = - hfe*RL / hie = %0.2f"%Av
print " Ro = infinity"
RC=2*10**3
hie=1300
hre=2*10**-4
hfe=55
hoe=22*10**-6
print "(i) For RE = 200 ohm,"
RE=200
x=hoe*(RE+RC)
print " hoe*(RE + RC) = %0.2f "%x
print "Since hoe*(RE+RC) < 0.1, the approximate model is permissible."
AI=-hfe
print " AI = -hfe = -55"
Ri=hie+((1+hfe)*RE)
x1=Ri*10**-3
print " Ri = hie + (1+hfe)*RE = %0.2f kohm"%x1
Av=AI*(RC/Ri)
print " Av = AI * (RC/Ri) = %0.2f "%Av
print "Output resistance, Ro = infinity"
print "Output terminal resistance, RoT = Ro || RC = 2 k-ohm"
print "(ii) For RE = 400 ohm"
RE=400.
x2=hoe*(RE+RC)
print " hoe*(RE + RC) = %0.2f "%x2
print "Since hoe*(RE+RC) < 0.1, the approximate model is permissible."
AI=-hfe
print " AI = -hfe = -55"
Ri=hie+((1+hfe)*RE)
x3=Ri*10**-3
print " Ri(k-ohm) = hie + (1+hfe)*RE = %0.2f kohm"%x3
Av=AI*(RC/Ri)
print " Av = AI * (RC/Ri) = %0.2f"%Av
print "Output resistance, Ro = infinity"
print "Output terminal resistance, RoT = Ro || RC = 2 k-ohm"
print "(iii) For RE = 1000 ohm"
print "Since hoe*(RE+RC) < 0.1, the approximate model is permissible."
AI=-hfe
print " AI = -hfe = -55"
Ri=1300+((1+55)*1000)
x3=Ri*10**-3
print " Ri(k-ohm) = hie + (1+hfe)*RE = %0.2f kohm"%x3
Av=AI*(RC/Ri)
print " Av = AI * (RC/Ri) = %0.2f "%Av
print "Output resistance, Ro = infinity"
print "Output terminal resistance, RoT = Ro || RC = 2 k-ohm"
RS=900.
RL=2000.
hie=1200.
hre=2*10**-4
hfe=60.
hoe=25*10**-6
print "Conversion formulae :"
hic=hie
print " hic = hie = 1200 ohm,"
hfc=-(1+hfe)
print " hfc = -(1+hfe) = %0.2f "%hfc
print "hre = 1, hoc = hoe = 25 uA/V"
hoc=hoe
hre=1
print "Exact analysis :"
format(7)
AI=-hfc/(1+(hoc*RL))
print "Current gain, AI = -hfe / (1 + (hoc*RL)) = %0.2f "%AI
Ri=hic + (hre*AI*RL)
x1=Ri*10**-3
print "Input impedance, Ri(k-ohm) = hic + hrc*AI*RL = %0.2f kohm"%x1
Av=(AI*RL)/Ri
print "Voltage gain, Av = AI*RL / Ri = %0.2f "%Av
Yo=hoc-((hfc*hre)/(hic+RS))
print "Output resistance, Ro :"
print " Yo = 1/Ro = hoc - (hfc*hrc/hic+Rs) =%0.2f mho"%Yo
Ro=1./Yo
print " Ro = %0.2f ohm"%Ro
print "Approximate analysis :"
AI=1+hfe
print "Current gain, AI = 1 + hfe = %0.2f "%AI
Ri=hie+((1+hfe)*RL)
x2=Ri*10**-3
print "Input impedance, Ri = hie + (1+hfe)RL = %0.2f kohm"%x2
Av=1-(hie/Ri)
print "Voltage gain, Av = 1 - hie/Ri = %0.2f "%Av
print "Output resistance, Ro:"
Yo=(1+hfe)/(hie+RS)
print " Yo(mho) = (1+hfe) / (hie+RS) = %0.2f mho"%Yo
Ro=1./Yo
print " Ro = %0.2f ohm "%Ro
hic=1.4*10**3
hfc=-100
hrc=1
hoc=20*10**-6
R1=20*10**3
RS=1*10**3
R2=20*10**3
RE=10*10**3
RL=40*10**3
print "Current gain, AI = -hfc / 1+hoc*RL''"
RLd=(RE*RL)/(RE+RL)
x1=RLd*10**-3
print "where, RL'' = RE || RL = %0.2f kohm"%x
AI = -hfc / (1+(hoc*RLd))
print "Therefore, AI = %0.2f "%AI
Ri=hic+(hrc*AI*RLd)
x2=Ri*10**-3
print "Input resistance, Ri = hic + hrc*AI*RL'' = %0.2f kohm"%x2
Av=(AI*RLd)/Ri
print "Voltage gain, Av = AI*RL'' / Ri = %0.2f "%Av
print "Output resistance, Ro = 1 / Yo"
print " Yo = hoc - (hfc*hrc)/(hic+RS'')"
RSd=(RS*R1*R2)/((R1*R2)+(RS*R2)+(RS*R1))
x3=RSd*10**-3
print "where, RS'' = RS || R1 || R2 = %0.2f kohm"%x3
Yo = hoc - ((hfc*hrc)/(hic+RSd))
print " Yo = %0.2f "%Yo
# answer in textbook is wrong
Ro=1/0.0435
print " Ro = %0.2f ohm"%Ro
Rod=(Ro*RLd)/(Ro+RLd)
print " Ro'' = Ro || RLdash = %0.2f ohm"%Rod
Rs=1200.
RL=1000.
hib=22.
hrb=3*10**-4
hfb=-0.98
hob=0.5*10**-6
print " Exact analysis"
AI=-hfb/(1+(hob*RL))
print "Current gain, AI = -hfb / (1 + hob*RL) = %0.2f "%AI
Ri=hib+(hrb*AI*RL)
print "Input impedance, Ri(ohm) = hib + hrb*AI*RL = %0.2f ohm"%Ri
Av=(AI*RL)/Ri
print "Voltage gain, Av = AI*RL / Ri = %0.2f "%Av
Avs=(Av*Ri)/(Ri+Rs)
print "Overall current gain, Avc = Av*Ri / Ri+Rs = %0.2f "%Avs
AIS=(AI*Rs)/(Ri+Rs)
print "Overall current gain, AIS = AI*Rs / Ri+Rs = %0.2f "%AIS
Yo=hob-((hfb*hrb)/(hib+Rs))
x1=Yo*10**6
print "Output admittance, Yo(u-mho) = hob * (hfb*hrb / hib+Rs) = %0.2f "%x1
Ro=1/Yo
x2=Ro*10**-6
print " Ro(M-ohm) = 1 / Yo = %0.2f"%x2
AP=Av*AI
print "Power gain, AP = Av*AI = %0.2f "%AP
print "Approximate analysis"
AI=-hfb
print "Current gain, AI = -hfb = %0.2f "%AI
Ri=hib
print "Input impedance, Ri = hib = %0.2f ohm"%Ri
hfe = -hfb / (1+hfb)
print "Reaaranging this equation, hfe = -hfb / 1+hfb = %0.2f"%hfe
print "From Table 9.3, hib = hie / 1+hfe"
hie=hib*(1+hfe)
print " hie = hib(1+hfe) = %0.2f ohm"%hie
Av=hfe*RL / hie
print " Av = %0.2f"%Av
print "Output impedance, Ro = infinity"
Avs=(Av*Ri)/(Ri+Rs)
print "Overall voltage gain, Avs = Av*Ri / Ri+Rs = %0.2f "%Avs
AIS=(AI*Rs)/(Ri+Rs)
print "Overall current gain, AIS = AI*Rs / Ri+Rs = %0.2f "%AIS
AP=Av*AI
print "Power gain, AP = Av*AI = %0.2f"%AP
hib=24.
hfb=-0.98
hob=0.49*10**-6
hrb=2.9*10**-4
RS=600.
RE=6*10**3
RC=12*10**3
RL=14*10**3
print "Current gain, AI = -hfb / 1+hob*RL''"
RLd=(RC*RL)/(RC+RL)
x1=RLd*10**-3
print "where, RL'' = RC || RL = %0.2f kohm"%x1
AI=-hfb / (1+hob*RLd)
print " AI = %0.2f "%AI
print "Input impedance Ri :"
Ri=hib+(hrb*AI*RLd)
print " Ri = hib + hrb*AI*RL'' = %0.2f ohm"%Ri
print "Voltage gain Av :"
Av=(AI*RLd)/Ri
print " Av = (AI*RL'') / Ri = %0.2f "%Av
print "Output Resistance Ro :"
print "The output admittance"
RSd=(RS*RE)/(RS+RE)
Yo=hob-((hfb*hrb)/(hib+RSd))
x4=Yo*10**6
print " Yo(u-mho) = 1 / Ro = hob - (hfb*hrb / hib+RS'') = where RS'' = RS || RE = %0.2f u-mho"%x4
Ro=1./Yo
x2=Ro*10**-6
print " Ro = 1 / Yo = %0.2f M-ohm "%x2
RSd=(Ro*RLd)/(Ro+RLd)
x3=RSd*10**-3
print " RS'' = Ro || RL'' = %0.2f kohm"%x3
hfe=60.
hie=500.
IC=3*10**-3
RB=220*10**3
RC=5.1*10**3
VCC=12.
VBE=0.6
print "From h-parameter model"
beta=hfe
Zo=RC
Av=(-hfe*RC)/hie
print " Zi = hie = 500 ohm"
print " Zo = RC = 5.1 k-ohm"
print " Av = (-hfe*RC) / hie = %0.2f "%Av
print " AI = -hfe = -60"
print "From re model"
print " Zi = beta*re where re = 26mV / Ie"
Ib=(VCC - VBE)/RB
x1=Ib*10**6
print "From the circuit, Ib = (VCC - VBE) / RB = %0.2f uA"%x1
Ie=beta*(51.8*10**-6)
x2=Ie*10**3
print " Ie = Ic = beta*Ib = %0.2f mA"%x2
re = (26) / (3.108)
print " re = 26mV / Ie = %0.2f ohm"%re
Zi = beta*8.37
print " Zi = beta*re = %0.2f ohm"%Zi
print " Zo = RC = 5.1 k-ohm"
Av=int(-RC/re)
print " Av = -RC / re = %0.2f "%Av
print " AI = -beta = -60"
hie=3.2*10**3
hfe=100.
R1=40*10**3
R2=4.7*10**3
RC=4*10**3
VCC=16.
VBE=0.6
RE=1.2*10**3
beta=100.
print "h-parameter analysis :"
print "Zi = RB || hie"
RB=(R1*R2)/(R1+R2)
x1=RB*10**-3
print " RB = R1 || R2 = 40 k-ohm || 4.7 k-ohm = %0.2f "%x1
Zi=(RB*hie)/(RB+hie)
x2=Zi*10**-3
print " Zi = 4.2 k-ohm || 3.2 k-ohm = %0.2f"%x2
print " Zo = RC = 4 k-ohm"
Av=(-hfe*RC)/hie
print " Av = -hfe*RC / hie = %0.2f "%Av
AI=(-hfe*RB)/(RB+hie)
print " AI = -hfe*RB / RB+hie = %0.2f "%AI
print "Using r model :"
print "To find IB,"
VB=(R2*VCC)/(R1+R2)
print " VB = R2*VCC / R1+R2 = %0.2f "%VB
print "Using Thevenin equivalent for input part,"
IB=1.082/(125.4*10**3)
x3=IB*10**6
print "IB = (VB-VBE) / (RB+((1+beta)*RE)) = %0.2f uA"%x3
IC=beta*IB
x4=IC*10**3
print " IC = beta*IB = %0.2f mA"%x4
print " IE ~ IC = %0.2f mA"%x4
IE = IC
re=(26*10**-3)/(0.86*10**-3)
print re," re = 26mV / IE = %0.2f ohm"%re
Zi=(RB*beta*re)/(RB+(beta*re))
x5=Zi*10**-3
print " Zi = RB || beta*re = %0.2f kohm"%x5
print " Zo = RC = 4 k-ohm"
Av=-RC/re
print " Av = -RC / re = %0.2f"%Av
AI=(-100*(4.2*10**3))/((4.2*10**3)+(100*30.23))
print " AI = (-beta*RB) / (RB+(beta*re)) = %0.2f"%AI
VBE=0.6
VEE=8.
VCC=10.
RE=4*10**3
RC=3*10**3
IE=(VEE-VBE)/RE
x1=IE*10**3
print " |IE| = VEE-VBE / RE = %0.2f mA"%x1
re=(26*10**-3)/IE
print " re(ohm) = 26mV / IE = %0.2f ohm"%re
Zi=(RE*re)/(RE+re)
print " Zi = RE || re = %0.2f ohm"%Zi
Zo=RC*10**-3
print " Zo = RC = %0.2f kohm"%Zo
Av=3000/14.05
print " Av = RC / re = %0.2f "%Av
print " AI = 1"
print "We know that IB = VCC-VBE / RB+(1+beta)*RE"
IB=((15-0.7)/((75*10**3)+(101*910)))*10**6
print "Therefore, IB = %0.2f uA"%IB # in uA
print "IE = (1+beta)*IB = 8.57 mA"
print "The dynamic resistance is"
re=0.026/(8.57*10**-3)
print " re = %0.2f ohm"% re # in ohm
print "The input impedance of the amplifier is"
zb=(101*(3.03+910))*10**-3 # in k-ohm
print " Zb = (1+beta)(re+RE) = %0.2f k-ohm "%zb
print "The input impedance of the amplifier stage is"
Zi=((75*92.2*10**6)/((75*10**3)+(92.2*10**3)))*10**-3 # in k-ohm
print " Zi = RB || Zb = %0.2f kohm"%Zi
print "The voltage gain of the amplifier is"
av=910./(3.03+910)
print "Av = RE / re+RE = %0.2f "%av
VCC=10.
RB=470*10**3
RE=3.3*10**3
beta=100.
RS=1*10**3
RL=50.
re=22.4
VBE=0.7
IB = (VCC-VBE) / (RB + ((1+beta)*RE))
x1=IB*10**6
print "From fig.9.55, IB = (VCC-VBE) / (RB + (1+beta)*RE) = %0.2f uA"%x1
IE=(1+beta)*IB
x2=IE*10**3
print " IE = (1+beta)*IB = %0.2f mA"%x2
rL=(RE*RL)/(RE+RL)
print "The load resistance of the emitter follower is rL = RE || RL = %0.2f ohm "%rL # answer in textbook is wrong
x=(1+beta)*(re+rL)
Zi=(RB*x)/(RB+x)
x3=Zi*10**-3
print " Zi = RB || (1+beta)(re+rL) = %0.2f kohm"%x3
y=(50/(22.4+50))*((7.13*10**3)/((1*10**3)+(7.3*10**3))) # answer in textbook is wrong
print " VL / VS = (rL/re+rL)(Zi/Rs+Zi) = %0.2f "%y
RS=50.
RE=2*10**3
Ro=1*10**3
RL=4*10**3
VEE=6.
VBE=0.7
RC=1000.
VS=10*10**-3
IE=(VEE-VBE)/RE
x1=IE*10**3
print "We know that, IE = VEE-VBE / RE"
print "Therefore, IE = %0.2f mA"%x1
re=0.026/IE
print " Zb = re(ohm) = %0.2f ohm"%re
Zi=(re*RE)/(re+RE)
print " Zi(ohm) = re || RE = %0.2f ohm"%Zi
Av=RC/re
print " Av = RC / re = %0.2f "%Av
x=Av*(re/(re+RS))*(RL/(RL+RC))
print " VL / VS = Av*(re/re+RS)*(RL/RL+RS) = %0.2f"%x
VL=x*VS
x2=VL*10**3
print " VL(in mV (rms)) = Av*VS = %0.2f "%x2
iL=VL/RL
x3=iL*10**6
print " iL( in uA (rms)) = VL / RL = %0.2f "%x3
alpha=1.
y=alpha*(RS/(RS+re))*(RC/(RC+RL))
print " iL / iS = alpha*(RS/RS+re)*(RC/RC+RL) = %0.2f "%y
from __future__ import division
RC=12*10**3
RL=15*10**3
RS=10.
RE=22*10**3
VEE=24.
VBE=0.3
print "The emitter current of the common base amplifier is"
IE=(VEE-VBE)/RE
print " IE = VEE-VBE / RE = %0.2f A"%IE
re=0.026/IE
print " re = 0.026 / IE = %0.2f ohm"%re
Av=RC/re
print " Av = RC /re = %0.2f "%Av
x=497*(24.14/(24.14+10))*((15*10**3)/((12*10**3)+(15*10**3)))
print " VL/VS = Av*(re/re+RS)*(RL/RL+RC) = %0.2f "%x
Ai=3.413
y=Ai*(RS/(RS+re))*(RC/(RC+RL))
print " iL/iS = Ai*(RS/RS+re)*(RC/RC+RL) = %0.2f"%y
rc=1.5*10**6
RE=4.7*10**3
Ro=2.2*10**3
RS=20
RL=10*10**3
VS=20*10**-3
VEE=9
VBE=0.7
IE=(VEE-VBE)/RE
x1=IE*10**3
print "We know that, IE(mA) = VEE-VBE / RE = %0.2f mA"%x1
re=0.026/IE
print " re = 0.026 / IE = %0.2f ohm"%re
Zi=(RE*re)/(RE+re)
print " Zi = RE || re = %0.2f ohm"%Zi
Zo=(Ro*rc)/(Ro+rc)
x2=Zo*10**-3
print " Zo = RC || re = %0.2f kohm"%x2
Av=Zo/Zi
print " Av = Zo/Zi = RC||rc/RE||re = %0.2f "%Av
x=Av*(Zi/(RS+Zi))*(RL/(RL+Zo))
print " VL/VS = Av*(Zi/RS+Zi)*(RL/RL+Zo) = %0.2f "%x
y=x*VS
print " VL = Av*VS = %0.2f rms"%Av
beta=100.
VCC=10.
R2=4.7*10**3
R1=27*10**3
RE=680.
RC=3.3*10**3
RS=600.
RL=15*10**3
VB=(10*4.7*10**3)/((27*10**3)+(4.7*10**3))
print " VB = (R2 / R1+R2)*VCC = %0.2f V"%VB
# answer in textbook is wrong
VE=1.39-0.7
print " VE = 1.39 - 0.7 = %0.2f V"%VE
IE=VE/RE
x1=IE*10**3
print " IE(mA) = VE / RE = %0.2f mA"%x1
re=0.026/IE
print " re = 0.026/IE = %0.2f ohm"%re
x=beta*(re+RE)
Zi=(R1*R2*x)/((R2*x)+(R1*x)+(R1+R2)) # answer in textbook is wrong
x2=Zi*10**-3
print " Zi = R1 || R2 || beta*(re+RE) = %0.2f kohm"%x2
y=(-RC/(RE+re))*(Zi/(RS+Zi))*(RL/(RC+RL))
print "The overall voltage gain is VL/VS = (-RC/RE+re)*(Zi/RS+Zi)*(RL/RC+RL) = %0.2f "%y
u=beta*re
Zi=(R1*R2*u)/((R2*u)+(R1*u)+(R1*R2))
x3=Zi*10**-3
print " Zi = R1 || R2 || betare = %0.2f kohm"%x3
z=(-RC/re)*(Zi/(RS+Zi))*(RL/(RC+RL)) # answer in textbook is wrong
print " VL/VS = (-RC/re)*(Zi/RS+Zi)*(RL/RC+RL) = %0.2f"%z
RB1=7.5*10**3
RB2=6.8*10**3
RB3=3.3*10**3
RE=1.3*10**3
RC=2.2*10**3
beta1=120.
beta2=120.
VCC=18.
VBE1=0.7
VB1=(RB3*VCC)/(RB3+RB2+RB1)
print " VB1 = (RB3*VCC)/(RB3+RB2+RB1) = %0.2f V"%VB1
IE1=(VB1-VBE1)/RE
x1=IE1*10**3
print " IE1 = VE1/RE = (VB1-VBE1)/RE = %0.2f mA"%x1
re1=(26*10**-3)/IE1
print " re1 = 26mV/IE1 = %0.2f ohm"%re1
re2=re1
print " re2 = %0.2f ohm (since IE2 = IE1)"%re2
print "Voltage gain of the second stage,"
Av2=RC/re2
print " Av2 = RC / re2 = %0.2f"%Av2
print "Overall voltage gain,"
Av1=-1
Av=Av1*Av2
print " Av = Av1*Av2 = %0.2f"%Av
RD=5*10**3
RG=10*10**6
u=50.
rd=35*10**3
print "The voltage gain,"
Av=(-u*RD)/(RD+rd)
print " Av = Vo/Vi = -u*RD / RD+rd = %0.2f"%Av
print "The minus sign indicates a 180 degree phase shift between Vi and Vo"
Zi=RG*10**-6
print "Input impedance Zi(M-ohm) = RG = %0.2f "%Zi
Zo=RD*10**-3
print "Output impedance Zo(k-ohm) = RD = %0.2f "%Zo
RS=4*10**3
RG=10*10**6
u=50.
rd=35*10**3
print "The voltage gain,"
Av=(u*RS)/(((1+u)*RS)+rd)
print " Av = Vo/Vi = u*RS / (u+1)*RS+rd = %0.2f "%Av
x=rd/u
Zo=(x*RS)/(RS+x)
print "Output impedance, Zo(ohm) = 1/gm || RS = (rd/u) || RS = %0.2f ohm"%Zo
RD=2*10**3
RS=1*10**3
gm=1.43*10**-3
rd=35*10**3
print "The voltage gain,"
Av=(((gm*rd)+1)*RD)/(RD+rd)
print " Av = Vo/Vi = (gm*rd + 1)*RD / (RD+rd) = %0.2f"%Av
x=1./gm
Zi=(RS*x)/(RS+x)
x1=Zi*10**-3
print "Input impedance, Zi(k-ohm) = RS || 1/gm = %0.2f k0hm"%x1
print "Output impedance, Zo ~ RD = 2 k-ohm"
print " In the first set,"
Vid=100-(-100) #in uV
print " Vid = Vd(uV) = V1 = V2 = %0.2f uV"%Vid
Vc=(1/2)*(100+(-100)) # in uV
print " Vc(uV) = 1/2(V1+V2) = %0.2f"%Vc
print " In the second set,"
Vd=1100-900 # in uV
print " Vd = V1 = V2 = %0.2f uV"%Vd
Vc=(1./2)*(1100+900)
print " Vc = 1/2(V1+V2) = %0.2f uV"%Vc
VEE=15.
VBE=0.7
REE=65*10**3
IE = (VEE - VBE)/(2*REE)
IE1=IE*10**6
print " IE = (VEE - VBE)/2*REE = %0.2f uA"%IE1
alphaF=100./101.
IC=(alphaF*IE)
IC1=IC*10**6
print " IC = alpha_F*IE = %0.2f uA"%IC1
betaF=100.
IB=IC/betaF
IB1=IB*10**6
print " IB = IC / beta_F = %0.2f uA"%IB1
VCC=VEE
RC=REE
VC=VCC-(IC*RC)
print " VC = VCC - IC*RC = %0.2f V"%VC
VE=-0.7
VCE=VC - VE
print " VCE = VC - VE = %0.2f V"%VCE
IE=(VEE/(2*REE))*10**6
print " IE = VEE / 2*REE = %0.2f uA"%IE
from math import sqrt
VDD=12.
VSS=VDD
ISS=175*10**-6
RD=65*10**3
Kn=3*10**-3
VTN=1.
IDS=ISS/2.
IDS1=IDS*10**6
print " IDS = ISS / 2 = %0.2f uA"%IDS1
VGS=VTN+sqrt(ISS/Kn)
print " VGS = VTH + sqrt(ISS/Kn) = %0.2f V"%VGS
VDS=VDD-(IDS*RD)+VGS
print " VDS = VDD - (IDS*RD) + VGS = %0.2f V"%VDS
print "Checking for saturation,"
x=VGS-VTN
print " VGS - VTN = %0.2f "%x
print "and VDS >= 0.2. Thus, both transistors in the differential amplifier are baised at Q-point of :"
print "%0.2f" %IDS1
print "%0.2f"%(VDS)
VIC = VDD - IDS*RD + VTN
print " VIC= %0.2f V"%VIC
from math import log10
VS1=60*10**-3
VS2=40*10**-3
hie=3.2*10**3
hfe=100.
VEE=12.
VCC=VEE
VBE=0.7
beta=hfe
RE=5.6*10**3
RS=120.
RC=4.5*10**3
Rc=4.5*10**-5
IE=(VEE-VBE)/((2*RE)+(RS/beta))
IE1=IE*10**3
print "beta = hfe = 100"
print " IE = (VEE-VBE) / ((2*RE)+(RS/beta)) = %0.2f mA"%IE1
IC=IE
print "IC ~ IE = 1.009 mA"
print " Therefore ICQ = %0.2f mA"%IE1
VCE=VCC+VBE-(IC*Rc)
print " VCE = VCC + VBE - IC*RC = %0.2f V"%VCE
# answer in textbook is wrong
print "and VCEQ = %0.2f V"%VCE # answer in textbook is wrong
print "The differential gain is : "
Ad=(hfe*RC)/(RS+hie)
print " Ad = hfe*RC / RS+hie = %0.2f "%Ad
print "Common mode gain is : "
AC=(hfe*RC)/(((2*RE)*(1+hfe))+RS+hie)
print " AC = (hfe*Re) / (((2*RE)*(1+hfe)) + RS + hie) = %0.2f "%AC
CMRR = Ad / AC
print "CMRR = Ad / AC = %0.2f "%CMRR
CMRR1=20*log10(135.54/0.3966)
print "CMRR = 20log|Ad/AC| = %0.2f dB"%CMRR1
print "The output voltage is Vo = Ad*Vd + AC*VC. Here,"
Vd=VS1-VS2
Vd1=Vd*10**3
print " Ad [mV(peak-peak)] = VS1 - VS2 = %0.2f "%Vd1
VC=(VS1+VS2)/2
VC1=VC*10**3
print "Then, VC [mV(peak-peak)]= (VS1+VS2) / 2 = %0.2f "%VC1
Vo = Ad*Vd + AC*VC
print "Therefore, Vo [V(peak-peak)] = %0.2f "%Vo
hie=400.
hre=2.1*10**-4
hfe=40.
hoe=25*10**-6
RL=5*10**3
RC=3*10**3
print "From the circuit 9.90(a),"
Rth=(RL*RC)/(RL+RC)
RLd=hoe*(Rth)
print " RL = hoe*(RL || RC) = %0.2f "%RLd
print "For equivalent circuit refer fig.9.90(b)."
Ri=(hie*100*10**3)/(hie+(100*10**3))
print " Input resistance, Ri = hie || 100k = %0.2f "%Ri
R1=50.0*10**3
Ro=(R1*RC*RL)/((RC*RL)+(R1*RL)+(R1*RC))
print " Output resistance, Ro = 50k || 3k || 5k = %0.2f "%Ro
x=(-hfe*Ro)/hie
print "Therefore, Vo/Vi = -hfe*Ro / hie = %0.2f "%x
RS=1*10**3
y=Ri/(Ri+RS)
print " Vi/VS = Ri/(Ri+RS) = %0.2f "%y
Avs=abs(x*y)
print "Hence, Avs = Vo/VS = (Vo/Vi)*(Vi/VS) = %0.2f "%Avs