# Chapter3 - Bipolar Junction Transistors(BJTs)¶

## Exa 3.1 - page 182¶

In :
from __future__ import division
# Given data
V_E= -0.7 # in V
Bita=50
RC= 5 # in kΩ
RE= 10 # in kΩ
RE= RE*10**3 # in Ω
RC= RC*10**3 # in Ω
V_CC= 10 # in V
V_BE= -10 # in volt
I_E= (V_E-V_BE)/RE # in A
print "Emitter current = %0.2f mA" %(I_E*10**3)
# I_E= I_B+I_C and I_C= Bita*I_B, so
I_B= I_E/(1+Bita) # in A
print "Base current = %0.1f µA" %(I_B*10**6)
I_C= I_E-I_B #in A
print "Collector current = %0.2f mA" %(I_C*10**3)
V_C= V_CC-I_C*RC # in V
print "The value of V_C = %0.2f Volt" %(V_C)

Emitter current = 0.93 mA
Base current = 18.2 µA
Collector current = 0.91 mA
The value of V_C = 5.44 Volt


## Exa 3.2 - page 183¶

In :
from __future__ import division
# Given data
V_E= 1.7 # in V
V_B= 1 # in V
RC= 5 # in kΩ
RE= 5 # in kΩ
RE= RE*10**3 # in Ω
RC= RC*10**3 # in Ω
RB= 100 #in kΩ\
RB= RB*10**3 # in Ω
V_CC= 10 # in V
V_BE= -10 # in volt
I_E= (V_CC-V_E)/RE # in A
I_B= V_B/RB # in V
# Formula I_B=  (1-alpha)*I_E
alpha= 1-I_B/I_E
print "Value of alpha = %0.3f " %(alpha)
beta= alpha/(1-alpha)
print "Value of beta =  %.01f " %beta
V_C= (I_E-I_B)*RC-V_CC # in volt
print "Collector voltage = %0.2f Volt" %V_C
# Answer in the textbook is not accurate.

Value of alpha = 0.994
Value of beta =  165.0
Collector voltage = -1.75 Volt


## Exa 3.3 - page 187¶

In :
from __future__ import division# Given data
from numpy import log
# Given data
V_CC= 10 # in V
V_CE= 3.2 # in V
RC= 6.8 # in kΩ
RC= RC*10**3 # in Ω
I_S= 1*10**-15 # in A
V_T= 25*10**-3 # in V
I_C1= (V_CC-V_CE)/RC # in A
print "Part(a) : "
# Formula I_C= I_S*%e**(V_BE1/V_T)
V_BE1= V_T*log(I_C1/I_S) # in volt
print "Collector current = %0.1f mA" %(I_C1*10**3)
print "Value of V_BE = %0.1f Volt" %(V_BE1)

print "Part(b) : "
v_in= 5*10**-3 # in V
Av= -(V_CC-V_CE)/V_T # in V/V
print "Voltage gain = %0.1f V/V" %(Av)
v_o= abs(Av )*v_in # in V
print "Change in output voltage = %0.2f Volt" %v_o

print "Part(c) : "
#for V_CE= 0.3 V
V_CE= 0.3 # in V
I_C2= (V_CC-V_CE)/RC # in A
# I_C1= I_S*%e**(V_BE1/V_T)      (i)
# I_C2= I_S*%e**(V_BE2/V_T)      (ii)
# divide the equation (ii) by (i)
delta_V_BE= V_T*log(I_C2/I_C1) # in volt    ( where delta_V_BE = V_BE2-V_BE1 )
print "The positive increament in V_BE = %0.1f mV" %(delta_V_BE*10**3)

print "Part(d) : "
v_o= 0.99*V_CC # in V
I_C3= (V_CC-v_o)/RC # in A
delta_V_BE= V_T*log(I_C3/I_C1) # in V
print "The negative increament in V_BE = %0.1f mV" %(delta_V_BE*10**3 )

Part(a) :
Collector current = 1.0 mA
Value of V_BE = 0.7 Volt
Part(b) :
Voltage gain = -272.0 V/V
Change in output voltage = 1.36 Volt
Part(c) :
The positive increament in V_BE = 8.9 mV
Part(d) :
The negative increament in V_BE = -105.5 mV


## Exa 3.4 - page 197¶

In :
from __future__ import division
# Given data
V_CC= 10 # in V
V_CE= 5 # in V
V_BE= 0.7 # in V
I_C= 5*10**-3 # in mA
bita= 100
R_C= (V_CC-V_CE)/I_C # in Ω
I_B= I_C/bita # in A
R_B= (V_CC-V_BE)/I_B # in Ω
print "The value of R_C = %0.1f kΩ" %(R_C*10**-3)
print "The value of I_B = %0.1f µA" %(I_B*10**6)
print "The value of R_B = %.01f kΩ" %(R_B*10**-3)

# Note: The value of base current in the book is wrong

The value of R_C = 1.0 kΩ
The value of I_B = 50.0 µA
The value of R_B = 186.0 kΩ


## Exa 3.5 - page 197¶

