In [4]:

```
#Variables
VCC = 10 #Collector supply voltage (in volts)
RC = 3.0 * 10**3 #Collector load resistance (in ohm)
Vknee = 1 #Knee voltage for silicon transistor (in volts)
beta = 100 #Current gain
ICperVBE = 4.0 * 10**-3 #Change in IC per volt change in VBE (in Ampere per volt)
#Calculation
VCmax = VCC - Vknee #Maximum voltage drop across resistance RC (in volts)
ICmax = VCmax/RC #Maximum allowable collector current (in Ampere)
ICzero = ICmax/2 #Zero signal collector current (in Ampere)
IBmax = ICmax/beta #Maximum base current (in Ampere)
VBE = ICmax/ICperVBE #Base-emitter voltage (in volts)
#Result
print "Maximum collector current that can be allowd during any part of the input signal is ",ICmax* 10**3,"mA."
print "Minimum zero signal collector current required : ",ICzero*10**3,"mA."
print "Maximum base current ",IBmax*10**3,"mA."
print "Signal voltage (VBE) : ",VBE,"V."
```

In [7]:

```
import math
import numpy
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,ylim,xlim,annotate
#Variables
VCC = 20 #Collector supply voltage (in volts)
RC = 2.0 * 10**3 #Collector load ressitance (in ohm)
RE = 3.0 * 10**3 #Emitter resistance (in ohm)
IC = 0 #Collector current at saturation point (in Ampere)
VCE1 = 0 #Collector-to-emitter voltage at cut-off point (in volts)
#Calculation
VCE = VCC - IC*(RC + RE) #Collector-to-emitter voltage (in volts)
IC1 = VCC/(RC + RE) #Cut-off point collector current (in Ampere)
#Result
print "Following is the graph showing necessary details : "
#Graph
x = numpy.linspace(0,20,100)
y1 = numpy.linspace(0,2,100)
x1 = numpy.linspace(0,10,100)
plot(x,4-4.0/20*x,'b')
plot(x1,2+x1-x1,'--',color='g')
plot(10+y1-y1,y1,'--',color='g')
annotate('Q - POINT',xy=(10,2))
xlim(0,30)
ylim(0,6)
title("DC Load line")
xlabel("-VCE in Volts->")
ylabel("-IC in mA->")
```

Out[7]:

In [8]:

```
#Variables
VCC = 6 #Collector supply voltage (in volts)
VBE = 0 #Emitter-to-base voltage (in volts)
RB = 1.0 * 10**6 #base resistance (in ohm)
beta = 100 #Current gain in CE
RC = 5 * 10**3 #Collector resistance (in ohm)
#Calculation
IB = VCC/RB #Base current (in Ampere)
IC = beta*IB #Collector current (in Ampere)
VCE = VCC - IC*RC #Collector-to-emitter voltage (in volts)
#Result
print "Q-point will be ICQ = ",IC * 10**3,"mA and VCEQ = ",VCE,"V."
```

In [12]:

```
#Variables
VCC = 12 #Collector supply voltage (in volts)
VBE = 0.7 #Emitter-to-base voltage (in volts)
RB = 1130.0 * 10**3 #base resistance (in ohm)
beta = 100 #Current gain in CE
RC = 4 * 10**3 #Collector resistance (in ohm)
#Calculation
IB = (VCC-VBE)/RB #Base current (in Ampere)
IC = beta * IB #Collector current (in Ampere)
VCE = VCC - IC*RC #Collector-to-emitter voltage (in volts)
VC = VCE #Collector voltage (in volts)
VB = VBE #Base voltage (in volts)
VCB = VC - VB #Collector-to-base voltage (in volts)
S = beta + 1 #Stability factor
#Result
print "Base current : ",IB*10**6,"micro-A."
print "Collector current : ",IC * 10**3,"mA."
print "VC : ",VC,"V.\nVB : ",VB,"V.\nVCB : ",VCB,"V."
print "Operating point is ICQ : ",IC*10**3,"mA and VCEQ : ",VC,"V."
print "Stability factof : ",S,"."
```

In [14]:

```
#Variables
dIC = 1.6 * 10**-3 #Change in collector current (in Ampere)
dt = 30 #Change in temperature (in Celsius degree)
ICO = 1.7 * 10**-6 #Reverse saturation current change (in Ampere per Celsius-degree)
#Calculation
dICO = dt*ICO #Change in reverse saturation current (in Ampere)
S = dIC/dICO #Stability factor
#Result
print "Stability factor : ",round(S,2),"."
```

In [17]:

```
#Variables
VBB = 10.0 #Base supply voltage (in volts)
VBE = 0.7 #Base-to-emitter voltage (in volts)
RB = 330 * 10**3 #Base resistance (in ohm)
#Calculation
IB = (VBB - VBE)/RB #Base current (in Ampere)
#Result
print "Base current : ",round(IB*10**6,1),"micro-A."
```

In [24]:

