#Exa 6.1
#find the Base current
#given data
Ic=9.95 #in mA
Ie=10 #in mA
#Calculation
Ib=Ie-Ic #in mA
#result
print"Emitter current is ",Ib,"mA"
#Exa 6.2
#Find (i)Emitter current (ii)Current amplification factor (iii)Current gain factor
#given data
IC=0.98 #in mA
IB=20.0 #in uA
IB=IB*10**-3 #in mA
#Calculation
#part (i)
IE=IB+IC #in mA
#part (ii)
alpha=IC/IE #unitless
#part (iii)
Beta=IC/IB #unitless
#Result
print"Emitter current is",IE,"mA"
print"Current amplification factor is ",alpha
print"Current gain factor is ",Beta
#Exa 6.3
#Emitter current and Collector current
#given data
alfaDC=0.98 #unitless
ICBO=4 #in uA
ICBO=ICBO*10**-3 #in mA
IB=50 #in uA
IB=IB*10**-3 #in mA
#calculation
#Formula : IC=alfaDC*(IB+IC)+ICBO
IC=alfaDC*IB/(1-alfaDC)+ICBO/(1-alfaDC) #in mA
IE=IC+IB #in mA
#Result
print"Emitter current is ",IE,"mA"
print"Collector current is ",IC,"mA"
#Exa 6.4
#Find the collector current
#given data
IB=10 #in uA
IB=IB*10**-3 #in mA
Beta=99 #Unitless
ICO=1 #in uA
ICO=ICO*10**-3 #in mA
#calculation
#Formula : IC=alfa*(IB+IC)+ICO
IC=Beta*IB+(1+Beta)*ICO #in mA
#Result
print"Collector current in mA : ",IC,"mA"
#Example 6.5
#Find (i) alpha , beta and Ie
#(ii)New level of Ib
#Given
Ic=5*10**-3 #mA collector current
Ic_=10*10**-3 #mA collector current
Ib=50*10**-6 #mA, Base current
Icbo=1*10**-6 #micro A, Current to base open current
#Calculation
beta=(Ic-Icbo)/(Ib+Icbo)
alpha=(beta/(1+beta))
Ie=Ib+Ic
Ib=(Ic_-(beta+1)*Icbo)/(beta)
#Result
print"(i) Current gain factor is",round(beta,0)
print" Current amplification factor is",round(alpha,2)
print" Emitter Current is",Ie*1000,"mA"
print"(ii)New level of Ib is",round(Ib*10**6,0),"micro A"
#Exa 6.6
#Find the dynamic input resistance
#given data
delVEB=200 #in Volts
delIE=5 #in mA
#calculation
rin=delVEB/delIE #in ohm
#Result
print"Dynamic input resistance is ",rin,"mohm"
#Exa 6.7
#Determine Current gain and base current
#given data
ICBO=12.5 #in uA
ICBO=ICBO*10**-3 #in mA
IE=2 #in mA
IC=1.97 #in mA
#calculation
alfa=(IC-ICBO)/IE #unitless
IB=IE-IC #in mA
#result
print"Current gain : ",round(alfa,3)
print"Base current is ",IB,"mA"
#Exa 6.8
#given data
RL=4.0 #in Kohm
VL=3.0 #in volt
alfa=0.96 #unitless
IC=VL/RL #in mA
#calculation
IE=IC/alfa #in mA
IB=IE-IC #in mA
#result
print"Base current ia",round(IB,2),"mA"
#Exa 6.9
#Determine Collector emitter voltage and base current
#given data
VCC=10 #in volt
RL=800 #in ohm
VL=0.8 #in volt
alfa=0.96 #unitless
#calculation
#VR=IC*RL
VCE=VCC-VL #in Volt
IC=VL*1000/RL #in mA
Beta=alfa/(1-alfa) #unitless
IB=IC/Beta #in mA
#Result
print"Collector-emitter Voltage is ",VCE,"V"
print"Base current in uA : ",round(IB*1000,2),"microA"
#Exa 6.10
#Determine Collector Current
#given data
alfao=0.98 #unitless
ICO=10 #in uA
ICO=ICO*10**-3 #in mA
IB=0.22 #in mA
#calculation
IC=(alfao*IB+ICO)/(1-alfao) #in mA
#result
print"Collector current is",IC,"mA"
#Exa 6.11
#determine Dynamic input resistance
#given data
delVEB=250 #in mVolts
delIE=1 #in mA
#calculation
rin=delVEB/delIE #in ohm
#result
print"Dynamic input resistance is",rin,"ohm"
#Exa 6.12
#Determine Dynamic output resistance
#given data
delVCE=10-5 #in Volts
delIC=5.8-5 #in mA
#calculation
rin=delVCE/delIC #in Kohm
#result
print"Dynamic output resistance is ",rin,"kohm"
#Exa 6.13
#Determine operating point
%matplotlib inline
import matplotlib.pyplot as plt
#given data
VCC=10 #in volt
RC=8 #in Kohm
Beta=40 #unitless
IB=15 #in uA
IB=IB*10**-3 #in mA
#calculation
# For VCE = 0 Volts
IC=VCC/RC #in mA
#For IC=0 VCE=VCC=10V :
IC=Beta*IB #in mA
VCE=VCC-IC*RC #in Volts
#result
print"Operating point Q is (",VCE,"V,",IC,"mA)"
#Plot
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
Vce=[0,10]
Ic=[1.25,0]
plt.xlabel('Vce,V')
plt.ylabel('Ic,mA')
ax.plot([5.2], [0.6], 'o')
ax.annotate('(5.2V,0.6 mA)', xy=(5.4,0.7))
a=plt.plot(Vce,Ic)
plt.show(a)
#Exa 6.14
#How will the Q point change when load resistance will be change
#given data
Vcc=12 #in Volt collector supply voltage
Ic=1.2 #A, collector current
Rl=5 #kohm load resistance
#calculation
Vce=Vcc-Ic*Rl #Collector emitter voltage
Rl1=7.5
Vce1=Vcc-Ic*Rl1
#result
print"Operating point at load resistance 5 kohm is (",Vce,"V,",Ic,"mA)"
print"Operating point at load resistance 7.5 kohm is (",Vce1,"V,",Ic,"mA)"
#Example 6.15
#Given
Vcc=20 # V, collector voltage
Rc=3.3*10**3
#calculation
#Appling kirchoff's Voltage Law
Ic=0 #for cut off point
Vce=Vcc
Ic=Vcc/Rc
print "Collector to emitter voltage is (Vce)",Vce,"V"
print "Collector current at saturation point is (Ic)",round(Ic*1000,0),"mA"
#Plot
%matplotlib inline
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
Vce=[0,20]
Ic=[6,0]
plt.xlabel("Vce (V)")
plt.ylabel("Ic (mA)")
plt.xlim((0,25))
plt.ylim((0,8))
ax.plot([0], [6], 'o')
ax.annotate('(0,6mA)', xy=(0,6))
ax.plot([20], [0], 'o')
ax.annotate('(20V,0)', xy=(20,0))
a=plt.plot(Vce,Ic)
plt.show(a)
#Exa 6.16
#find collector voltage and base voltage
#given data
Beta=45 #Unitless
VBE=0.7 #in Volt
VCC=0 #in Volt
RB=10**5 #in ohm
RC=1.2*10**3 #in ohm
VEE=-9 #in Volt
#calculation
#Applying Kirchoffs Voltage Law in input loop we have
#IB*RB+VBE+VEE=0
IB=-(VBE+VEE)/RB #in mA
IC=Beta*IB #in mA
VC=VCC-IC*RC #in Volts
VB=VBE+VEE #in Volts
#Result
print"collector voltage is ",round(VC,1),"V"
print"Base voltage is ",VB,"V"