In :
%matplotlib inline
from matplotlib.pyplot import plot, text, xlabel, ylabel, show, axes, title, gca
from __future__ import division
from numpy import arange, nditer
# Given data
V_CC= 6 # in V
bita= 100
R_C= 2 # in kΩ
R_C= R_C*10**3 # in Ω
R_B= 530 # in kΩ
R_B= R_B*10**3 # in Ω
# when I_C=0
I_C=0
V_CE= V_CC-I_C*R_C # in volt
V_CE= arange(0,7,0.1) # in Volt
# defining function to get the collector current
def current(V):
it = nditer([V, None])
for v_ce,i in it:
i[...] = (V_CC-v_ce)/R_C*1000
return it.operands
I_C=current(V_CE) # in mA
x=arange(-1,4,0.1)
y=arange(-0.5,1.02,0.1)
plot(V_CE,I_C)
plot(4*(y/y),y,'--')
plot(x,1*(x/x),'--')
text(4,1.02,'Operating Point')
xlabel("V_CE in volts")
ylabel("I_C in mA")
# Setting axes
axes = gca()
axes.set_xlim([0,6])
axes.set_ylim([0,3])
show()
print "DC load line shown in figure"
# When V_CE= 0
I_C= V_CC/R_C #in A
# Operating point for silicon transistor
V_BE= 0.7 # in V
I_B= (V_CC-V_BE)/R_B #in A
I_CQ= bita*I_B # in A
V_CEQ= V_CC-I_CQ*R_C # in volt
print "Operating point is ",V_CEQ," V and ",I_CQ*10**3," mA" DC load line shown in figure
Operating point is  4.0  V and  1.0  mA


## Exa 3.6 - page 203¶

In :
from __future__ import division
# Given data
V_CC= 12 # in V
V_BE= 0.7 # in V
bita= 100
R_C= 10 # in kΩ
R_C= R_C*10**3 # in Ω
R_B= 100 # in kΩ
R_B= R_B*10**3 # in Ω
I_BQ= (V_CC-V_BE)/((1+bita)*R_C+R_B) # in A
I_CQ= bita*I_BQ # in A
V_CEQ= V_CC-(I_CQ+I_BQ)*R_C # in volt
# When
I_C=0
V_CE= V_CC-(I_C+I_BQ)*R_C # in volt
# When
V_CE= 0
I_C= (V_CC-I_BQ*R_C)/R_C #in A
print "Q- point values for circuit is",round(V_CEQ,2),"V and",round(I_CQ*10**3),"mA"

Q- point values for circuit is 1.72 V and 1.0 mA


## Exa 3.7 - page 204¶

In :
from __future__ import division
# Given data
V_CC= 15 # in V
V_BE= 0.7 # in V
V_CE= 5 # in V
I_C= 5 # in mA
I_C=I_C*10**-3 # in A
bita= 100
I_B= I_C/bita # in A
print "Base current = %0.f µA" %(I_B*10**6)
#Apply KVL to collector circuit ,  V_CC= (I_C+I_B)*R_C+V_CE
R_C= (V_CC-V_CE)/(I_C+I_B) # in Ω
print "The value of R_C = %0.2f kΩ" %(R_C*10**-3)
#Apply KVL to base or input circuit,  V_CC= (I_C+I_B)*R_C+V_CE + I_B*R_B
R_B= (V_CC-V_BE-(I_C+I_B)*R_C)/I_B # in ohm
print "The value of R_B = %0.f kΩ " %(R_B*10**-3)

Base current = 50 µA
The value of R_C = 1.98 kΩ
The value of R_B = 86 kΩ


## Exa 3.8 - page 205¶

In :
from __future__ import division
# Given data
V_BE= 0.7 # in V
V_CE= 3 # in V
I_C= 1 # in mA
I_C=I_C*10**-3 # in A
bita= 100
I_B= I_C/bita # in A
# V_CE= V_BE+V_CB and V_CB= I_B*R_B
R_B= (V_CE-V_BE)/I_B # in Ω
print "The value of R_B = %0.f kΩ" %(R_B*10**-3)

The value of R_B = 230 kΩ


## Exa 3.9 - page 208¶

In :
%matplotlib inline
# Exa 3.9
from numpy import nditer, arange
from matplotlib.pyplot import plot, text, xlabel, ylabel, show, axes, title, gca
# Given data
R1= 10;# in kΩ
R1=R1*10**3;# in Ω
R2= 5;# in kΩ
R2=R2*10**3;# in Ω
RC= 1;# in kΩ
RC=RC*10**3;# in Ω
RE= 2;# in kΩ
RE=RE*10**3;# in Ω
V_CC= 15;# in V
V_BE= 0.7;# in V
# When
I_C=0;
V_CE= V_CC-I_C*(RC+RE);# in V
# When V_CE= 0
I_C= V_CC/(RC+RE);# in A
V_B= V_CC*R2/(R1+R2);# in V
I_E= (V_B-V_BE)/RE;# in A
I_C= I_E;# in A (approx)
I_CQ= I_C;# in A
V_CE= V_CC-I_C*(RC+RE);# in V
V_CEQ= V_CE;# in V
#############
V_CE= arange(0,16,0.1);# in Volt
def current(v):
it = nditer([v, None])
for x,y in it:
y[...]= (V_CC-x)/(RC+RE)*1000
return it.operands
I_C = current(V_CE)