```
import math
import numpy
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,ylim,xlim
#Variables
VCC = 20 #Collector supply voltage (in volts)
RC = 3.3 * 10**3 #Collector resistance (in ohm)
#Calculation
IC = VCC/RC #Collector current at cut-off point (in Ampere)
VCE = 0 #Collector-to-emitter voltage at cut-off point (in volts)
VCE1 = VCC #Collector-to-emitter voltage at saturation point (in volts)
IC1 = 0 #Collector current at saturation point (in Ampere)
#Result
print "Cut-off point : (0,",round(IC*10**3,2),"mA)."
print "Saturation point : (",VCE1,"V ,0)."
#Graph
x = numpy.linspace(0,20,100)
plot(x,6-6.0/20*x,'b')
xlim(0,30)
ylim(0,10)
title("DC Load line")
xlabel("-VCE in Volts->")
ylabel("-IC in mA->")
```

Out[24]:

In [25]:

```
#Variables
VCC = 20 #Collector supply voltage (in volts)
RB = 1.0 * 10**3 #Base resistance (in ohm)
VBE = 0.7 #Base-to-emitter voltage (in volts)
beta = 100 #Current gain in CE
#Calculation
IB = (VCC - VBE)/RB #Base current (in Ampere)
IC = beta *IB #Collector current (in Ampere)
VCE = VCC - IC*RC #Collector-to-Emitter voltage (in volts)
#Result
print "Visualizing that VCE = 0.7 , we can say that transistor is just gone to saturation from active region (not well within saturation)."
```

In [27]:

```
#Variables
VCC = 10 #Collector supply voltage (in volts)
VBB = 5 #Base supply votlage (in volts)
RB = 200 * 10**3 #Base resistance (in ohm)
VBEsat = 0.8 #Base-to-emitter voltage in saturation state (in volts)
VCEsat = 0.2 #Collector-to-emitter voltage in saturation state (in volts)
beta = 100 #Current gain in CE
#Calculation
IB = (VBB-VBEsat)/RB #Base current (in Ampere)
IC = beta*IB #Collector current (in Ampere)
RC = (VCC - VCEsat)/IC #Collector resistance (in volts)
#Result
print "Maximum value of RC for which transistor remains in saturation is ",round(RC*10**-3,3),"ohm."
```

In [29]:

```
#Variables
IE = 2.0 * 10**-3 #Emitter current (in Ampere)
alpha = 0.99 #Current gain in CB
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
VBE = 0.7 #Base-emitter voltage (in volts)
VCB = 1 #Collector-base voltage (in volts)
RC = 4.0 * 10**3 #Collector resistance (in ohm)
#Calculation
IC = alpha*IE #Collector current (in Ampere)
IB = IE - IC #Base current (in Ampere)
VEE = IE*RE + VBE #Emitter supply voltage (in volts)
VCC = IC*RC + VCB #Collector supply voltage (in volts)
#Result
print "IC : ",IC * 10**3,"mA.\nIB : ",IB * 10**3,"mA.\nVEE : ",VEE,"V.\nVCC : ",VCC,"V."
#Slight variation due to higher precision in the value of VCC.
```

In [6]:

```
#Variables
VCC = 30 #Collector supply voltage (in volts)
VBB = 6 #Base voltage (in volts)
VBE = 0.7 #Emitter-to-base voltage (in volts)
RB = 1.0 * 10**6 #Base resistance (in ohm)
beta = 100 #Current gain in CB
ICBO = 0.1 * 10**-6 #Reverse saturation current (in Ampere)
dt = 55-25 #Change in temperature (in Celsius degree)
#Calculation
IB = (VBB - VBE)/RB #Base current (in Ampere)
IC = beta*IB + (beta+1)*ICBO #Collector current (in Ampere)
ICBO55 = ICBO * 2**(dt/10.0) #ICBO at 55 Celsius degree (in Ampere)
VBE55 = 0.7 - 2.5*10**-3*dt #VBE at 55 Celsius degree (in Ampere)
IB55 = (VBB - VBE55)/RB #Base current at 55 Celsius degree(in Ampere)
IC55 = beta*IB55 + (beta+1)*ICBO55 #Collector current 55 Celsius degree (in Ampere)
#Result
print "IB : ",round(IB * 10**6,1),"micro-A and IC :",round(IC*10**3,2),"mA at 25 Celsius degree."
print "IB : ",round(IB55 * 10**6,3),"micro-A and IC :",round(IC55*10**3,4),"mA at 55 Celsius degree."
#Slight variation in IC55 due to higher precision.
```

In [13]:

```
#Variables
hfe = 100 #Current gain in CE
VBE = 0.8 #Base-emitter voltage (in volts)
VBB = 3.0 #Base supply voltage (in volts)
RB = 7.0 * 10**3 #Base resistance (in ohm)
RL = 500 #Load resistance (in ohm)
RC = 3.0 * 10**3 #Collector resistance (in ohm)
VCC = 10 #Collector supply voltage (in volts)
VCE = 1 #Collector-emitter voltage (in volts)
#Calculation
# 7500IB + 500IC = 2.2 ----Eq. 1
# 500IB + 2500IC = 9.0 ----Eq. 2
IC = 2.55 #Collector current (in milli-Ampere)
IB = 0.123 #Base current (in milli-Ampere)
beta = IC/IB #Current gain in CB
VC = -VCE - (IB + IC)*RL*10**-3 #Collector voltage in saturation (in volts)
IBmax = IC/hfe #Maximum base current (in milli-Ampere)
RB = (VBB - VBE - IC*RL*10**-3 )/IBmax #Base resistance (in kilo-ohm)
#Result
print "Since , beta is very less than hfe , therefore it is in saturation region."
print "VC :",VC,"V."
print "Minimum value of RB for which it operates in active region : ",round(RB,2)," kilo-ohm."
```

