In [2]:

```
from math import sqrt
from __future__ import division
ibq=(20-0.7)/1.5
print "(i) I_BQ = V_CC-V_BE / R_B =%0.2f mA"%ibq
icq=50*12.87
print "I_CQ = beta * I_BQ =%0.2f mA"%icq
print "(ii) V_CC = I_CQ*R_L + V_CEQ"
vceq=20-(643.5*16*10**-3)
print "Therefore, V_CEQ(in V) = V_CC - I_CQ*R_L =%0.2f V"%vceq
pdc=20*643.5*10**-3
print "(iii) P_DC = V_CC * I_CQ =%0.2f W"%pdc
print "(iv) P_ac Peak current i_b = 9 mA"
ic=50*9
print "i_c = beta * i_b =%0.2f mA"%ic
icm=450/sqrt(2)
print "Therefore, i_c(rms) = I_rms(in mA) = i_c(peak) / sqrt(2) =%0.2f"%icm
pac=318.19**2*16*10**-6
print "Therefore, P_ac = (I_rms)**2 * R_L =%0.2f W"%pac
n=(1.619*100)/12.87
print "(v) Efficiency eta(in percentage) = P_ac/P_DC * 100 =%0.2f"%n
```

In [3]:

```
from __future__ import division
print "R_L = 4 ohm, N1 = 200, N2 = 20"
n=20/200
print "Therefore, n = N2 / N1 =%0.2f"%n
rl=4/(0.1**2)
print "Therefore, R''_L = R1 / n**2 =%0.2f ohm"%rl
print "As N2 < N1, the transformer is step down and hence R''_L > R_L, as the primary winding is high voltage winding."
```

In [4]:

```
from __future__ import division
print "R_L = 8 ohm, R''_L = 648 ohm"
print "Now R''_L = R_L / n**2"
n=8/648
print "Therefore, n**2 = R_L / R''_L =%0.2f"%n
print "Therefore, n = 0.1111 = Turn ratio"
print "But, n = N2 / N1 = 0.1111"
print "Therefore, N1/N2 = 9"
print "Generally the turns ratio is specified as Ni/N2 : 1 i.e. for this transformer it is 9:1"
```

In [6]:

```
from math import sqrt
from __future__ import division
print "R_L=8ohm, I_CQ=140 mA, V_CC=10V"
print "P_ac= 0.48 W"
print "The turns ratio are specified as N1/N2:1 i.e 3:1"
print "Therefore N1/N2=3"
n=1/3
print "n=N2/N1=1/3=%0.2f"%n
r=8/(0.333)**2
print "Therefore R''_L=R_L/n**2=%0.2f"%r
print "1. As the transformer is ideal, whatever is the power delivered to the load,same is the power developed across primary."
print "Therefore P_ac(across primary)=0.48W"
print "2. Using equation (9),"
print "we get, P_ac=(V_1rms**2)/(R''_L)"
print "Therefore 0.48=(V_1rms**2)/72"
v=sqrt(34.56)
print "Therefore V_1rms(in V)=%0.2f"%v,
print "But rms value of the load voltage is V_2rms"
print "So (V1_rms)/(V2_rms)=N1/N2=3/1"
v=5.8787/3
print "Therefore (V2_rms)(in V)=(V1_rms)/3=%0.2f"%v
print "This is the rms value of the load voltage."
print "3. The rms value of the primary voltage is (V1_rms) as calculated above."
print "Therefore (V1_rms)=5.8787 V"
print "4. The power delivered to the load = (I_2rms**2)*R_L ..Refer equation 13."
print "0.48=(I_2rms**2)*8"
i=sqrt(0.06)
print "(I_2rms)[in A]=%0.2f"%i
print "This is the rms value of the load current as the resistance value used is R_L and not R''_L"
print "5. The rms values of primary and secondary are related through the transformation ratio."
print "Therefore (I_1rms)/(I_2rms)=N2/N1=n=0.333"
i=0.2449*0.333
print "Thererfore (I_1rms)[in A]=0.2449*0.333= %0.2f"%i
print "6. The dc power input is,"
p=140*10**-2
print "P_DC =(V_CC)*(I_CQ)=%0.2f W"%p
n=(0.48*100)/1.4
print "7. %%eta=(P_ac *100)/(P_dc)=%0.2f"%n
d=1.4-0.48
print "P_d = %0.2f W"%d
print "This is the power dissipation."
```