#I_C= (V_CC-V_CE)/(RC+RE)*1000;# in mA
plot(V_CE,I_C);
xlabel("V_CE in volts")
ylabel("I_C in mA")
text(8.55,2.15,'Q(8.55V,2.15mA)')
x1=arange(0,8.55,0.01)
y1=arange(0,2.15,0.01)
a=arange(0,8.55,0.01)
yd=2.15*(a/a)
plot(a,yd,'b--')
b=arange(-1,2.15,0.005)
xd=8.55*(b/b)
plot(xd,b,'b--')
show()
print "DC load line shown in figure"
print 'Operating point is ',V_CEQ," V and ",I_CQ*10**3," mA" DC load line shown in figure
Operating point is  8.55  V and  2.15  mA


## Exa 3.10 page 220¶

In :
from __future__ import division
# Given data
V_CC= 10 # in V
V_BB= 3 # in V
V_BE= 0.7 # in V
V_T= 25*10**-3 # in V
bita=100
RC= 3 # in kΩ
RC=RC*10**3 # in Ω
RB= 100 # in kΩ
RB=RB*10**3 # in Ω
I_B= (V_BB-V_BE)/RB # in V
I_C= bita*I_B # in A
V_C= V_CC-I_C*RC # in V
gm= I_C/V_T # in A/V
r_pi= bita/gm # in Ω
# v_be= r_pi/(RB+r_pi)*v_i
v_be_by_v_i= r_pi/(RB+r_pi)
# v_o= -gm*v_be*RC
v_o_by_v_i= -gm*v_be_by_v_i*RC # in V/V
Av= v_o_by_v_i # in V/V
print "Voltage gain = %0.2f V/V  " % (round(Av))
# Answer in the book is not accurate.

Voltage gain = -3.00 V/V


## Exa 3.11 - page 253¶

In :
from __future__ import division
# Given data
V_B= 4 # in V
V_BE= 0.7 # in V
V_CC= 10 # in V
V_E= V_B-V_BE # in V
R_E= 3.3 # in kΩ
R_E=R_E*10**3 # in Ω
RC= 4.7 # in kΩ
RC=RC*10**3 # in Ω
I_E= V_E/R_E # in A
bita=100
alpha= bita/(1+bita)
I_C= alpha*I_E #in A
print "The value of I_C = %0.2f mA" %(I_C*10**3)
V_C= V_CC-I_C*RC # in V
print "The value of V_C = %0.1f Volts" %(V_C)
I_B= I_E/(1+bita) # in A
print "The value of I_B = %0.2f mA" %(I_B*10**3)

The value of I_C = 0.99 mA
The value of V_C = 5.3 Volts
The value of I_B = 0.01 mA


## Exa 3.12 - page 254¶

In :
from __future__ import division
# Given data
V_B= 5 # in V
V_BE= 0.7 # in V
V_CC= 10 # in V
bita=100
R_B= 100 # in kΩ
R_C= 2 # in kΩ
R_B=R_B*10**3 # in Ω
R_C=R_C*10**3 # in Ω
I_B= (V_B-V_BE)/R_B # in A
I_C= bita*I_B #in A
V_C= V_CC-I_C*R_C # in V
I_E= I_C # in A (approx)
print "The value of I_B = %0.3f mA" %(I_B*10**3)
print "The value of I_C = %0.1f mA " %(I_C*10**3)
print "The value of V_C = %0.1f Volts" %(V_C)
print "The value of I_E = %0.1f mA" %(I_E*10**3)

The value of I_B = 0.043 mA
The value of I_C = 4.3 mA
The value of V_C = 1.4 Volts
The value of I_E = 4.3 mA


## Exa 3.13 - page 255¶

In :
from __future__ import division
from sympy import symbols, solve
V_B = symbols('V_B')
# Given data
V_EB= 0.7 # in V
V_E = 0.7 # in V
bita=100
V_EC= 0.2 # in V
V_E= V_EB+V_B # in V
V_CC= 5 # in V
R_E= 1 # in kΩ
R_E=R_E*10**3 # in Ω
R_C= 10 # in kΩ
R_C=R_C*10**3 # in Ω
R_B= 10 # in kΩ
R_B= R_B*10**3 # in Ω
V_E= V_B+V_EB       # (i)
V_C= V_E-V_EC  # (ii)
I_E= (V_CC-V_E)/(R_E)*1000     # mA   (iii)
I_B= V_B/R_B            #         (iv)
I_C= (V_C+V_CC)/R_C   #     (v)
# By using relationship, I_E= I_B+I_C
expr = I_E*1000-(I_B*1000+I_C*1000)
V_B = solve(expr,V_B)
V_B= (9*V_CC-11*V_EB+V_EC)/12 # in V
V_E= V_B+V_EB # in V
V_C= V_B+V_EB-V_EC # in V
I_E= (V_CC-V_E)/R_E# in amp
I_C= (V_B+V_EB-V_EC+V_CC)/R_B # in amp
I_B= V_B/R_B # in amp
print "The value of V_B = %0.2f Volts" %V_B
print "The value of V_E = %0.2f Volts" %V_E
print "The value of V_C = %0.2f Volts" %V_C
print "The value of I_E = %0.2f mA" %(I_E*10**3)
print "The value of I_C = %0.2f mA" %(I_C*10**3)
print "The value of I_B = %0.2f mA" %(I_B*10**3)