In [16]:

```
#Variables
R2 = 30.0 * 10**3 #Resistance (in ohm)
R1 = 133.55 * 10**3 #Resistance (in ohm)
alpha = 0.985 #Current gain in CB
VCC = 16 #Collector supply voltage (in volts)
VCE = 6 #Collector-emitter voltage (in volts)
IE = 2.0 * 10**-3 #Emitter current (in Ampere)
IC = alpha*IE #Collector current (in Ampere)
IB = IE - IC #Base current (in Ampere)
beta = alpha/(1-alpha) #Current gain in CE
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
VBE = 0.2 #Base-emitter voltage (in volts)
#Calculation
RC = (VCC - VCE - IE*RE)/IC #Collector resistance (in ohm)
Vth = R2/(R1 + R2)*VCC #Voltage across R2 (in volts)
Rth = R1*R2/(R1+R2) #Thevenin's equivalence resistance (in ohm)
S = (1+beta)/(1 + beta*RE/(Rth+RE)) #Stability factor
#Result
print "R1 : ",round(R1 * 10**-3,2),"kilo-ohm."
print "RC : ",round(RC * 10**-3,2),"kilo-ohm."
print "S : ",round(S,2),"."
```

In [20]:

```
#Variables
beta = 50.0 #Current gain in CE
VBE = 0.6 #Base-emitter voltage (in
RC = 4.7 * 10**3 #Collector resistance (in ohm)
VCC = 20 #Collector supply voltage (in volts)
IC = 2.0 * 10**-3 #Collector current (in Ampere)
VCE = 8 #Collector-emitter voltage (in volts)
RE = 1.3 * 10**3 #Emitter resistance (in ohm)
S = 5 #Stability factor
#Calculation
IB = IC/beta #base current (in Ampere)
IE = IB + IC #Emitter current (in Ampere)
Rth = (S - 1)*RE/(1 -S/(1+beta)) #Thevenin's equivalent resistance (in ohm)
Vth = IB * Rth + VBE + IE*RE #Thevenin's equivalent voltage (in volts)
R1 = Rth * VCC/Vth #Resistance1 (in ohm)
R2 = Vth * R1/(VCC - Vth) #Resistance2 (in ohm)
#Result
print "IB : ",IB*10**3,"mA."
print "IE : ",IE*10**3,"mA."
print "Rth : ",round(Rth*10**-3,3),"kilo-ohm."
print "Vth : ",round(Vth,4),"V."
print "R1 :",round(R1*10**-3,1),"kilo-ohm."
print "R2 : ",round(R2*10**-3,2),"kilo-ohm."
```

In [29]:

```
#Variables
dICbyIC = 10 #Percentage change in IC
VBE25max = 0.7 #Max VBE at 25 degree Celsius (in volts)
VBE25min = 0.6 #Min VBE at 25 degree Celsius (in volts)
ICO25 = 5 * 10**-9 #Reverse saturation current at 25 degree celsius (in Ampere)
ICO145 = 3 * 10**-6 #Reverse saturation current at 145 degree celsius (in Ampere)
VCC = 20 #Collector supply voltage (in volts)
VCE = 10 #Collector-emitter voltage (in volts)
#Calculation
dIC = 5.0/100 * 0.6 #Change in collector current (in milli-Ampere)
dICO = ICO145 - ICO25 #Change in reverse saturation current (in Ampere)
S = dIC/dICO #Stability factor
dVBE = -2.5 * (145 - 25) #Change in VBE (in volts)
SV = dIC/dVBE #SV
beta = hfe = 400 #Current gain in CE
#Rth + Re = 99750.6
#RE = 391.0/3609 * Rth
RE = 9.75 #Emitter resistance (in kilo-ohm)
Rth = 90 #Thevenin's equivalent resistance (in kilo-ohm)
dIC1 = S*ICO145 + SV*dVBE #Change in collector current1 (in milli-Ampere)
IC = 0.6 + dIC1 #Collector current (in milli- Ampere)
IE = IC + IC/beta #Emitter current (in milli-Ampere)
RC = (VCC - IE*RE - VCE)/IC #Collector resistance (in ohm)
VBE = 0.65 #emitter-base voltage (in volts)
Vth = IC/beta*Rth + VBE + IE*RE #Thevenin's equivalent voltage (in volts)
R1 = Rth * VCC/Vth #Resistance1 (in kilo-ohm)
R2 = Vth * R1/(VCC - Vth) #Resistance2 (in kilo-ohm)
#Result
print "RC : ",round(RC,3)," kilo-ohm.\nRE : ",RE," kilo-ohm.\nR1 : ",round(R1)," kilo-ohm.\nR2 : ",round(R2)," kilo-ohm."
```

In [30]:

```
#Variables
hfe = 100 #Current gain in CE
VBE = 0.7 #Emitter-base voltage (in volts)
ICO = 0 #Reverse saturation current (in Ampere)
IC = 1.0 * 10**-3 #Collector current (in Ampere)
VCE = 2.5 #Collector-emitter voltage (in volts)
VCC = 5 #Collector supply voltage (in volts)
R2 = 10 * 10**3 #Resistance2 (in ohm)
#Calculation
R1 = 36.238 * 10**3 #Resistance1 (in ohm)
RC = (VCC - VCE)/IC #Collector resistance (in ohm)
#Result
print "R1 : ",R1*10**-3,"kilo-ohm.\nRC : ",RC*10**-3,"kilo-ohm."
#Printing mistake in the value of RC in book.
```

In [41]:

```
#Variables
beta = 100 #Current gain in CE
R1 = 10.0 * 10**3 #Resistance1 (in ohm)
R2 = 2.2 * 10**3 #Resistance2 (in ohm)
VCC = 10 #Collector supply voltage (in volts)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
RC = 3.6 * 10**3 #Collector resistance (in ohm)
VBE = 0.7 #Base-emitter voltage (in volts)
#Calculation
RB = R1*R2/(R1+R2) #Base resistance (in ohm)
Vth = VCC*R2/(R1 + R2) #Thevenin's voltage (in volts)
IE = (Vth - VBE)/(RE - Rth/(beta + 1)) #Emitter current (in Ampere)
IC = beta*1.0/(beta + 1)*IE #Collector current (in Ampere)
VCE = VCC - IC*RC - IE*RE #Collector-emitter voltage (in volts)
#Result
print "VCE : ",round(VCE),"V.\nIE : ",round(IE*10**3,2),"mA."
#Slight varaition due to higher precision.
```

In [43]:

```
#Variables
beta = 200 #Current gain in CE
R1 = 82.0 * 10**3 #Resistance1 (in ohm)
R2 = 16.0 * 10**3 #Resistance2 (in ohm)
VCC = -22 #Collector supply voltage (in volts)
RE = 750 #Emitter resistance (in ohm)
RC = 2.2 * 10**3 #Collector resistance (in ohm)
VBE = -0.7 #Base-emitter voltage (in volts)
#Calculation
Vth = VCC*R2/(R1 + R2) #Thevenin's equivalent voltage (in volts)
Rth = R1*R2/(R1+R2) #Thevenin's equivalent resistance (in ohm)
IB = (Vth - VBE)/(Rth +(beta+1)*RE)#Base current (in Ampere)
IC = beta * IB #Collector current (in Ampere)
VC = VCC - IC*RC #Output voltage (in volts)
#Result
print "VC : ",round(VC,2),"V."
print "IB : ",round(IB * 10**6,2)," micro-A"
```

In [44]:

```
#Variables
VCC = 20 #collector supply voltage (in volts)
beta = 50 #Current gain in CE
RB = 430.0 * 10**3 #Base resistance (in ohm)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
RC = 2.0 * 10**3 #Collector resistance (in ohm)
VBE = 0.7 #Base-emitter voltage (in volts)
IC = 2 * 10**-3 #Collector current (in Ampere)
#Calculation
VCE = VCC - IC*(RC+RE) #Collector-emitter voltage (in volts)
VC = VCC - RC*IC #Output voltage (in volts)
VE = VC - VCE #Emitter voltage (in volts)
IB = 0.04 * 10**-3 #Base current (in Ampere)
IE = (1+beta)*IB #Emitter current (in Ampere)
VB = VCC - 430*10**3*IB #Base voltage (in volts)
#Result
print "IB : ",IB*10**3,"mA.\nIC : ",IC*10**3,"mA.\nVCE : ",VCE,"V.\nVE : ",VE,"V.\nVB : ",VB,"V.\nVC : ",VC,"V."
```

In [52]:

```
#Variables
alpha = 0.985 #Current gain in CB
R1 = 50.0 * 10**3 #Resistance1 (in ohm)
R2 = 20.0 * 10**3 #Resistance2 (in ohm)
VCC = 20 #Collector supply voltage (in volts)
RE = 2.0 * 10**3 #Emitter resistance (in ohm)
RC = 3.0 * 10**3 #Collector resistance (in ohm)
VBE = 0.7 #Base-emitter voltage (in volts)
#Calculation
Vth = VCC*R2/(R1 + R2) #Thevenin's equivalent voltage (in volts)
Rth = R1*R2/(R1+R2) #Thevenin's equivalent resistance (in ohm)
beta = alpha/(1-alpha) #Current gain in CE
IB = (Vth - VBE)/(Rth +(beta+1)*RE)#Base current (in Ampere)
IC = beta * IB #Collector current (in Ampere)
VCE = VCC - IC*(RE + RC) #Collector-emitter voltage (in volts)
S = (1 + beta)/(1 + beta*(RE/(Rth + RE))) #Stability factor
#Result
print "Operating point will be ICQ : ",round(IC*10**3,2),"mA , VCEQ : ",round(VCE,2),"V."
print "Stability factor : ",round(S,2),"."
#Slight variation due to higher precision.
```

In [53]:

```
#Variables
RL = 1.0 * 10**3 #Load resistance (in ohm)
RE = 200 #Emitter resistance (in ohm)
beta = 100 #Current gain in CE
VCC = 9 #Collector supply voltage (in volts)
ICQ = 3.75 * 10**-3 #Q-point Collector current (in Ampere)
VCEQ = 4.5 #Q-point collector-emitter voltage (in volts)
VBE = 0.7 #Base-emitter voltage (in volts)
#Calculation
IB = ICQ/beta #Base current (in Ampere)
IE = (1 + beta)*IB #Emitter current (in Ampere)
Rth = 20.0 * 10**3 #Thevenin's eq. resistance (in ohm)
Vth = IB*Rth + VBE +IE*RE #Thevenin's equivalent voltage (in volts)
R1 = Rth*VCC/Vth #Resistance1 (in ohm)
R2 = R1*Vth/(VCC - Vth) #Resistance2 (in ohm)
#Result
print "R1 : ",round(R1*10**-3,2),"kilo-ohm.\nR2 : ",round(R2*10**-3,1),"kilo-ohm."
```

In [59]:

```
#Variables
VCC = 22.5 #collector supply voltage (in volts)
beta = 55 #Current gain in CE
RB = 430.0 * 10**3 #Base resistance (in ohm)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
RC = 5.6 * 10**3 #Collector resistance (in ohm)
VBE = 0 #Base-emitter voltage (in volts)
IC = 2 * 10**-3 #Collector current (in Ampere)
R1 = 90 * 10**3 #Resistance1 (in ohm)
R2 = 10 * 10**3 #Resistance2 (in ohm)
#Calculation
Rth = R1*R2/(R1+R2) #Thevenin's eq. resistance (in ohm)
Vth = VCC * R2/(R1 + R2) #Thevenin's eq. voltage (in volts)
IB = (Vth - VBE)/(Rth +(beta + 1)*RE) #Base current (in Ampere)
IC = beta*IB #Collector current (in Ampere)
IE = (beta + 1)*IB #Emitter current (in Ampere)
VCE = VCC - IC*RC - IE*RE #Collector-emitter voltage (in volts)
S = (1 + beta)/(1 + beta*RE/(Rth + RE)) #Stability factor
#Result
print "Operating point , Q will be ICQ =",round(IC*10**3,2),"mA and VCEQ =",VCE,"V."
print "Stability factor : ",round(S,2),"."
#Slight variation due to higher precision.
```

In [69]:

```
#Variables
RC = 2.7 * 10**3 #Collector resistance (in ohm)
RE = 0.68 * 10**3 #Emitter resistance (in ohm)
IB = 20.0 * 10**-6 #Base current (in Ampere)
VCE = 7.3 #Collector-emitter voltage (in volts)
VE = 2.1 #Emitter voltage (in volts)
VBE = 0.7 #Base-emitter voltage (in volts)
#Calculation
IE = VE/RE #Emitter current (in Ampere)
beta = IE/IB - 1 #Current gain in CE
VCC = beta*IB*RC + VCE + IE*RE #Collector supply voltage (in volts)
RB = (VCC - VE)/IB #Base resistance (in ohm)
#Result
print "beta : ",round(beta,1),".\nVCC : ",round(VCC,4),"V.\nRB : ",round(RB*10**-3),"kilo-ohm."
```

In [5]:

```
#Variables
beta=hfe = 100.0 #Current gain in CE
VBE = .6 #Base-emitter voltage (in volts)
IC = 1.0 * 10**-3 #Collector current (in Ampere)
S = 8 #Stability factor
VCC = 10 #Collector supply voltage (in volts)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
VCE = 5 #Collector-emitter resistance (in ohm)
#Calculation
IB = IC/beta #Base current (in Ampere)
IE = IC + IB #Emitter current (in Ampere)
RC = (VCC - VCE - IE*RE)/IC #Collector resistance (in ohm)
Rth = RE*(beta*S/(1+beta-S) -1) #Thevenin's resistance(in ohm)
Vth = IB*Rth + VBE + IE*RE #Thevenin's eq. voltage (in volts)
R1 = Rth*VCC/Vth #Resistance1 (in ohm)
R2 = (Vth*R1)/(VCC-Vth) #Resistance2 (in ohm)
#Result
print "R1 : ",round(R1*10**-3),"kilo-ohm.\nR2 : ",round(R2*10**-3,2),"kilo-ohm."
#Slight variation due to higher precision.
```

In [6]:

```
#Variables
beta = 100 #Current gain in CE
R1 = 2.2 * 10**3 #Resistance1 (in ohm)
R2 = 2.2 * 10**3 #Resistance2 (in ohm)
VBE = 0.7 #Base-emitter voltage (in volts)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
VCC = 5 #Collector supply voltage (in volts)
#Calculation
VA = VCC * R2/(R1 + R2) #Voltage at A (in volts)
IE = (VA - VBE)/RE #Emitter current (in Ampere)
VCEQ = VCC - IE*RE #Q-point VCE (in volts)
ICQ = IE #Q-point IC (in Ampere)
#Result
print "VCEQ : ",VCEQ,"V."
print "ICQ : ",ICQ * 10**3,"mA."
```

In [15]:

```
#Variables
beta = 100 #current gain in CE
VCC = 12 #Collector supply voltage (in volts)
R1 = 15.0 * 10**3 #Resistance1 (in ohm)
R2 = 2.7 * 10**3 #Resistance2 (in ohm)
VBE = 0.7 #Base-emitter voltage (in volts)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
RC = 1.0 * 10**3 #Collector resistance (in ohm)
#Calculation
VA = VCC*R2/(R1 + R2) #Potential at A (in volts)
IE = (VA - VBE)/RE #Emitter current (in Ampere)
IC = IE #Collector current (in Ampere)
VCEQ = VCC - IC*(RC + RE) #VCE at Q (in volts)
ICQ = IE #IC at Q (in volts)
IB = IC/beta #Base current (in Ampere)
#Result
print "VCEQ : ",round(VCEQ,2),"V.\nICQ : ",round(ICQ*10**3,2),"mA."
print "IB : ",round(IB * 10**6,1),"micro-A."
```

In [18]:

```
#Variables
VCC = 16 #Collector supply voltage (in volts)
RC = 3.0 * 10**3 #Collector resistance (in ohm)
RE = 2.0 * 10**3 #Emitter resistance (in ohm)
R1 = 56.0 * 10**3 #Resistance1 (in ohm)
R2 = 20.0 * 10**3 #Resistance2 (in ohm)
alpha = 0.985 #Current gain in CB
#Calculation
beta = alpha/(1-alpha) #Current gain in CE
VBE = 0.3 #Base-emitter voltage (in volts)
VB = VCC * R2/(R1 + R2) #Base voltage (in volts)
IC = (VB - VBE)/RE #Collector current (in Ampere)
VCE = VCC - IC*(RE + RC) #Collector-emitter voltage (in volts)
Rth = R1*R2/(R1 + R2) #Thevenin's eq. resistance (in ohm)
S = (1 + beta)*(1 + Rth/RE)/(1 + beta + Rth/RE) #Stability factor
#Result
print "Operation point : ICQ = ",round(IC*10**3,3),"mA , VCQ = ",round(VCE,3),"V."
print "Stability factor : ",round(S,2),"."
```

In [21]:

```
#Variables
VCC = 20 #Collector supply voltage (in volts)
RL = 4.0 * 10**3 #Load resistance (in ohm)
VCE = 6.0 #Collector-emitter voltage (in volts)
IC = 2.0 * 10**-3 #Collector current (in Ampere)
beta=hfe = 20 #Current gain in CE
ICO = 10 * 10**-6 #Reverse saturation current (in Ampere)
VBE = 0.7 #Base-emitter voltage (in volts)
#Calculation
IB = (IC - (1 + beta)*ICO)/beta #Base current (in Ampere)
IC = beta*IB + (1 + beta)*ICO #Collector current (in Ampere)
IE = (beta + 1)*IB #Emitter current (in Ampere)
RE = (VCC - IC*RL - VCE)/IE #Emitter resistance (in ohm)
Rth = 20.0 * 10**3 #Thevenin's eq. resistance (in ohm)
Vth = IB*Rth + VBE + IE*RE #Thevenin's eq. voltage (in volts)
R1 = Rth*VCC/Vth #Resitance1 (in ohm)
R2 = R1*Vth/(VCC - Vth) #Resistance2 (in ohm)
#Result
print "R1 : ",round(R1*10**-3,1),"kilo-ohm.\nR2 : ",round(R2*10**-3,2),"kilo-ohm."
#Slight variation due to higher precision.
```

In [26]:

```
import math
import numpy
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,ylim,xlim,annotate
#Variables
beta = 100
#Calculation
ICQ = 1.07 #Collector current at Q-point (in milli-Ampere)
VCQ = 5.067 #Collector-emitter voltage at Q-point (in volts)
#Result
print "Following is the graph: "
x = numpy.linspace(0,5.07,100)
y1 = numpy.linspace(0,1.07/2,100)
x1 = numpy.linspace(0,5.067/2,100)
plot(x,1.07-1.07/5.07*x,'b')
plot(x1,1.07/2+x1-x1,'--',color='g')
plot(5.067/2+y1-y1,y1,'--',color='g')
annotate('Q - POINT',xy=(5.067/2,1.07/2))
xlim(0,6)
ylim(0,1.1)
title("DC Load line")
xlabel("-VCE in Volts->")
ylabel("-IC in mA->")
```

Out[26]:

In [36]:

```
#Variables
beta = 50 #current gain in CE
VCC = 12 #Collector supply voltage (in volts)
VBE = 0.7 #Base-emitter voltage (in volts)
RB = 100.0 * 10**3 #Base resistance (in ohm)
RC = 2.0 * 10**3 #Collector resistance (in ohm)
#Calculation
IB = (VCC - VBE)/(beta*RC + RB) #Base current (in Ampere)
IC = beta * IB #Collector current (in Ampere)
VCE = VCC - IC*RC #Collector-emitter voltage (in volts)
VCE1 = 5 #New collector-emitter voltage (in volts)
IC1 = (VCC - VCE1)/RC #Collector current1 (in Ampere)
IB1 = IC1/beta #Base current1 (in Ampere)
RB1 = (VCC - VBE - beta*IB1*RC)/IB1 #Base resistance1 (in ohm)
#Result
print "Value of RB :",round(RB1*10**-3,2)," kilo-ohm."
```

In [41]:

```
#Variables
beta = 100.0 #Current gain in CE
RC = 1.0 * 10**3 #Collector resistance (in ohm)
VCC = 20.0 #Collector supply voltage (in volts)
VBE = 0 #Base-emitter voltage (in volts)
VCEQ = 4 #VCE at Q-point (in volts)
#Calculation
I1C = (VCC - VCEQ)/RC #Collector current1 (in Ampere)
IC = I1C/(1+1/beta) #Collector current (in Ampere)
IB = I1C - IC #base current (in Ampere)
RB = (VCEQ + VBE)/IB #Base resistance (in ohm)
S = (1 + beta)/(1 + beta*RC/(RB + RC)) #Stability factor
#Result
print "Value of collector to base resistance :",RB*10**-3,"kilo-ohm."
print "Stability factor :",S,"."
#Slight variation due to higher precision.
```

In [16]:

```
#Variables
beta = 50 #Current gain in CB
VCC = 10 #Collector supply voltage (in volts)
RC = 2.0 * 10**3 #Collector resistance (in ohm)
VBE = 0 #Base-emitter voltage (in volts)
RB = 100 * 10**3 #Base resistance (in ohm)
#Calculation
IB = VCC/(RB + (1 + beta)*RC) #Base current (in Ampere)
IC = beta*IB #Collector current (in Ampere)
VCE = VCC - (IC + IB)*RC #Collector-emitter voltage (in volts)
ICQ = IC #IC at Q-point (in Ampere)
S = (1 + beta)/(1 + beta*RC/(RC + RB)) #Stability factor
#Result
print "ICQ : ",round(ICQ * 10**3,3),"mA , VCEQ : ",round(VCE,2),"V."
print "Stability factor : ",round(S,2),"."
```

In [43]:

```
#Variables
betamax = 180 #Current gain max. in CE
betamin = 60 #Current gain min. in CE
VCC = 15 #Collector supply voltage (in volts)
RB = 250.0 * 10**3 #Base resistance (in ohm)
RC = 2.5 * 10**3 #Collector resistance (in ohm)
VBE = 0.7 #Base-collector voltage (in volts)
#Calculation
#IC = (VCC - VBE)/(RC + RC/beta + RB/beta) #Collector current (in Ampere)
ICmax = (VCC - VBE)/(RC + RC/betamax + RB/betamax) #Max. collector current (in Ampere)
ICmin = (VCC - VBE)/(RC + RC/betamin + RB/betamin) #Min. collector current (in Ampere)
#Result
print "Maximum collector current : ",round(ICmax*10**3,2),"mA."
print "Minimum collector current : ",round(ICmin*10**3,2),"mA."
```

In [44]:

```
#Variables
beta = 90 #Current gain in CE
VCC = 18 #Collector supply voltage (in volts)
RB = 510.0 * 10**3 #Base resistance (in ohm)
RC = 2.2 * 10**3 #Collector resistance (in ohm)
RE = 1.8 * 10**3 #Emitter resistance (in ohm)
VBE = 0.7 #Base-collector voltage (in volts)
#Calculation
IB = VCC/(RB + (1 + beta)*(RC+RE)) #Base current (in Ampere)
IC = beta*IB #Collector current (in Ampere)
VCE = VCC - (IC + IB)*RC -IE*RE #Collector-emitter voltage (in volts)
#Result
print "When beta increases due to temperature , VCE will decrease."
```

In [55]:

```
#Variables
beta = 90.0 #Current gain in CE
VCC = 10 #Collector supply voltage (in volts)
RB = 250.0 * 10**3 #Base resistance (in ohm)
RC = 4.7 * 10**3 #Collector resistance (in ohm)
RE = 1.2 * 10**3 #Emitter resistance (in ohm)
VBE = 0.7 #Base-collector voltage (in volts)
beta1 = 135 #New current gain in CE
#Calculation
IC = (VCC-VBE)/((RE+RC)*(1/beta + 1) + RB/beta)#Collector current (in Ampere)
ICQ = IC #Collector current at Q-point (in Ampere)
IB = IC/beta #Base current (in Ampere)
VCE = VCC - (IC + IB)*(RC+RE) #Collector-emitter voltage (in volts)
VCEQ = VCE #Collector-emitter voltage at Q-point (in volts)
ICQ1 = (VCC-VBE)/((RE+RC)*(1/beta1 + 1) + RB/beta1) #Collector current1 at Q-point (in Ampere)
IB1 = ICQ1/beta #Base current1 (in Ampere)
VCEQ1 = VCC - (ICQ1 + IB)*(RC+RE) #Collector-emitter voltage (in volts)
#Result
print "Old ICQ :",round(ICQ*10**3,2),"mA and new ICQ :",round(ICQ1*10**3,3),"mA."
print "Old VCEQ :",round(VCEQ,2),"V and new VCEQ :",round(VCEQ1,2),"V."
#Slight variation due to higher precision.
```

In [60]:

```
#Variables
VCC = 15 #Collector supply voltage (in volts)
IE = 1.0 * 10**-3 #Emitter current (in Ampere)
beta = 99 #Current gain in CE
VBE = 0.7 #Base-emitter voltage (in volts)
R1 = 17.0 * 10**3 #Resistance1 (in ohm)
RC = 1.0 * 10**3 #Collector resistance (in ohm)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
#Calculation
IB = (IE)/(beta + 1) #Base current (in Ampere)
IC = beta*IB #Collector current (in Ampere)
IR1 = (VBE + IE*RE)/R1 #Current through R1 (in Ampere)
IRF = IR1 + IB #Current through RF (in Ampere)
I1C = IC + IRF #Current through RC (in Ampere)
Vo = VCC - I1C*RC #Output voltage (in volts)
RF = (Vo - VBE - IE*RE)/IRF #Resistance RF (in ohm)
#Result
print "Vo : ",round(Vo,1),"V."
print "RF : ",round(RF*10**-3,2),"kilo-ohm."
#Calculation error in book for value of RF.
```