In [7]:

```
from __future__ import division
print "R_L = 4 k-ohm, (P_ac)_D = 0.85 W"
print "The current without signal is I_CQ = 31 mA"
print "The current with signal is I_CQ + B0 = 34 mA"
print "The increase is due to harmonic content in the signal"
print "Therefore, B0 = 34 - 31 = 3 mA"
print "But, B2 = B0 = 3 mA"
print "Now (P_ac)_D = P_ac * [1+D2**2] ... Assuming only second harmonic"
print "Therefore, (P_ac)_D = 1/2*B1**2*R_L * [1 + B2**2/B1**2]"
print "Therefore, (P_ac)_D = 1/2*B1**2*R_L + 1/2*B2**2*R_L"
print "0.85 = 1/2*B1**2*(4*10**3) + 1/2*(9*10**-6)*(4*10**3)"
print "Therefore, B1 = 20.396 mA"
d2=300/20.396
print "Therefore, D2(in percentage) = |B2|/|B1| * 100 =%0.2f"%d2
```

In [9]:

```
from math import pi,sqrt
from __future__ import division
print "R_L = 12 ohm, n = N2/N1 = 1/3 = 0.333, eta_trans = 78.5%"
rl=12/(0.333**2)
print "Therefore, R''_L = R_L / n**2 =%0.2f"%rl
pac=(0.5*20**2)/108
print "(i) For P_max, V_m = V_CC"
print "Threfore, (P_ac)_max = 1/2 * V_CC**2/R''_L =%0.2f W"%pac
print "But eta_trans = 78.5%"
pl=0.785*1.8518
print "Therefore, P_L = eta_trans * (P_ac)_max =%0.2f W"%pl
vm=(2*20)/pi
print "(ii) Condition for (P_d)_max is V_m(in V) = 2*V_CC/pi =%0.2f"%vm
pd=(2*20**2)/(108*pi**2)
print "Therefore, (P_d)_max(in W) = 2*V_CC**2 / pi**2*R''_L =%0.2f W"%pd
pdm=0.7505/2
print "Therefore, (P_d)_max per transistor =%0.2f W"%pdm
print "(iii) (P_ac)_max = V_rms * I_rms = V_m/sqrt(2) * I_m/sqrt(2) = V_m*I_m / 2 and V_m = V_CC"
print "Therefore, 1.8518 = 20*I_m / 2"
im=(2*1.8518)/20
print "Therefore, I_m = (I_c)_max =%0.2f A"%im
ibm=(0.1851/25)*10**3
print "and (i_b)_max = (i_c))max / h_fe =%0.2f mA"%ibm
```

In [10]:

```
from math import sqrt,pi
from __future__ import division
print "R_L=16 ohm, V_CC=25 V"
print "Now 2N1=200, N2=50"
n=200/2
print "Therefore N1=%0.2f"%n
n=50/100
print "Therefore n=N2/N1=%0.2f"%n
r=16/(0.5**2)
print "Therefore R''_L =(R_L)/(n**2)=%0.2f"%r
print "For maximum power output, V_m=V_CC"
p=(25**2)/(2*64)
print "i) (P_ac)_max =(V_CC**2)/(2*R_L)=%0.2f W"%p
print "ii) (P_dc)=(2*V_CC*I_m)/pi"
print "Now (V_m)/(I_m)=(R''_L)"
print "and V_m=V_CC"
i=25/64
print "Therefore (I_m)=(V_CC)/(R''_L)=%0.2f"%i
p=(2*25*0.3906)/(pi)
print "Therefore (P_DC) = %0.2f W"%p
n=(4.8848*100)/6.2169
print "iii) %%eta=(P_ac*100)/(P_DC)=%0.2f"%n
p=(2*4.8828)/(pi**2)
print "iv) (P_d)_max[in W]=(2*(P_ac)_max)/(pi**2)=%0.2f W"%p
```