The value of V_B = 3.12 Volts
The value of V_E = 3.83 Volts
The value of V_C = 3.62 Volts
The value of I_E = 1.17 mA
The value of I_C = 0.86 mA
The value of I_B = 0.31 mA


## Exa 3.14 - page 257¶

In :
# Given data
bita=100
hFE= 100
VCEsat= 0.2 # in V
VBEsat= 0.8 # in V
VBEactive= 0.7 # in V
VBB= 5 # in V
VCC= 10 # in V
R_C= 3 # in kΩ
R_C=R_C*10**3 # in Ω
R_B= 50 # in kΩ
R_B=R_B*10**3 # in Ω
# Formula VCC= ICsat*R_C+VCEsat
ICsat= (VCC-VCEsat)/R_C #A
print "The value of IC(sat) = %0.2f mA" %(ICsat*10**3)
IBmin= ICsat/bita # in A
# Apply KVL to input circuit,  VBB= IB*R_B+VBEsat
IB= (VBB-VBEsat)/R_B # in A
print "Actual base current = %0.f µA" %(IB*10**6)

The value of IC(sat) = 3.27 mA
Actual base current = 84 µA


## Exa 3.16 - page 259¶

In :
# Given data
# beta= alpha/(1-alpha)
# At alpha= 0.5
alpha= 0.5
beta=  alpha/(1-alpha)
print "At alpha=0.5, the value of beta = %0.f " %beta
# At alpha= 0.9
alpha= 0.9
beta = alpha/(1-alpha)
print "At alpha=0.9, the value of beta is  %0.f " %beta
# At alpha= 0.5
alpha= 0.999
beta= alpha/(1-alpha)
print "At alpha=0.999, the value of beta is %0.f " %beta

At alpha=0.5, the value of beta = 1
At alpha=0.9, the value of beta is  9
At alpha=0.999, the value of beta is 999


## Exa 3.17 - page 259¶

In :
from __future__ import division
# Given data
# alpha= beta/(1-beta)
# At beta= 1
beta=1
alpha= beta/(1+beta)
print "At beta=1, the value of alpha is  %0.2f " %alpha
# At beta= 2
beta=2
alpha= beta/(1+beta)
print "At beta=2, the value of alpha is  %0.2f " %alpha
# At beta= 100
beta=100
alpha= beta/(1+beta)
print "At beta=100, the value of alpha is %0.2f  " %alpha
# At beta= 200
beta=200
alpha= beta/(1+beta)
print "At beta=200, the value of alpha is %0.3f  "%alpha

At beta=1, the value of alpha is  0.50
At beta=2, the value of alpha is  0.67
At beta=100, the value of alpha is 0.99
At beta=200, the value of alpha is 0.995


## Exa 3.18 - page 260¶

In :
from numpy import exp, log
# Given data
VBE= 0.76 # in V
VT= 0.025 # in V
I_C= 10*10**-3 # in A
# Formula I_C= I_S*exp(VBE/VT)
I_S= I_C/(exp(VBE/VT)) # in A
print "The value of I_S = %0.3e A" %I_S
# Part(a) for VBE = 0.7 V
VBE= 0.7 # in V
I_C= I_S*exp(VBE/VT)
print "For VBE = 0.7 V , The value of I_C = %0.3f mA" %(I_C*10**3)

# Part (b) for I_C= 10 µA
I_C= 10*10**-6 # in A
# Formula I_C= I_S*exp(VBE/VT)
VBE= VT*log(I_C/I_S)
print "For I_C = 10 µA, The value of VBE = %0.3f V" %VBE

The value of I_S = 6.273e-16 A
For VBE = 0.7 V , The value of I_C = 0.907 mA
For I_C = 10 µA, The value of VBE = 0.587 V


## Exa 3.19 - page 260¶

In :
from __future__ import division
# Given data
VBE= 0.7 # in V
VT= 0.025 # in V
I_B= 100 # in µA
I_B=I_B*10**-6 # in A
I_C= 10*10**-3 # in A
# Formula I_C= I_S*exp(VBE/VT)
I_S= I_C/(exp(VBE/VT)) # in A
alpha= I_C/(I_C+I_B)
beta= I_C/I_B
IS_by_alpha= I_S/alpha # in A
IS_by_beta= I_S/beta # in A
print "The value of alpha is %0.2f " %alpha
print "The value of beta is  %0.2f " %beta
print "The value of Is/alpha = %0.2e A" %IS_by_alpha
print "The value of Is/beta = %0.2e A" %IS_by_beta

The value of alpha is 0.99
The value of beta is  100.00
The value of Is/alpha = 6.98e-15 A
The value of Is/beta = 6.91e-17 A


## Exa 3.20 - page 261¶