In [65]:

```
#Variables
VCC = 24 #Collector supply voltage (in volts)
VBE = 0.7 #Base-emitter voltage (in volts)
RC = 10.0 * 10**3 #Collector resistance (in ohm)
RE = 270.0 #Emitter resistance (in ohm)
VCE = 5 #Collector-emitter voltage (in volts)
beta = 45 #Current gain in CE
#Calculation
IE = (VCC - VCE )/(RC + RE) #Emitter current (in Ampere)
IB = IE/(beta + 1) #Base current (in Ampere)
RB = (VCC - VBE - IE*(RE + RC))/IB #Base resistance (in ohm)
#Result
print "R : ",round(RB*10**-3,1),"kilo-ohm."
#Slight variation due to higher precision.
```

In [71]:

```
#Variables
VCC = 20 #Collector supply voltage (in volts)
VBE = 0.7 #Base-emitter voltage (in volts)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
beta = 100 #Current gain in CE
IC = 2.0 * 10**-3 #Collector current (in Ampere)
S = 10 #Stability factor
#Calculation
IB = IC/beta #Base current (in Ampere)
IE = IB + IC #Emitter current (in Ampere)
Rth = beta*S*RE/(1 + beta - S) - RE #Thevenin's eq. resistance (in ohm)
Vth = IB*Rth + VBE + IE*RE #Thevenin's eq. voltage (in volts)
R1 = Rth*VCC/Vth #Resitance1 (in ohm)
R2 = R1*Vth/(VCC - Vth) #Resistance2 (in ohm)
#Result
print "Rth : ",round(Rth),"ohm."
print "IB : ",round(IB*10**6),"micro-A."
print "IE : ",round(IC*10**3,2),"mA."
print "Vth : ",round(Vth,1),"V."
print "R1 : ",round(R1*10**-3,1),"kilo-ohm."
print "R2 : ",round(R2*10**-3,1),"kilo-ohm."
#Slight variations due to higher precision.
```

In [94]:

```
import math
import numpy
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,ylim,xlim,annotate
#Variables
RC = 3.0 * 10**3 #Collector resistance (in ohm)
RL = 12.0 * 10**3 #Load resistance (in ohm)
R1 = 16.0 * 10**3 #Resitance1 (in ohm)
R2 = 4.0 * 10**3 #Resistance2 (in ohm)
RE = 2.0 * 10**3 #Emitter Resistance (in ohm)
VCEcutoff = VCC = 20 #Collector supply voltage (in volts)
#Calculation
IC = VCC/(RC + RE) #Collector current(in Ampere)
VE = VCC*R2/(R1 + R2) #Voltage across R2 (in volts)
IE = VE/RE #Emitter current (in Ampere)
ICQ = IE #IC at Q-point (in Ampere)
VCEQ = VCC - ICQ*(RC + RE) #VCE at Q-point (in Ampere)
Rac = RC*RL/(RC + RL) #AC resistance (in ohm)
ICsat = ICQ + VCEQ/Rac #IC saturation (in Ampere)
VCEoff = VCEQ + ICQ*Rac #VCE cut-off for ac load line (in volts)
#Result
print "Following is the graph of ac and dc load lines."
#Graph
x = numpy.linspace(0,20,100)
x2 = numpy.linspace(0,14.8,100)
y1 = numpy.linspace(0,2,100)
x1 = numpy.linspace(0,10,100)
plot(x,4-4/20.0*x,'b')
plot(x2,6.17-6.17/14.8*x2,'r')
plot(x1,2+x1-x1,'--',color='g')
plot(10+y1-y1,y1,'--',color='g')
annotate('Q',xy=(10,2.2))
annotate('DC load line',xy=(14,1.3))
annotate('AC load line',xy=(5.5,4))
xlim(0,20)
ylim(0,7)
title("DC and AC Load lines")
xlabel("-VCE in Volts->")
ylabel("-IC in mA->")
```

Out[94]:

In [95]:

```
#Variables
dVBE = 0.025 #Change in VBE (in volts)
dIB = 15.0 * 10**-6 #Change in base current (in Ampere)
dIC = 1.2 * 10**-3 #Change in collector current (in Ampere)
RC = 6.0 * 10**3 #Collector resistance (in ohm)
RL = 12.0 * 10**3 #Load resistance (in ohm)
#Calculation
Rin = dVBE/dIB #Input resistance (in ohm)
beta = dIC/dIB #Current gain in CE
Rac = RC*RL/(RC+RL) #AC load (in ohm)
Av = beta*Rac/Rin #Voltage gain
Ap = beta*beta*Rac/Rin #Power gain
#Result
print "Input resistance : ",round(Rin*10**-3,3),"kilo-ohm."
print "Current gain : ",beta,"."
print "AC load : ",Rac*10**-3,"kilo-ohm."
print "Voltage gain : ",Av,"."
print "Power gain : ",Ap,"."
```