In [11]:

```
from math import sqrt,pi
from __future__ import division
print "R_L = 8 ohm, V_CC = +-12 V hence dual supply version"
pac=0.5*(12**2/8)
print "(1) (P_ac)_max = 1/2 * V_CC**2/R_L =%0.2f W"%pac
print "(2) P_DC = V_CC*I_DC but I_DC = 2*I_m / pi"
print " = V_CC * (2*I_m/pi)"
print "Now R_L = V_m/I_m i.e. I_m = V_m/R_L and V_m = V_CC"
pdc=(12**2*2)/(8*pi)
print "Therefore, P_DC = V_CC * 2 * V_CC/R_L * 1/pi =%0.2f W"%pdc
pdt=11.4591-9
print "Therefore, Total P_D = P_DC - P_ac =%0.2f W"%pdt
pd=2.4591/2
print "Therefore, P_D per transistor =%0.2f W"%pd
n=900/11.4591
print "(3) %%eta(in percentage) = P_ac/P_DC * 100 =%0.2f"%n
```

In [2]:

```
from math import pi
from __future__ import division
print "V_CC=10V ,R_L=5 ohm"
p=100/10
print "i) (P_ac)_max = (V_CC**2)/(2*R_L)=(10**2)/(2*5)=%0.2f W"%p
print "ii) To decide Power rating of transistors means to find (P_D)_max"
v=(2*10)/(pi)
print "V_m = %0.2f V"%v
print "Now, R_L=(V_m)/(I_m)"
i=6.3662/5
print "Therefore (I_m) = %0.2f A"%i
print "Therefore (P_DC)=(V_CC)*(I_DC)=(V_CC)*(2*I_m)/pi (I_DC)=(2*I_m)/pi"
p=(10*2*1.2732)/(pi)
print " =(10*2*1.2732)/(pi) =%0.2f"%p
p=(6.3662*1.2732)/2
print "and (P_ac)[in W]=(V_m*I_m)/2=%0.2f W"%p
p=8.1056-4.5027
print "(P_D)_max = (P_DC)-(P_ac)=%0.2f W"%p
p=4.0528/2
print "Therefore P_D rating fora each transistor =(P_D)_max/2=%0.2f"%p
print "iii) For (P_ac)_max, V_m=V_CC=10 V"
i=10/5
print "I_m = (V_m)/R_L=%0.2f A"%i
p=(10*2*2)/pi
print "P_DC = %0.2f W"%p
```

In [3]:

```
from math import pi
from __future__ import division
print "V_CC = 20 V, R_L = 4 ohm"
vm=(2*20)/pi
print "For (P_d)max, V_m(in V) = 2/pi * V_CC = %0.2f"%vm
print "R_L = V_m / I_m"
im=12.7324/4
print "Therefore, I_m = V_m / R_L =%0.2f A"%im
idc=(2*3.183)/pi
print "Therefore, I_dc = 2*I_m / pi =%0.2f A"%idc
pac=(0.5*12.7324**2)/4
print "Therefore, P_ac = 1/2 * V_m**2/R_L =%0.2f W"%pac
pdc=20*2.0254
print "and P_dc = V_CC * I_DC =%0.2f W"%pdc
pdm=40.508-20.2542
print "Therefore, Total (P_d)max = P_dc - P_ac =%0.2f W"%pdm
pdma=20.2538/2
print "Therefore, (P_d)max per transistor =%0.2f W"%pdma
```

In [4]:

```
from math import pi,sqrt
from __future__ import division
print "For a given transistor,"
print "Maximum collector current =I_cm =1A"
print "Maximum power dissipation =P_d=10W"
print "Maximum V_CEO =40V"
print "For maximum output power,"
print "I_cm=2*I_CQ"
i=1/2
print "I_CQ=1/2=%0.2f"%i
print "and V_CEO=2*V_CC"
v=40/2
print "V_CC = V_CEO/2= %0.2f V"%v
print "and V_cc=V_m=20V for (P_ac)_max"
print "(P_ac)_max=(V_cc**2)/(2*R_L)"
print "R''_L=(V_m)/I_m and I_m=I_CQ=0.5 A"
r=20/0.5
print "R''_L =%0.2f ohm"%r
p=(20**2)/80
print "(P_ac)_max = (20**2)/(2*40)=%0.2f W"%p
print "Now, R''_L=R_L/n**2"
n=sqrt(0.0625)
print "n=N2/N1=%0.2f"%n
n=1/0.25
print "Therefore N1/N2=1/n=%0.2f"%n
print "Hence the turns ratio of output transformer is 4:1"
```