In :
# Given data
VBE= 0.7 # in V
VCC= 10.7 # in V
R_C= 10 #in kΩ
R_C=R_C*10**3 # in Ω
R_B= 10 #in kΩ
R_B=R_B*10**3 # in Ω
I1= (VCC-VBE)/R_C # in A
print "The value of I1 = %0.f mA" %(I1*10**3)
# Part (b)
VC= -4 #in V
VB= -10 # in V
R_C= 5.6 #in kΩ
R_C=R_C*10**3 # in Ω
R_B= 2.4 #in kΩ
R_B=R_B*10**3 # in Ω
VCC=12 # V
I_C= (VC-VB)/R_B # in A
V2= VCC- (R_C*I_C)
print "The value of V2 = %0.f Volt" %V2
# Part (c)
VCC= 0
VCE= -10 # in V
R_C= 10 #in kΩ
R_C=R_C*10**3 # in Ω
I_C= (VCC-VCE)/R_C # in A
V4= 1 # in V
I3= I_C # in A (approx)
print "The value of V4 = %0.f Volt" %V4
print "The value of I3 = %0.f mA" %(I3*10**3)
# Part (d)
VBE= -10 # in V
VCC= 10 # in V
R_B= 5 #in kΩ
R_B=R_B*10**3 # in Ω
R_C= 15 #in kΩ
R_C=R_C*10**3 # in Ω
# I5= I_C and
# I5= (V6-0.7-VBE)/R_B and I_C= (VCC-V6)/R_C
V6= (VCC*R_B+R_C*(0.7+VBE))/(R_C+R_B)
print "The value of V6 = %0.3f Volt" %(V6)
I5= (V6-0.7-VBE)/R_B # in A
print "The value of I5 = %0.3f mA" %(I5*10**3)

The value of I1 = 1 mA
The value of V2 = -2 Volt
The value of V4 = 1 Volt
The value of I3 = 1 mA
The value of V6 = -4.475 Volt
The value of I5 = 0.965 mA


## Exa 3.21 -page 264¶

In :
# Given data
# Part (a)
V_C= 2 # in V
R_C= 1 # in kΩ
R_C=R_C*10**3 # in Ω
V_B= 4.3 # in V
R_B= 200 # in kΩ
R_B=R_B*10**3 # in Ω
I_C= V_C/R_C # in A
I_B= V_B/R_B # in A
beta= I_C/I_B
print "Part (a)"
print "Collector current = %0.f mA" %(I_C*10**3)
print "Base current = %0.1f µA" %(I_B*10**6)
print "The value of beta is %0.f "%beta

# Part (b)
V_C= 2.3 # in V
R_C= 230 # in kΩ
R_C=R_C*10**3 # in Ω
V_B= 4.3 # in V
R_B= 20 # in kΩ
R_B=R_B*10**3 # in Ω
I= V_C/R_C # current through 230Ω resistro i.e. I_C + I_B in A
I_B= (V_B-V_C)/R_B # in A
I_C= I-I_B # in A
bita= abs(I_C/I_B)
print "Part (b)"
print "Collector current = %0.2f mA" %(I_C*10**3)
print "Base current = %0.2f mA" %(I_B*10**3)
print "The value of beta is %0.2f "%beta

# Part (c)
V_E= 10 # in V
R_E= 1 # in kΩ
R_E=R_E*10**3 # in Ω
V_1= 7 # in V
R_C= 1 # in kΩ
R_C=R_C*10**3 # in Ω
V_B= 6.3 # in V
R_B= 100 # in kΩ
R_B=R_B*10**3 # in Ω
I_E= (V_E-V_1)/R_C #in A
I_C=I_E # in A (approx)
V_C= I_C*R_C # in V
I_B= (V_B-V_C)/R_B # in A
beta= I_E/I_B-1
print "Part (c)"
print "Emitter current = %0.2f mA" %(I_E*10**3)
print "Base current = %0.2f µA" %(I_B*10**6)
print "Collector voltage = %0.2f Volts" %(V_C)
print "The value of beta is %0.2f "%(beta)

# Note : In the book the value of base current in the first part is wrong due to calculation error.
#In the part (b) the values of collector current and beta are wrong due to calculation error in the first line of part (b)

Part (a)
Collector current = 2 mA
Base current = 21.5 µA
The value of beta is 93
Part (b)
Collector current = -0.09 mA
Base current = 0.10 mA
The value of beta is 93.02
Part (c)
Emitter current = 3.00 mA
Base current = 33.00 µA
Collector voltage = 3.00 Volts
The value of beta is 89.91


## Exa 3.22 - page 266¶

In :
# Given data
# Part (a)
beta= 30
R_C= 2.2 # in kΩ
R_C=R_C*10**3 # in Ω
R_B= 2.2 # in kΩ
R_B=R_B*10**3 # in Ω
VCC= 3 # in V
VCE= -3 # in V
VBE= 0.7 # in V
V_B= 0 # in V
V_E= V_B-VBE # in V
I_E= (V_E-VCE)/R_B # in A
I_C= I_E # in A
V_C= VCC-I_E*R_C # in V
I_B= I_C/beta # in A
print "Part (a)"
print "The value of V_B = %0.2f V " %V_B
print "The value of V_E = %0.2f V" %V_E
print "The value of I_E = %0.2f mA" %(I_E*10**3)
print "The value of V_C = %0.3f V" %(V_C)
print "The value of I_B = %0.2f mA" %(I_B*10**3)
# Part (b)
R_C= 560 # in Ω
R_B= 1.1 # in kΩ
R_B=R_B*10**3 # in Ω
VCC= 9 # in V
VCE= 3 # in V
V_B= 3 # in V
V_E= V_B+VBE # in V
I_E= (VCC-V_E)/R_B # in A
alpha= beta/(1+beta)
I_C= I_E*alpha # in A
V_C= I_C*R_C # in V
I_B= I_C/beta # in A
print "Part (b)"
print "The value of V_B = %0.2f V " %V_B
print "The value of V_E = %0.2f V" %V_E
print "The value of I_E = %0.2f mA" %(I_C*10**3)
print "The value of V_C = %0.2f V" %(V_C)
print "The value of I_B = %0.3f mA" %(I_B*10**3)

