summaryrefslogtreecommitdiff
path: root/Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter11_6.ipynb
blob: 6e0fb200dd9ced3fa53fdd14ac687ec55d233ad6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
{
 "metadata": {
  "name": "",
  "signature": "sha256:8e425c9c2dfbfee43b3a89e44b0fd7936ba869da73ac3c372e9b23848f1cded1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#CHAPTER 11 : MULTISTAGE TRANSISTOR AMPLIFIERS"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "##Example 11.1 : Page number 285"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import log10\n",
      "#Variable declaration\n",
      "#(i)\n",
      "A_v=30;                 #Voltage gain\n",
      "\n",
      "#(ii)\n",
      "A_p=100;                #Power gain\n",
      "\n",
      "\n",
      "#Calculations\n",
      "#(i)\n",
      "A_v_dB=20*log10(A_v);          #Voltage gain, dB\n",
      "A_p_dB=10*log10(A_p);          #Power gain, dB\n",
      "\n",
      "#Results\n",
      "print(\"(i) Voltage gain in dB=%.2fdB\"%A_v_dB);\n",
      "print(\"(ii) Power gain in dB=%ddB\"%A_p_dB);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Voltage gain in dB=29.54dB\n",
        "(ii) Power gain in dB=20dB\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.2 : Page number 285-286\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#(i)\n",
      "A_p_dB=40.0;                #Power gain in dB\n",
      "A_p_b=A_p_dB/10;            #Power gain in bel\n",
      "A_p=10**A_p_b;              #Power gain in number\n",
      "\n",
      "#Result\n",
      "print(\"(i) Power gain in number=%d\"%A_p);\n",
      "\n",
      "#(ii)\n",
      "A_p_dB=43.0;                #Power gain in dB\n",
      "A_p_b=A_p_dB/10;            #Power gain in bel\n",
      "A_p=round(10**A_p_b,-4);              #Power gain in number\n",
      "\n",
      "#Result\n",
      "print(\"(ii) Power gain in number=%d\"%A_p);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Power gain in number=10000\n",
        "(ii) Power gain in number=20000\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.3 : Page number 286\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import log10\n",
      "\n",
      "#Variable declaration\n",
      "Av_1=100.0;                     #Voltage gain of stage 1\n",
      "Av_2=200.0;                     #Voltage gain of stage 2\n",
      "Av_3=400.0;                     #Voltage gain of stage 3\n",
      "\n",
      "#Calculations\n",
      "Av_1_dB=20*log10(Av_1);                     #Voltage gain of stage 1, dB\n",
      "Av_2_dB=20*log10(Av_2);                     #Voltage gain of stage 2, dB\n",
      "Av_3_dB=20*log10(Av_3);                     #Voltage gain of stage 3, dB\n",
      "\n",
      "Av_T=Av_1_dB+Av_2_dB+Av_3_dB;            #Total voltage gain\n",
      "\n",
      "#Result\n",
      "print(\"The total voltage gain=%ddB\"%Av_T);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total voltage gain=138dB\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.4 : Page number 286\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "\n",
      "#Variable declaration\n",
      "A_p_absolute=30.0;                          #Absolute gain of each stage\n",
      "number_of_stages=5.0;                       #number of stages\n",
      "negative_feedback=10.0;                     #negative feedback, dB\n",
      "\n",
      "#Calculations\n",
      "#(i)\n",
      "A_p_dB=round(10*log10(A_p_absolute),2);              #Power gain of one stage. dB\n",
      "A_p_T=number_of_stages * A_p_dB;            #Total power gain, dB\n",
      "\n",
      "#(ii)\n",
      "A_p_resultant=A_p_T-negative_feedback;      #Resultant power gain with negative feedback, dB\n",
      "\n",
      "#Results\n",
      "print(\"The total power gain = %.2fdB.\"%A_p_T);\n",
      "print(\"The resultant power gain with negative feedback = %.2fdB.\"%A_p_resultant);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total power gain = 73.85dB.\n",
        "The resultant power gain with negative feedback = 63.85dB.\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.5 : Page number 286\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "\n",
      "#Variable declaration\n",
      "P_out_2kHz=1.5;                 #Output power at 2 kHz, W\n",
      "P_out_20kHz=0.3;                #Output power at 20 kHz, W\n",
      "P_in=10.0;                      #Input power, mW\n",
      "\n",
      "#Calculations\n",
      "A_p_dB_2kHz=10*log10(P_out_2kHz*1000/P_in);         #dB power gain at 2 kHz\n",
      "A_p_dB_20kHz=10*log10(P_out_20kHz*1000/P_in);       #dB power gain at 20 kHz\n",
      "Fall_in_gain=A_p_dB_2kHz-A_p_dB_20kHz;              #Fall in gain from 2kHz to 20kHz\n",
      "\n",
      "#Results\n",
      "print(\"The fall in gain from 2kHz to 20kHz=%.2fdB\"%Fall_in_gain);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The fall in gain from 2kHz to 20kHz=6.99dB\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.6 : Page number 287\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "\n",
      "#Variable declaration\n",
      "A_v=15.0;                   #Voltage gain, dB\n",
      "V_1=0.8;                    #Input signal voltage, V\n",
      "\n",
      "#Calculations\n",
      "#Since, Av(in decibel)=20*log10(V_2/V_1),\n",
      "V_2=V_1*(10**(A_v/20));                 #Output voltage, V\n",
      "\n",
      "#Results\n",
      "print(\"The output voltage= %.1fV.\"%V_2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The output voltage= 4.5V.\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.7 : Page number 287\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "A_0_dB=70.0;                   #Open circuit voltage gain, dB\n",
      "A_v_dB=67.0;                   #Voltage gain, dB\n",
      "R_out=1.5;                     #Output resistance, kilo ohm\n",
      "\n",
      "#Calculations\n",
      "#Since, A_0_dB-A_v_dB=20*log10(A_0/A_v)\n",
      "ratio_A0_Av=round(10**((A_0_dB-A_v_dB)/20),2);                  #Ratio of open-circuit voltage gain to normal voltage gain\n",
      "\n",
      "#Since, A_v/A_0 = RL/(R_out+RL)\n",
      "RL=R_out/(ratio_A0_Av-1);                               #Load resistor, kilo ohm\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"The load resistance=%.2f kilo ohm.\"%RL);\n",
      "\n",
      "#Note: The value of load resistor is calculated to be 3.6585 kilo ohm and approximated to 3.66. But, in the text it has been approximated to 3.65.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The load resistance=3.66 kilo ohm.\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.8 : Page number 287\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "RL=1.0;                 #Load resistance,  kilo ohm\n",
      "A_v=40.0;               #Voltage gain, dB\n",
      "V_in=10.0;              #Input signal voltage, mV\n",
      "\n",
      "#Calcultaions\n",
      "#(i)\n",
      "#Since, A_v=20*log10(V_out/V_in)\n",
      "V_out=V_in*(10**(A_v/20))/1000;              #Output voltage, V\n",
      "\n",
      "#(ii)\n",
      "P_L=(V_out**2/RL);                            #The load power, mW\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"(i)The output voltage is %dV.\"%V_out);\n",
      "print(\"(ii)The load poweris %dmW.\"%P_L);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)The output voltage is 1V.\n",
        "(ii)The load poweris 1mW.\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.9 : Page number 287-288\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import log10\n",
      "\n",
      "#Variable declaration\n",
      "P_2=40.0;                     #Output power, W\n",
      "R=10.0;                        #Resistance of speaker, ohm\n",
      "\n",
      "\n",
      "#Calculations\n",
      "#(i)\n",
      "A_p_dB=25.0;                                   #Power gain, dB\n",
      "#Since, A_p_dB=10*log10(P_2/P_1)\n",
      "P_1=(P_2/10**(A_p_dB/10))*1000;                #Input power, mW\n",
      "\n",
      "\n",
      "#(ii)\n",
      "A_v_dB=40.0;                                    #Voltage gain, dB\n",
      "\n",
      "#Since, P=(V**2)/R,\n",
      "V_2=(P_2*R)**0.5;                               #Output voltage, V\n",
      "\n",
      "#Since, A_v_dB=20*log10(V_2/V_1)\n",
      "V_1=(V_2/10**(A_v_dB/20))*1000;                #Input voltage, mV\n",
      "\n",
      "\n",
      "#Results\n",
      "\n",
      "print(\"(i)The input power=%.1fmW.\"%P_1);\n",
      "print(\"(ii)The input voltage=%dmV.\"%V_1);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)The input power=126.5mW.\n",
        "(ii)The input voltage=200mV.\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.10 : Page  number 288\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "A_v_max=2000.0;                 #Maximum voltage gain\n",
      "f_max=2.0;                      #Frequency at which maximum voltage gain occurs,kHz\n",
      "A_v=1414.0;                     #Voltage gain at 50 Hz and 10kHz\n",
      "f1=50;                          #Lower frequency at which gain is 1414, Hz\n",
      "f2=10;                          #Upper frequency at which gain is 1414, kHz\n",
      "\n",
      "#Calculation\n",
      "#Since, bandwidth is the range of frequency  over which gain is greater than or equal to 70.7% of maximum gain\n",
      "if((A_v/A_v_max)*100 ==70.7):                               \n",
      "    print(\"(i)The bandwidth is from %dHz to %dkHz.\"%(f1,f2));\n",
      "    print(\"(ii)The lower cut-off frequency=%dHz.\"%f1);\n",
      "    print(\"(iii)The upper cut-off frequency=%dkHz.\"%f2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)The bandwidth is from 50Hz to 10kHz.\n",
        "(ii)The lower cut-off frequency=50Hz.\n",
        "(iii)The upper cut-off frequency=10kHz.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.11 : Page number 291\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "A_v=60.0;               #Voltage gain of single stage amplifier\n",
      "R_C=500.0;              #Collector load, ohm\n",
      "R_in=1.0;               #Input impedance, kilo ohm\n",
      "\n",
      "\n",
      "#Calculation\n",
      "#Since, there is no loading , second stage gain remains at A_v\n",
      "#But, due to loading effect of input impedance of second stage, gain of first stage decreases\n",
      "A_v_2=A_v;                                                    #Voltage gain of second stage\n",
      "R_AC=round((R_C*R_in*1000)/(R_C+R_in*1000),0);              #Effective load of first stage, ohm\n",
      "A_v_1=A_v*R_AC/R_C;                                         #Gain of first stage\n",
      "A_v_T=A_v_1*A_v_2;                                            #Total gain\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"The total gain=%d.\"%A_v_T);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total gain=2397.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.12 : Page number 291-292\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Rin=1.0;                        #Input resistance, kilo ohm\n",
      "beta=100.0;                     #base current amplification factor\n",
      "RC=2.0;                         #Collector load, kilo ohm\n",
      "\n",
      "\n",
      "#Calculation\n",
      "#(i)\n",
      "R_AC=(RC*Rin)/(RC+Rin);               #Effective load on first stage, kilo ohm\n",
      "A_v_1=round(beta*(R_AC/Rin),0);                #Voltage gain of first stage\n",
      "\n",
      "#(ii)\n",
      "A_v_2=round(beta*RC/Rin,0);                      #Voltage gain of second stage\n",
      "\n",
      "#(iii)\n",
      "A_v_T=A_v_1*A_v_2;                      #Total voltage gain\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"(i)The voltage gain of first stage =%d.\"%A_v_1);\n",
      "print(\"(ii)The voltage gain of second stage =%d.\"%A_v_2);\n",
      "print(\"(iii)The total voltage gain =%d.\"%A_v_T);\n",
      "\n",
      "#Note: The approximation inthe text for A_v_1=66.66 is taken as 66 but here it has been taken 67 and therefore the total voltage is 13400 instead of 13200.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)The voltage gain of first stage =67.\n",
        "(ii)The voltage gain of second stage =200.\n",
        "(iii)The total voltage gain =13400.\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.13 : Page number 292\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "RC=10.0;                    #Collector load of single stage amplifier, kilo ohm\n",
      "Rin=1.0;                    #Input resistance, kilo ohm\n",
      "beta=100.0;                 #base current amplification factor\n",
      "RL=100.0;                   #Load resistor, ohm\n",
      "\n",
      "\n",
      "#Calculations\n",
      "R_AC=round((RC*1000)*RL/(RC*1000+RL),-1);                 #Effective collector load,\n",
      "A_v=beta*R_AC/(Rin*1000);                              #Voltage gain\n",
      "\n",
      "#Results\n",
      "print(\"The voltage gain=%d.\"%A_v);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The voltage gain=10.\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.14 : Page number 292-293\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "VCC=20.0;                       #Collector suppply voltage, V\n",
      "R1=10.0;                        #resistor R1, kilo ohm\n",
      "R2=2.2;                         #resistor R2, kilo ohm\n",
      "R3=10.0;                        #resistor R3, kilo ohm\n",
      "R4=2.2;                         #resistor R4, kilo ohm\n",
      "RC_1=3.6;                         #Collector resistor of first stage, kilo ohm\n",
      "RC_2=4.0;                         #Collector resistor of second stage, kilo ohm\n",
      "RE_1=900.0;                     #Emitter resistor of first stage, ohm\n",
      "RE_2=1.0;                       #Emitter resistor of second stage, kilo ohm\n",
      "\n",
      "\n",
      "#Calculations\n",
      "#Biasing potential for the second stage is the voltage across R4 resistor,\n",
      "#so, by voltage divider rule:\n",
      "VB=VCC*R4/(R3+R4);                #Biasing potential for second stage,(Voltage across R4), V\n",
      "\n",
      "print(\"The biasing voltage for the second stage=%.1fV.\"%VB);\n",
      "\n",
      "#If coupling capacitor C_c is replaced by a wire, RC_1 and R3 become parallel\n",
      "Req=round((RC_1*R3)/(RC_1+R3),2);        #Equivalent resistance of R3 parallel with RC_1, kilo ohm\n",
      "VB=VCC*R4/(Req+R4);             #Biasing voltage if coupling capacitor is replaced by a wire, V\n",
      "\n",
      "print(\"The biasing voltage after replacing coupling capacitor by wire=%.2fV.\"%VB);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The biasing voltage for the second stage=3.6V.\n",
        "The biasing voltage after replacing coupling capacitor by wire=9.07V.\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.15 : Page number 293-294\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Function for calculating parallel resistance\n",
      "def pr(r1,r2):\n",
      "    return (r1*r2)/(r1+r2);\n",
      "\n",
      "#Variable declaration\n",
      "VCC=15.0;                           #Collector supply voltage, V\n",
      "R1=22.0;                            #Resistor R1, kilo ohm\n",
      "R2=3.3;                            #Resistor R2, kilo ohm\n",
      "R3=5.0;                            #Resistor R3, kilo ohm\n",
      "R4=1.0;                            #Resistor R4, kilo ohm\n",
      "R5=15.0;                            #Resistor R5, kilo ohm\n",
      "R6=2.5;                            #Resistor R6, kilo ohm\n",
      "R7=5.0;                            #Resistor R7, kilo ohm\n",
      "R8=1.0;                            #Resistor R8, kilo ohm\n",
      "beta=200;                           #Base current amplification factor\n",
      "RL=10.0;                            #Load resistor, kilo ohm\n",
      "V_BE=0.7;                           #Base-emitter voltage, V\n",
      "\n",
      "\n",
      "#Calculations\n",
      "#for 2nd stage\n",
      "V_R6=round(VCC*R6/(R5+R6),2);                #Voltage across R6, V (voltage divider rule)\n",
      "V_R8=round(V_R6-V_BE,2);                     #Voltage across R8, V\n",
      "IE_2=round(V_R8/R8,2);                         #Emitter current through R8, mA (OHM's LAW)\n",
      "re_2nd_stage=round(25/IE_2,1);                 #a.c emitter resistance for 2nd stage, ohm\n",
      "\n",
      "#For 1st stage\n",
      "V_R2=round(VCC*R2/(R1+R2),2);                     #Voltage across R2, V (voltage divider rule)\n",
      "V_R4=round(V_R2-V_BE,2);                          #Voltage across R4, V\n",
      "IE_1=round(V_R4/R4,2);                            #Emitter current through R4, mA (OHM's LAW)\n",
      "re_1st_stage=round(25/IE_1,1);                    #a.c emitter resistance for 1st stage, ohm\n",
      "\n",
      "#(i)\n",
      "Zin_base_2nd_stage=round((beta*re_2nd_stage)/1000,2);               #input resistance of transistor base of 2nd stage, kilo ohm\n",
      "Zin=round(pr(pr(R5,R6),Zin_base_2nd_stage),2);                      #Input impedance of the 2nd stage, kilo ohm\n",
      "R_AC_1st_stage=round(pr(R3,Zin),2);                                          #Effective collector load for 1st stage, kilo ohm\n",
      "A_v_1=round(R_AC_1st_stage*1000/re_1st_stage,0);                                  #voltage gain of 1st stage\n",
      "\n",
      "#(ii)\n",
      "R_AC_2nd_stage=round(pr(R7,RL),2);                          #Effective collector load for 2nd stage, kilo ohm\n",
      "A_v_2=round(R_AC_2nd_stage*1000/re_2nd_stage,1);                  #voltage gain of 2nd stage\n",
      "\n",
      "#(iii)\n",
      "A_v_overall=A_v_1*A_v_2;                            #overall voltage gain\n",
      "\n",
      "\n",
      "#results\n",
      "print(\"(i)The voltage gain of 1st stage=%.0f.\"%A_v_1);\n",
      "print(\"(i)The voltage gain of 2nd stage=%.1f.\"%A_v_2);\n",
      "print(\"(i)The overall voltage gain =%d.\"%A_v_overall);\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)The voltage gain of 1st stage=53.\n",
        "(i)The voltage gain of 2nd stage=191.4.\n",
        "(i)The overall voltage gain =10144.\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.16 : Page number 297\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Primary_impedance=1000.0;                       #Primary impedance, ohm\n",
      "Load_impedance=10.0;                            #Load impedance, ohm\n",
      "\n",
      "#Calculation\n",
      "#since,for maximum power transfer primary impedance should be equal to output impedance\n",
      "#and, impedance of secondary should be equal to load impedance\n",
      "#therfore, primary_impedance/load_impedance=square of(primary to secondary turn ratio)\n",
      "n=(Primary_impedance/Load_impedance)**0.5;           #Primary to secondary turn ratio\n",
      "\n",
      "\n",
      "#Result\n",
      "print('The primary to secondary turn ratio for maximum power transfer=%d.'%n);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The primary to secondary turn ratio for maximum power transfer=10.\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.17 : Page number 297\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "RL=16.0;                    #Load resistor, ohm\n",
      "R_p=10.0;                   #Output impedance of primary, kilo ohm\n",
      "Vp=10.0;                    #Terminal voltage of the source, V\n",
      "\n",
      "#Calculation\n",
      "#Since, for maximum power transfer, the impedance of the primary should be equal to output impedance of the source\n",
      "n=(R_p*1000/RL)**0.5;                        #Primary to secondary turns ratio\n",
      "\n",
      "#Since, power in a transformer remains constant,\n",
      "#ratio of primary to secondary voltageis equal to primary to secondary turns ratio\n",
      "Vs=Vp/n;                                #Voltage across the external load, V\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"The primary to secondary turns ratio=%d.\"%n);\n",
      "print(\"The voltage across the external load=%.1fV.\"%Vs);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The primary to secondary turns ratio=25.\n",
        "The voltage across the external load=0.4V.\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.18 : Page number 297-298\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Rp=300.0;                   #D.C resistance of primary, ohm\n",
      "RL=3.0;                     #Load resistance, ohm\n",
      "R_out=3.0;                  #Ouput resistance of the transistor, kilo ohm               \n",
      "\n",
      "#Calculation\n",
      "#when no signal is applied, only Rp is seen to be the load.\n",
      "#But, when a.c signal is applied, RL in secondary reflects as RL*(squre of turns ratio).\n",
      "#Therefore, load is seen to be Rp in series with the reflected RL in primary.\n",
      "#i.e, R_out=Rp+(n**2 * RL), where n is the turns ratio\n",
      "n=((R_out*1000-Rp)/RL)**0.5;                     #turns ratio\n",
      "\n",
      "#Result\n",
      "print(\"Turns ratio for maximum power transfer=%d.\"%n);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Turns ratio for maximum power transfer=30.\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.19 : Page number 298"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "\n",
      "#Variable declaration\n",
      "f=200.0;                        #Frequency, Hz\n",
      "Z_out=10.0;                     #Output impedance of the transistor, kilo ohm\n",
      "Z_in=2.5;                       #Input impedance of the next stage, kilo ohm\n",
      "\n",
      "#Calculation\n",
      "#For perfect impedance matching,\n",
      "#Z_out should be equal to primary impedance\n",
      "#Z_out=2*pi*f*(primary inductance)\n",
      "Lp=(Z_out*1000)/(2*pi*f);                   #Primary inductance, H\n",
      "\n",
      "#for the secondary side,\n",
      "#Z_in should be equal to impedance of secondary\n",
      "Ls=(Z_in*1000)/(2*pi*f);                    #Secondary inductance, H\n",
      "\n",
      "\n",
      "#result\n",
      "print(\"The primary inductance=%.0fH.\"%Lp);\n",
      "print(\"The secondary inductance=%.0fH.\"%Ls);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The primary inductance=8H.\n",
        "The secondary inductance=2H.\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.20 : Page number 299\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Lp=8.0;                     #Primary inductance, H\n",
      "Ls=2.0;                     #Secondary inductance, H\n",
      "K=10**-5;                   #Inductance to turns ratio, constant\n",
      "\n",
      "#Calculations\n",
      "Np=(Lp/K)**0.5;                  #Primary turns\n",
      "Ns=(Ls/K)**0.5;                  #Secondary turns\n",
      "\n",
      "#Result\n",
      "print(\"The primary turns=%.0f.\"%Np);\n",
      "print(\"The secondary turns=%.0f.\"%Ns);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The primary turns=894.\n",
        "The secondary turns=447.\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.21 : Page number 300-301\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "VCC=12.0;                   #Collector supply voltage, V\n",
      "R1=100.0;                   #Resistor R1, kilo ohm\n",
      "R2=22.0;                    #Resistor R2, kilo ohm\n",
      "R3=22.0;                    #Resistor R3, kilo ohm\n",
      "R4=4.7;                     #Resistor R4, kilo ohm\n",
      "R5=10.0;                    #Resistor R5, kilo ohm\n",
      "R6=10.0;                    #Resistor R6, kilo ohm\n",
      "beta=125;                   #Base current amplification factor\n",
      "V_BE=0.7;                   #Base-emitter voltage, V\n",
      "\n",
      "\n",
      "#Calculation\n",
      "#(i) D.C voltages\n",
      "#For 1st stage:\n",
      "V_B1=VCC*R2/(R1+R2);                    #Voltage at the base of 1st transistor, V (Voltage across R2, using voltage divider rule)\n",
      "V_E1=V_B1-V_BE;                         #Emitter voltage of the 1st transistor, V\n",
      "I_E1=round(V_E1/R4,2);                           #Emitter current of 1st transistor, mA (OHM's LAW)\n",
      "I_C1=I_E1;                              #Collector current of 1st transistor, mA(approximately equals to emitter current)\n",
      "V_C1=VCC-I_C1*R3;                       #Collector voltage of 1st transistor, V\n",
      "\n",
      "#For 2nd stage:\n",
      "V_B2=V_C1;                              #Voltage at the base of 2nd transistor, V (equals to collector voltage of 1st transistor)\n",
      "V_E2=V_C1-V_BE;                         #Emitter voltage of the 2nd transistor, V\n",
      "I_E2=V_E2/R6;                           #Emitter current of 2nd transistor, mA (OHM's LAW)\n",
      "I_C2=I_E2;                              #Collector current 2nd transistor, mA(approximately equals to emitter current)\n",
      "V_C2=VCC-I_C2*R5;                       #Collector voltage of 2nd transistor, V\n",
      "\n",
      "print(\"(i) D.C voltages\");\n",
      "print(\"First stage: VB1=%.2fV , VE1=%.2fV and VC1=%.2fV\"%(V_B1,V_E1,V_C1));\n",
      "print(\"First stage: VB2=%.2fV , VE2=%.2fV and VC2=%.2fV\"%(V_B2,V_E2,V_C2));\n",
      "\n",
      "#(ii)Voltage gain\n",
      "#First stage\n",
      "re_1=25/I_E1;                                   #a.c emitter resistance of 1st transistor, ohm\n",
      "re_2=25/I_E2;                                   #a.c emitter resistance of 2nd transistor, ohm\n",
      "Zin_2nd_stage=beta*re_2/1000;                   #Input impedance of 2nd stage, kilo ohm\n",
      "R_AC=R3*Zin_2nd_stage/(R3+Zin_2nd_stage);       #Total a.c collector load, kilo ohm\n",
      "A_v1=round(R_AC*1000/re_1,0);                                 #Voltage gain of first stage\n",
      "\n",
      "print(\"The voltage gain of first stage=%d.\"%A_v1);\n",
      "\n",
      "#Second stage\n",
      "R_AC=R5;                                        #Total a.c collector load for 2nd stage, kilo ohm(Due to no loading effect, equal to R5)\n",
      "A_v2=round(R5*1000/re_2,0);                                   #Voltage gain of 2nd stage\n",
      "\n",
      "print(\"The voltage gain of second stage=%d.\"%A_v2);\n",
      "\n",
      "A_vT=A_v1*A_v2;                                 #Overall voltage gain\n",
      "\n",
      "print(\"Overall voltage gain=%d.\"%A_vT);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) D.C voltages\n",
        "First stage: VB1=2.16V , VE1=1.46V and VC1=5.18V\n",
        "First stage: VB2=5.18V , VE2=4.48V and VC2=7.52V\n",
        "The voltage gain of first stage=66.\n",
        "The voltage gain of second stage=179.\n",
        "Overall voltage gain=11814.\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}