In [5]:

```
from math import pi,sqrt
from __future__ import division
print "Using equation (2) from section 6.7, we can determine I_BQ."
i=(18-0.7)/(1.2*10**3)
print "I_BQ = %0.2f A"%i
i=40*14.4167
print "Now (I_CQ) =(beta*I_BQ)=%0.2f mA"%i
v=18-(576.67*16*10**-3)
print "And (V_CEQ) = (V_CC)-(I_CQ*R_L)=%.2f V"%v
p=18*576.67
print "So P_dc =(V_CC)*(I_CQ)=%0.2f W"%p
print "This is the input power."
print "Now input a.c. voltage causes a base current of 5mA rms"
print "Therefore (I_b)_rms=5 mA"
i=40*5
print "Therefore i_c_rms = 40*5= %0.2f mA"%i
print "This is nothing but the output collector current,rms value I_rms"
print "Therefore I_rms = 200mA"
print "Using equation (13) from section 6.8, we can write,"
p=16*(200*10**-3)**2
print "P_ac = (I_rms**2)**R_L=%0.2f W"%p
print "This is the power delivered to the load."
print "Hence the efficiency of the amplifier is,"
n=(64000*10**-3)/10.38
print "%%eta=(P_ac*100)/P_dc= %0.2f"%n
```

In [6]:

```
from math import pi,sqrt
from __future__ import division
print "V_CC = 20 V, R_L = 20 ohm, turns ratio 1.58:1"
n=1/1.58
print " n = 1/1.58 = %0.2f"%n
rl=20/0.6329**2
print "Therefore, R''_L = R_L / n**2 =%0.2f ohm"%rl
print "(i) For maximum possible peak to peak output voltage, the power output is also maximum possible. For this condition the slope of the a.c. load line can be expressed as"
print "R''_L = V_m/I_m = V_CC/I_CQ"
icq=20/49.928
print "Therefore, I_CQ =%0.2f A"%icq
ibq=0.4/40
print "Therefore, I_BQ = I_CQ/beta =%0.2f A"%ibq
print "This is the required value of the base current"
print "(ii) P_ac = I_Irms**2 * R''_L"
print "But for maximum power output condition,"
irms=0.4/sqrt(2)
print "I_Irms = I_Im/sqrt(2) = I_CQ/sqrt(2) =%0.2f A"%irms
pac=49.928*0.2828**2
print "Therefore, P_ac = %0.2f W"%pac
print "(iii) %eta = P_ac/P_DC * 100"
pdc=20*0.4
print "Now P_DC = V_CC * I_CQ =%0.2f W"%pdc
eta=400/8
print "%%eta(in percentage) =%0.2f"%eta
```

In [7]:

```
from math import sqrt,pi
from __future__ import division
print "R_L = 8 ohm, P_ac(max) = 40 W"
print "2*N1 = 160, N2 = 40"
print "N1 = 80"
n=40/80
print "n = N2/N1 =%0.2f"%n
rl=8/0.5**2
print "Therefore, R''_L = R_L / n**2 =%0.2f ohm"%rl
print "Under maximum condition, V_CC = V_m"
print "Therefore, P_ac(max) = 1/2 * V_CC**2/R''_L"
vcc=sqrt(40*2*32)
print "Therefore, V_CC = %0.2f V"%vcc
print "This is the required value of V_CC"
```

In [8]:

```
from math import sqrt,pi
from __future__ import division
print "For a common collector configuration the voltage gain is 1"
print "Therefore, V_in(peak) = V_out(peak) = 20 V"
print "i.e. V_m = 20 V"
print "Now V_m/I_m = R_L"
im=20/16
print "Therefore, I_m = V_m/R_L =%0.2f A"%im
print "while V_CC = 25 V"
pdc=(2*25*1.25)/pi
print "Now P_DC = 2*V_CC*I_m / pi =%0.2f W"%pdc
pac=(20*1.25)/2
print "P_ac = V_m*I_m / 2 =%0.2f W"%pac
eta=1250/19.8943
print "Therefore, %%eta(in percentage) = P_ac*100 / P_DC =%0.2f"%eta
```

In [9]:

```
from math import sqrt,pi
from __future__ import division
print "(i) As single transistor is used, even harmonic components will not get eliminated"
d2=1000/120
d3=400/120
d4=200/120
d5=100/120
print " D2 = |B2| / |B1| =%0.2f %%"%d2
print " D3 = |B3| / |B1| =%0.2f %%"%d3
print " D4 = |B4| / |B1| =%0.2f %%"%d4
print " D5 = |B5| / |B1| =%0.2f %%"%d5
print "The total harmonic distortion is,"
print "%D = sqrt(D2**2 + D3**2 + D4**2 + D5**2) * 100"
d=sqrt((0.0833**2)+(0.0333**2)+(0.01667**2)+(0.00833**2))*100
print "Therefore, %%D =%0.2f %%"%d
print "(ii) When identical second transistor is used, then all even harmonics get eliminated. So only D3 and D5 will present"
dp=sqrt((0.033**2)+(0.00833**2))*100
print "Therefore, %%D = sqrt(D3**2 + D5**2)*100 =%0.2f %%"%dp
```

In [10]:

```
from math import sqrt,pi
from __future__ import division
print "From the fig 6.50 we can write,"
print "V_CC=20V and R_L=12 ohm"
print "i) The maximum ac power that can be delivered to the load is,"
p=(20**2)/24
print "(P_ac)_max = %0.2f W"%p
print "Let new power delivered to load be (P_ac)''."
print "The corresponding new supply voltage be (V''_cc)"
print "(P_ac)''[in W]=1.36(P_ac)_max ..36% more"
p=1.36*16.67
print "= 1.36*16.67=%0.2f"%p
print "And (P_ac)''=(V''_cc**2)/R_L"
print "Therefore 22.67=(V''_cc**2)/(2*12)"
v=sqrt(544.1088)
print "V''_cc = %0.2f V"%v
print "Hence the percentage increase in supply voltage is,"
p=(23.326-20)/0.2
print "= ((V''_cc-V_cc)*100)/V_cc= %0.2f"%p
print "The mimimum breakdown voltage per transistor this condition is,"
v=2*23.326
print "=2*V''_cc=2*23.326=%0.2f"%v
```

In [12]:

```
from math import sqrt,pi
from __future__ import division
print "The circuit used for providing proper biasing is self bias, for which the various currents can be shown in the fig 6.52"
print "Applying KVL to base emiter loop,"
print "(-V_BE)-(I_E*R_E)+(I*R2)=0"
print "Theredfore (I*100)-(1+beta)*I_B*10=V_BE"
print "100I-210(I_B)=0.5 ..(1)"
print "Applying KVL through R1 and R2,"
print "(-R1(I+I_B))-(R2*I)+V_cc=0"
print "-1000(I+I_B)-100I=-V_cc"
print "1100I+1000(I_B)=25 ..(2)"
print "Multiplying equation (1) by 11 and subtracting from equation (2) we get,"
print "3310(I_B)=19.5"
i=19.5/3310
print "Therefore I_B = %0.2f A"%i
print "Thereofore I_C=(beta*I_B)=117.82 mA=I_CQ"
print "Now n=N2/N1=1/8"
r=5*(8**2)
print "Therefore (R''_L)=(R_L)/(n**2) : "
print "i) For maximum power delivered to load,"
print "V_1m=V_CEQ"
print "Apply KVL to collector-emitter loop,"
print "(-10I_C)-(V_CEQ)-(10*I_E)+V_CC=0"
v=25-(20*(117.82*10**-3))
print "V_CEQ=V_cc-20*I_C=%0.2f ...I_C=I_E"%v
p=(22.643**2)/640
print "(P_ac)_pri = (V_CEQ**2)/(2*R''_L)=%0.2f W"%p
p=0.9*0.8011
print "(P_ac)_max = 0.9*0.8011= %0.2f W"%p
print "This is maximum power delivered to the load."
p=25*117.82*10**-3
print "ii) Now (P_DC)[in W]=V_CC*I_CQ:"
n=(0.721*100)/2.9455
print "%%eta=(P_ac*100)/(P_dc)=%0.2f %%"%n
```