Part (a)
The value of V_B = 0.00 V
The value of V_E = -0.70 V
The value of I_E = 1.05 mA
The value of V_C = 0.700 V
The value of I_B = 0.03 mA
Part (b)
The value of V_B = 3.00 V
The value of V_E = 3.70 V
The value of I_E = 4.66 mA
The value of V_C = 2.61 V
The value of I_B = 0.155 mA


## Exa 3.23 - page 268¶

In :
from numpy import inf
# Given data
VBE= 0.7 # in V
VCC= 9 # in V
VCE= -9 # in V
V_B= -1.5 # in V
R_C= 10 # in kΩ
R_C=R_C*10**3 # in Ω
R_B= 10 # in kΩ
R_B=R_B*10**3 # in Ω
I_B=  abs(V_B)/R_B # in A
V_E= V_B-VBE # in V
print "The value of V_E = %0.2f Volt" %V_E
I_E= (V_E-VCE)/R_B # in A
beta= I_E/I_B-1
alpha= beta/(1+beta)
print "The value of alpha = %0.2f Volt" %alpha
print "The value of beta = %0.2f Volt" %beta
V_C= VCC-I_E*alpha*R_C # in V
print "The value of V_C = %0.2f Volt" %V_C
beta = inf
alpha= beta/(1+beta)
I_B= 0
V_B=0
V_C= VCC-I_E*R_C # in volt
print "The value of V_B = %0.2f V " %V_B
print "The value of V_E = %0.2f V" %V_E
print "The value of V_C = %0.2f V" %(V_C)

The value of V_E = -2.20 Volt
The value of alpha = 0.78 Volt
The value of beta = 3.53 Volt
The value of V_C = 3.70 Volt
The value of V_B = 0.00 V
The value of V_E = -2.20 V
The value of V_C = 2.20 V


## Exa 3.24 - page 269¶

In :
# Given data
VBE_1= 0.7 # in V
VBE_2= 0.5 # in V
V_T= 0.025 # in V
I_C1= 10 # in mV
I_C1= I_C1*10**-3 # in A
#  I_C1= I_S*%e**(VBE_1/V_T)        (i)
#  I_C2= I_S*%e**(VBE_2/V_T)        (ii)
# Devide equation (ii) by (i)
I_C2= I_C1*exp((VBE_2-VBE_1)/V_T) # in A
print "The value of I_C2 = %0.2f µA" %(I_C2*10**6)

The value of I_C2 = 3.35 µA


## Exa 3.25 - page 270¶

In :
# Given data
R1= 10 # in kΩ
R1=R1*10**3 # in Ω
R2= 10 # in kΩ
R2=R2*10**3 # in Ω
I_C=.5 # mA
V_T= 0.025 #in V
I_C= I_C*10**-3 # in A
V= 10 # in V
Vth= V*R1/(R1+R2) # in V
Rth=  R1*R2/(R1+R2) #in Ω
vo= I_C*Rth # in V
vi=V_T # in V
vo_by_vi= vo/vi #in V/V
print "The value of vo/vi = %0.f V/V " %vo_by_vi

The value of vo/vi = 100 V/V


## Exa 3.27 - page 272¶

In :
# Given data
V_B= 2 # in V
V_CC=5 # in V
V_BE= 0.7 # in V
R_E= 1*10**3 # in Ω
R_C= 1*10**3 # in Ω
V_E= V_B-V_BE # in V
I_E= V_E/R_E # in A
I_C= I_E # in A
V_C= V_CC-I_C*R_C #in V
print "At V_B= +2 V"
print "The value of V_E = %0.2f Volts" %V_E
print "The value of V_C = %0.2f Volts" %V_C

# Part (b)
V_B= 0 #in V
V_E= 0 # in V
I_E=  0 # in A
V_C= 5 # in V
print "At V_B= 0 V"
print "The value of V_E = %0.2f Volts" %V_E
print "The value of V_C = %0.2f Volts" %V_C

At V_B= +2 V
The value of V_E = 1.30 Volts
The value of V_C = 3.70 Volts
At V_B= 0 V
The value of V_E = 0.00 Volts
The value of V_C = 5.00 Volts


## Exa 3.28 - page 273¶

