from __future__ import division
RL=5*10**(3)
print "RL= %0.2f"%(RL)," ohm" #Load resistance
R1=100*10**(3)
print "R1= %0.2f"%(R1)," ohm" # resistance
R2=10*10**(3)
print "R2= %0.2f"%(R2)," ohm" # resistance
rc=50*10**(3)
print "rc= %0.2f"%(rc)," ohm" #collector resistance
rd=rc # Drain and collector resistance are equal
rbe=1*10**(3)
print "rbe= %0.2f"%(rbe)," ohm" #Load resistance
gm=50*10**(-3)
print "gm = %0.2f"%(gm)," A/V"# transconductance for BJT
Av=(-gm*RL)
print "For BJT,Av=(-gm*RL)= %0.2f"%(Av) #Voltage gain for BJT
AI=gm*rbe
print "AI=(gm*rbe)= %0.2f"%(AI) # current gain for BJT
gm=5*10**(-3)
print "gm = %0.2f"%(gm)," A/V"# transconductance for FET
Av=(-gm*RL)
print "For FET,Av=(-gm*RL)= %0.2f"%(Av)," " # gain for FET
R0=rd
print "R0= %0.2f"%(R0)," ohm" #output resistance for FET and BJT
Ri=rbe
print "Ri= %0.2f"%(Ri)," ohm" #BJT input resistance
RB=(R1*R2)/(R1+R2)
print "RB=(R1*R2)/(R1+R2)= %0.2f"%(RB)," ohm" # eqivalent Base resistance for BJT
Ri=(RB*rbe)/(RB+rbe)
print "Ri= (RB*rbe)/(RB+rbe)=%0.2f"%(Ri)," ohm" #New value of BJT input resistance
from __future__ import division
RL=5*10**(3)
print "RL= %0.2f"%(RL)," ohm" #Load resistance
R1=100*10**(3)
print "R1= %0.2f"%(R1)," ohm" # resistance
R2=100*10**(3)
print "R2= %0.2f"%(R2)," ohm" # resistance
Rs=5*10**(3)
print "Rs= %0.2f"%(Rs)," ohm" # Source resistance
Beta_o=50
print "Beta_o = %0.2f"%(Beta_o) #BJT gain
rbe=1*10**(3)
print "rbe= %0.2f"%(rbe)," ohm" #Base-emitter resistance
gm=50*10**(-3)
print "gm = %0.2f"%(gm)," A/V"# transconductance for BJT
rc=50*10**(3)
print "rc= %0.2f"%(rc)," ohm" #collector resistance
Av=RL/(RL+1/gm) # Gain formulae
print "Av=RL/(RL+1/gm)= %0.2f"%(Av) # voltage gain for BJT
Avs=RL/((Rs/Beta_o)+(1/gm)+(RL))
print "Avs=RL/((Rs/Beta_o)+(1/gm)+(RL))= %0.2f"%(Avs) # Overall voltage gain for BJT
AI=-(Beta_o+1)
print "AI=-(Beta_o+1)= %0.2f"%(AI) # current gain for BJT
R0=(Rs+rbe)/Beta_o
print "R0= (Rs+rbe)/Beta_o=%0.2f"%(R0)," ohm" #output resistance for BJT
Ri=rbe+Beta_o*RL # formulae
print "Ri= rbe+Beta_o*RL=%0.2f"%(Ri)," ohm" # value of BJT input resistance
RB=(R1*R2)/(R1+R2)
print "RB=(R1*R2)/(R1+R2)= %0.2f"%(RB)," ohm" # eqivalent Base resistance for BJT
Rieff=(Ri*RB)/(RB+Ri)
print "Rieff= (Ri*RB)/(RB+Ri)=%0.2f"%(Rieff)," ohm" #Effective value of BJT input resistance
from __future__ import division
RL=5*10**(3)
print "RL= %0.2f"%(RL)," ohm" #Load resistance
RF=5*10**(3)
print "RF= %0.2f"%(RF)," ohm" # resistance
Beta_o=50
print "Beta_o = %0.2f"%(Beta_o) #BJT gain
rbe=1*10**(3)
print "rbe= %0.2f"%(rbe)," ohm" #Base-emitter resistance
gm=50*10**(-3)
print "gm = %0.2f"%(gm)," A/V"# transconductance for BJT
rc=50*10**(3)
print "rc= %0.2f"%(rc)," ohm" #collector resistance
Ri=rbe+RF*(1+gm*rbe) # formulae
print "Ri= rbe+RF*(1+gm*rbe)=%0.2f"%(Ri)," ohm" # BJT input resistance
Av=(-gm*RL)/(1+gm*RF)# formulae
print "Av=(-gm*RL)/(1+gm*RF)= %0.2f"%(Av) # voltage gain for BJT
AI=Beta_o
print "AI=(Beta_o)= %0.2f"%(AI) # current gain for BJT
R0=Beta_o*rc
print "R0= Beta_o*rc=%0.2f"%(R0)," ohm" #output resistance for BJT
from __future__ import division
RL=5*10**(3)
print "RL= %0.2f"%(RL)," ohm" #Load resistance
RF=2.5*10**(3)
print "RF= %0.2f"%(RF)," ohm" # resistance
Rs=50
print "Rs= %0.2f"%(Rs)," ohm" # resistance
ro=50*10**(3)
print "ro= %0.2f"%(ro)," ohm" # output resistance
rd=ro # drain resistance
rc=ro# Collector resistance
print "rc= %0.2f"%(rc)," ohm" # Collector resistance
rbe=1*10**(3)
print "rbe= %0.2f"%(rbe)," ohm" #base -emitter resistance
print "For CG Amplifier"
gm=5*10**(-3)
print "gm = %0.2f"%(gm)," A/V"# transconductance for FET
Ri=1/gm # formulae
print "Ri= 1/gm=%0.2f"%(Ri)," ohm" # value of CGA (common gate amplifier)input resistance for FET
Avs=gm*RL/(1+gm*Rs)
print "Avs=gm*RL/(1+gm*Rs)= %0.2f"%(Avs) # Overall voltage gain for FET (CGA)
Ro=rd*(1+gm*Rs)
print "Ro=rd*(1+gm*Rs)=%0.2f"%(Ro)," ohm" #output resistance for FET (CGA)
print "For CB Amplifier"
gm=50*10**(-3)
print "gm = %0.2f"%(gm)," A/V"# transconductance for BJT
Ri=1/gm # formulae
print "Ri= 1/gm=%0.2f"%(Ri)," ohm" # value of CBA (common base amplifier)input resistance for BJT
Avs=gm*RL/(1+gm*Rs)
print "Avs=gm*RL/(1+gm*Rs)= %0.2f"%(Avs) # Overall voltage gain for BJT (CBA)
Ro=gm*(rbe*rc)
print "Ro=gm*(rbe*rc)=%0.2e"%(Ro)," ohm" #output resistance for BJT (CBA)
#NOTE: I have calculated first all the parameters for CG amplifier and then for CB amplifier but in book parameters have been calculated alternatingly for CG and CB amplifiers.
from math import pi
from __future__ import division
RL=5*10**(3)
print "RL= %0.2f"%(RL)," ohm" #Load resistance
Cc=0.1*10**(-6)
print "Cc= %0.2e"%(Cc)," farad" #capacitance
Ri=100*10**(3)
print "Ri= %0.2f"%(Ri)," ohm" # input resistance for Amplifier
CSH=100*10**(-12)
print "CSH= %0.2f"%(CSH)," farad" #shunt load capacitance
Avm=100
print "Avm=%0.2f"%(Avm) # Mid-frequency gain
fL=1/(2*(pi)*(Ri)*(Cc))
print "fL=1/(2*(pi)*(Ri)*(Cc))= %0.2f"%(fL),"Hz " # Lower cutoff-frequency
fH=1/(2*(pi)*(RL)*(CSH))
print "fH=1/(2*(pi)*(RL)*(CSH))= %0.2e"%(fH)," Hz" # Higher cutoff-frequency
BW=fH-fL
print "BW=fH-fL= %0.2f"%(BW)," Hz" # Bandwidth
fT=Avm*fH
print "fT=Avm*fH= %0.2e"%(fT)," Hz" # Unity gain bandwidth
# ERROR NOTE: calculated value of lower cutoff frequency, fL= 15.915494 Hz but in book given as 15.0 Hz
from __future__ import division
IDSS=16*10**(-3)
print "IDSS = %0.2f"%(IDSS)," ampere" # maximum drain current JFET
VP=(-4)
print "VP= %0.2f"%(VP)," volts" # pinch off voltage for JFET
VGSQ=(-2)
print "VGSQ= %0.2f"%(VGSQ)," volts" # Gate operating point voltage
Vsm=(0.2)
print "Vsm= %0.2f"%(Vsm)," volts" # sinusoidal input voltage for JFET
D=(((0.5)*(Vsm)**2)/(4*Vsm))*100 # derived from ID=IDSS(1-VGS/VP)**2 and putting value of VGS=VGSQ+Vs, where Vs=Vsm sinwt
print "D=(((0.5)*(Vsm)**2)/(4*Vsm))*100 =%0.2f"%(D),"% " # Percentage second harmonic distortion calculation
from math import pi
from __future__ import division
Ic=1*10**(-3)
print "Ic = %0.2e"%(Ic)," ampere" # collector current BJT
rbe=2*10**(3)
print "rbe= %0.2f"%(rbe)," ohm" #base -emitter resistance
gm=50*10**(-3)
print "gm = %0.2f"%(gm)," A/V"# transconductance for BJT
Beta_o=100
print "Beta_o = %0.2f"%(Beta_o)," " #BJT gain
rc=50*10**(3)
print "rc= %0.2f"%(rc)," ohm" #collector resistance
Cbe=10*10**(-12)
print "Cbe= %0.2e"%(Cbe)," farad" #base -emitter capacitance
Ctc=1*10**(-12)
print "Ctc= %0.2e"%(Ctc)," farad" #input device capacitance
print "part(i)"# part(i)of question
RL=10*10**(3)
print "RL= %0.2f"%(RL)," ohm" #Load resistance
Rs=500
print "Rs= %0.2f"%(Rs)," ohm" #input source resistance
Rth=(Rs*rbe)/(Rs+rbe)
print "Rth=(Rs*rbe)/(Rs+rbe)=%0.2f"%(Rth)," ohm" # eqivalent resistance
Avm=(-gm*RL)
print "Avm=(-gm*RL)=%0.2f"%(Avm) # Mid-frequency gain for CE amplifier
CM=Ctc*(1-Avm)
print "CM=Ctc*(1-Avm)= %0.2f"%(CM)," farad" #calculated capacitance
Ci=Cbe
print "Ci=Cbe= %0.2f"%(Ci)," farad" #calculated input capacitance
fHi=1/(2*(pi)*(Rth)*(Cbe+CM))
print "fHi=1/(2*(pi)*(Rth)*(Cbe+CM))= %0.2f"%(fHi)," Hz" # Higher-frequency cutoff for CE amplifier
Ri=rbe
print "Ri=rbe =%0.2f"%(Ri)," ohm" #input resistance CE amplifier
Ro=rc
print "R0= rc=%0.2f"%(Ro)," ohm" #output resistance for CE amplifier
fB=1/(2*(pi)*(rbe)*(Cbe))
print "fB=1/(2*(pi)*(rbe)*(Cbe))= %0.2e"%(fB)," Hz" # base terminal frequency cutoff
fT=Beta_o*fB
print "fT=Beta_o*fB= %0.2e"%(fT)," Hz" # Unity gain bandwidth for CE amplifier
print "part(ii)"# part(ii)of question
Rs=50*10**(3)
print "Rs= %0.2f"%(Rs)," ohm" #input source resistance for CC amplifier
RL=1*10**(3)
print "RL= %0.2f"%(RL)," ohm" #Load resistance for CC amplifier
fhi=1/(2*(pi)*(Rs)*(Ctc))
print "fhi=1/(2*(pi)*(Rs)*(Ctc))= %0.2e"%(fhi)," Hz" # Higher-frequency cutoff for CC amplifier
Avm=(gm*RL)/(1+gm*RL)
print "Avm=(gm*RL)/(1+gm*RL)=%0.2f"%(Avm) # Mid-frequency gain for CC amplifier
Ro=1/gm
print "Ro= 1/gm=%0.2f"%(Ro)," ohm" #output resistance for CC amplifier
Ri=Beta_o*RL
print "Ri=Beta_o*RL =%0.2f"%(Ri)," ohm" #input resistance CE amplifier
print "part(iii)"# part(iii)of question
RL=10*10**(3)
print "RL= %0.2f"%(RL)," ohm" #Load resistance for CB amplifier
Rs=50
print "Rs= %0.2f"%(Rs)," ohm" #input source resistance for CB amplifier
fHi=gm/(2*(pi)*(Cbe))
print "fHi=gm/(2*(pi)*(Cbe))= %0.2e"%(fHi)," Hz" # Higher-frequency cutoff for CB amplifier
fHo=1/(2*(pi)*(Ctc)*(RL))
print "fHo=gm/(2*(pi)*(Ctc)*(RL))= %0.2e"%(fHo)," Hz" # Higher-frequency cutoff for CB amplifier
Avs=(gm*RL)/(1+gm*Rs)
print "Avs=(gm*RL)/(1+gm*Rs)=%0.2f"%(Avs) # Mid-frequency gain for CB amplifier
Ri=1/gm
print "Ri= 1/gm=%0.2f"%(Ri)," ohm" #output resistance for CB amplifier
Ro=Beta_o*rc
print "Ro=Beta_o*rc =%0.2e"%(Ro)," ohm" #input resistance CB amplifier
#ERROR NOTE:some parameters in the book have been calculated using gm=40 mA/V while given value is gm=50 mA/V. So ,for part(ii) CC amplifier correct value of R0=20 ohm,Ri=100000 ohm,and for part(iii)CB amplifier over all voltage gain Avs=142.85714 ,Ri=20 ohm all calculated for gm=50 mA/V.
from __future__ import division
tp=10*10**(-3)
print "tp= %0.2f"%(tp)," s" # Time period of pulse
tr=0.05*10**(-6)
print "tr= %0.2e"%(tr)," s" # Rise-Time of pulse
CSH=50*10**(-12)
print "CSH= %0.2e"%(CSH)," farad" #output capacitor
tilt=5
print "percentage tilt= %0.2f"%(tilt),"%" #Sag or percentage tilt of output
Ri=100*10**(3)
print "Ri= %0.2f"%(Ri)," ohm" # source resistance
RL=tr/(2.2*CSH)
print "RL=tr/(2.2*CSH)= %0.2f"%(RL)," ohm" #Load resistance calculation
Cc=(tp*100)/(tilt*Ri)
print "Cc= (tp*100)/( tilt*Ri)=%0.2e"%(Cc)," farad" #capacitance
#ERROR NOTE: calculated value of RL=454.54545 ohm but in book given as 455 ohm