In [13]:

```
from __future__ import division
print "When no signal is applied, current drawn is"
print "I_CQ =200mA from V_cc= 10V"
p=10*200*10**-3
print "P_DC(in W)=V_CC*I_CQ:"
print "For maximum power output,"
print "V_1m=V_cc=10V and I_1m=I_CQ=200mA"
p=2/2
print "P_ac = (V_1rms*I_1rms)=(V_1m*I_1m)/2=(10*200*10**-3)/2=%0.2f W"%p
print "i) P_ac(max)=Maximum output power =1W"
n=100/2
print "ii) %%eta = (P_ac*100)/(P_DC)=%0.2f %%"%n
print "P_d(max)=V_cc*I_CQ= 2W"
print "The power dissipation rating of the transistor must be higher than 2W"
r=10/(200**10**-3)
print "Now R''_L = (V_1m)/(I_1m)=%0.2f ohm"%r
n=1/5
print "Now R_L=2 ohm and n =N2/N1=1/5=%0.2f"%n
r=2/(0.2**2)
print "R''_L =(R_L)/n**2=%0.2f ohm"%r
print "As R''_L required matches with the R''_L of the circuit, impedance matching is perfect"
```

In [14]:

```
from math import sqrt,pi
from __future__ import division
print "B1 = 5*10**-2, B2 = 10**-4, B3 = 3*10**-6"
print "These are the amplitudes of various frequency components"
d2=10**-4/(50*10**-2)
d3=(3*10**-6)/(50*10**-2)
d=sqrt((2*10**-4)**2+(6*10**-6)**2)*100
print "Therefore, D2 = |B2|/|B1| =%0.2f"%d2
print "Therefore, D2 = |B3|/|B1| =%0.2f"%d3
print "Therefore, %%D = sqrt(D2**2 + D3**2)*100 =%0.2f %%"%d
```

In [15]:

```
from __future__ import division
print "V_CC = 12 V, I_PP = 100 mA, R_L = 5 ohm"
print "Therefore, I_m = I_PP/2 = 50 mA"
pac=((2500*10**-6)*5)/2
print "(i) P_ac = I_m**2*R_L / 2 =%0.2f W"%pac
print "(ii) P_ac(max) = 1/2 * V_CC**2/R_L"
print "But P_ac = V_m*I_m/2 and V_m = V_CC for maximum power"
rl=12**2/0.6
print "Therefore, R''_L = %0.2f ohm"%rl
print "But R''_L = R_L/n**2 i.e. 240 = 5/n**2"
print "Therefore, n**2 = 0.02083 i.e. n = 0.1443 = N2/N1"
print "Therefore, N1/N2 = 6.928 : 1"
```

In [16]:

```
from math import pi,sqrt
from __future__ import division
print "I_CQ = 250 mA, V_CEQ = 8 V"
print "V_max = 15 V, V_min = 1 V, I_max = 450 mA, I_min = 40 mA"
ipp=450-40
print "Therefore, I_pp( = I_max - I_min =%0.2f mA"%ipp
vpp=15-1
print "Therefore, V_pp = V_max - V_min =%0.2f V"%vpp
vm=14/2
print "Therefore, V_m = V_pp/2 =%0.2f V"%vm
im=410/2
print "Therefore, I_m = I_pp/2 =%0.2f mA"%im
pac=(7*205*10**-3)/2
pdc=250*8*10**-3
n=71.75/2
pd=2-0.7175
print "(i) P_ac = V_m*I_m/2 = %0.2f W ...output power"%pac
print "(ii) P_DC = I_CQ*V_CEQ = %0.2f W ...inpu:"
print " %%eta = P_ac/P_DC * 100 = %0.2f %% ...efficien Wcy"%pd
```