In :
# Given data
V_B= 0 # in V
R_E=1*10**3 #in Ω
R_C=1*10**3 #in Ω
V_CC=5 # in V
V_BE= 0.7 # in V
V_E= V_B-V_BE # in V
I_E= (1+V_E)/R_E # in A
I_C= I_E # (approx) in A
V_C= V_CC-I_C*R_C #in V
print "Part (a)"
print "The value of V_E = %0.2f Volts" %V_E
print "The value of V_C = %0.2f Volts" %V_C
# For saturation
V_CE=0.2  # V
V_CB= -0.5 # in V
# I_C= 5-V_C/R_C and V_C= V_E-VCE, So
# I_C= (5.2-V_E)/R_C
# I_E= (V_E+1)/R_E and at the edge of saturation I_C=I_E,
V_E= 4.2/2 #/ in V
V_B= V_E+0.7 # in V
V_C= V_E+0.2 # in V
print "Part (b) "
print "The value of V_E = %0.2f Volts" %V_E
print "The value of V_B = %0.2f Volts" %V_B
print "The value of V_C = %0.2f Volts" %V_C

# Note: In the book , there is a miss print in the last line of this question
#because V_E+0.2= 2.1+0.2 = 2.3  (not 2.8) , so answer in the book is wrong

Part (a)
The value of V_E = -0.70 Volts
The value of V_C = 4.70 Volts
Part (b)
The value of V_E = 2.10 Volts
The value of V_B = 2.80 Volts
The value of V_C = 2.30 Volts


## Exa 3.29 - page 275¶

In :
# Given data
V_CC=5 # in V
V_E= 1 # in V
V_BE= 0.7 # in V
R_E=5*10**3 #in Ω
R_C=5*10**3 #in Ω
R_B= 20*10**3 # in Ω
I_E= (V_CC-V_E)/R_E #  in A
# For pnp transistor V_BE= V_E-V_B
V_B= V_E-V_BE # in V
I_B= V_B/R_B # in A
I_C= I_E-I_B # in A
V_C= I_C*R_C-V_CC # in V
beta= I_C/I_B
alpha= I_C/I_E
print "The value of V_B = %0.1f Volts" %V_B
print "The value of I_B = %0.3f mA" %(I_B*10**3)
print "The value of I_E = %0.1f mA" %(I_E*10**3)
print "The value of I_C = %0.3f mA" %(I_C*10**3)
print "The value of V_C = %0.3f Volts" %V_C
print "The value of beta is %0.1f "%beta
print "The value of alpha is %0.2f "%alpha

The value of V_B = 0.3 Volts
The value of I_B = 0.015 mA
The value of I_E = 0.8 mA
The value of I_C = 0.785 mA
The value of V_C = -1.075 Volts
The value of beta is 52.3
The value of alpha is 0.98


## Exa 3.30 - page 276¶

In :
# Given data
V_CC=5 # in V
V_T= 0.025 # in V
R_C=7.5*10**3 #in Ω
I_C= 0.5 # in mA
I_C= I_C*10**-3 # in A
I_E=I_C # (approx) in A
V_C= V_CC-I_C*R_C # in V
print "dc voltage at the collector = %0.2f Volt" %V_C
gm= I_C/V_T # in A/V
print "The value of gm = %0.f mA/V" %(gm*10**3)
# v_be= -v_i
# v_c= -gm*v_be*R_C
vcbyvi= gm*R_C # in V/V
print "The value of vc/vi = %0.f V/V" %(vcbyvi)

dc voltage at the collector = 1.25 Volt
The value of gm = 20 mA/V
The value of vc/vi = 150 V/V


## Exa 3.31 - page 277¶

In :
# Given data
V_T= 0.025 # in V
I_E= 0.5 # in mA
I_E= I_E*10**-3 # in mA
Rsig= 50 # in Ω
R_C= 5*10**3 # in Ω
re= V_T/I_E # in ohm
Rin= Rsig+re # in ohm
print "Input resistance = %0.f Ω" %Rin
# Part(b)
# vo= -0.99*ie*R_C and ie= -v_sig/Rin
vo_by_v_sig= 0.99*R_C/Rin # in V/V
print "The value of vo/vsig = %0.1f V/V" %(vo_by_v_sig)

Input resistance = 100 Ω
The value of vo/vsig = 49.5 V/V


## Exa 3.32 - page 278¶

In :
# Given data
beta= 200
alpha= beta/(1+beta)
R_C= 100 # in Ω
R_B= 10 # in kΩ
Rsig= 1 # in kΩ
Rsig= Rsig*10**3 # in Ω
R_B= R_B*10**3 # in Ω
V_T= 25*10**-3
V=1.5 # in V
I_E= 10 # in mA
I_E= I_E*10**-3 # in A
I_C= alpha*I_E # in A
V_C= I_C*R_C # in V
I_B= I_C/beta # in A
V_B= V-(R_B*I_B)
gm= I_C/V_T # in A/V
rpi= beta/gm # in Ω
Rib= rpi # in Ω
print "The value of Rib = %0.2f Ω " %Rib
Rin= R_B*rpi/(R_B+rpi) # in Ω
print "The value of Rin = %0.2f Ω" %Rin
# vbe= v_sig*Rin/(Rsig+Rin)
vbe_by_vsig= Rin/(Rsig+Rin)
# vo= -gm*vbe*R_C and = -gm*v_sig*Rin/(Rsig+Rin)
vo_by_vsig= -gm*R_C*vbe_by_vsig # in V/V
print "Overall voltage gain = %0.2f V/V" %vo_by_vsig
# if
vo= 0.4 #(±) in V
vs= vo/abs(vo_by_vsig) # in V
vbe= vbe_by_vsig*vs # in V
print "The value of v_sig = %0.2f mV" %(vs*10**3)
print "The value of v_be = %0.2f mV" %(vbe*10**3)

# Note: There is some difference between in this coding and book solution. But Coding is correct.

The value of Rib = 502.50 Ω
The value of Rin = 478.46 Ω
Overall voltage gain = -12.88 V/V
The value of v_sig = 31.06 mV
The value of v_be = 10.05 mV


## Exa 3.33 - page 280¶

In :
# Given data
V_T= 0.025 # in V
# Part(a)
print "Part (a) : "
V_BE= 690 # in mV
V_BE=V_BE*10**-3 # in V
I_C= 1 # in mA
I_B= 50 # in µA
I_C=I_C*10**-3 # in A
I_B=I_B*10**-6 # in A
beta= I_C/I_B
alpha= beta/(1+beta)
I_E= I_C/alpha # in A
# I_C= I_S*exp(V_BE/V_T)
I_S= I_C/(exp(V_BE/V_T))
print "The value of beta is %0.1f " %beta
print "The value of alpha is %0.4f "%alpha
print "The value of I_E = %0.2f mA" %(I_E*10**3)
print "The value of I_S = %0.2e A" %I_S

# Part(b)
print "Part (b) : "
V_BE= 690 # in mV
V_BE=V_BE*10**-3 # in V
I_C= 1 # in mA
I_C=I_C*10**-3 # in A
I_E= 1.070 # in mA
I_E=I_E*10**-3 # in A
beta= I_C/I_B
alpha= I_C/I_E
beta= alpha/(1-alpha)
I_B= I_C/beta # in A
# I_C= I_S*exp(V_BE/V_T)
I_S= I_C/(exp(V_BE/V_T))
print "The value of beta is %0.3f " %beta
print "The value of alpha is %0.4f "%alpha
print "The value of I_B = %0.2f µA" %(I_B*10**6)
print "The value of I_S = %0.2e A" %I_S

# Part(c)
print "Part (C) : "
V_BE= 580 # in mV
V_BE=V_BE*10**-3 # in V
I_E= 0.137 # in mA
I_B= 7 # in µA
I_E=I_E*10**-3 # in A
I_B=I_B*10**-6 # in A
#  I_C= alpha*I_E  = bita*I_B
beta= I_E/I_B-1
alpha= beta/(1+beta)
I_C= beta*I_B # in A
# I_C= I_S*exp(V_BE/V_T)
I_S= I_C/(exp(V_BE/V_T))
print "The value of beta is %0.3f " %beta
print "The value of alpha is %0.4f "%alpha
print "The value of I_C = %0.3f mA" %(I_C*10**3)
print "The value of I_S = %0.3e A" %I_S

# Part(d)
print "Part (d) : "
V_BE= 780 # in mV
V_BE=V_BE*10**-3 # in V
I_C= 10.10 # in mA
I_B= 120 # in µA
I_C=I_C*10**-3 # in A
I_B=I_B*10**-6 # in A
beta= I_C/I_B
alpha= beta/(1+beta)
I_E= I_C/alpha # in A
# I_C= I_S*%e**(V_BE/V_T)
I_S= I_C/(exp(V_BE/V_T))
print "The value of beta is %0.3f " %beta
print "The value of alpha is %0.4f "%alpha
print "The value of I_E = %0.2f mA" %(I_E*10**3)
print "The value of I_S = %0.4e A" %I_S

# Part(e)
print "Part (e) : "
V_BE= 820 # in mV
V_BE=V_BE*10**-3 # in V
I_E= 75 # in mA
I_B= 1050 # in µA
I_E=I_E*10**-3 # in A
I_B=I_B*10**-6 # in A
#  I_C= alpha*I_E  = bita*I_B
beta= I_E/I_B-1
alpha= beta/(1+beta)
I_C= beta*I_B # in A
# I_C= I_S*exp(V_BE/V_T)
I_S= I_C/(exp(V_BE/V_T))
print "The value of beta is %0.3f " %beta
print "The value of alpha is %0.3f "%alpha
print "The value of I_C = %0.2f mA" %(I_C*10**3)
print "The value of I_S = %0.3e A" %I_S

Part (a) :
The value of beta is 20.0
The value of alpha is 0.9524
The value of I_E = 1.05 mA
The value of I_S = 1.03e-15 A
Part (b) :
The value of beta is 14.286
The value of alpha is 0.9346
The value of I_B = 70.00 µA
The value of I_S = 1.03e-15 A
Part (C) :
The value of beta is 18.571
The value of alpha is 0.9489
The value of I_C = 0.130 mA
The value of I_S = 1.092e-14 A
Part (d) :
The value of beta is 84.167
The value of alpha is 0.9883
The value of I_E = 10.22 mA
The value of I_S = 2.8466e-16 A
Part (e) :
The value of beta is 70.429
The value of alpha is 0.986
The value of I_C = 73.95 mA
The value of I_S = 4.208e-16 A