summaryrefslogtreecommitdiff
path: root/Electronic_Principles_/Chapter_16_New.ipynb
blob: 82ef1353cd33bead9a39cb0e329c08dd6e56e400 (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
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "CHAPTER 16 Frequency Effets"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-1, Page 567"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.1.py\n",
      "#Amplifier has midband Av of 200, with cutoff frequencies f1=20 Hz, f2=20KHz. \n",
      "#Find voltage gain for 5Hz & 200KHz input frequencies.\n",
      "\n",
      "#Variable declaration\n",
      "Avm=200                #mid band voltage gain\n",
      "f1=20                  #cutoff frequency1 (Hz)\n",
      "f2=20*10**3            #cutoff frequency2 (Hz)\n",
      "fi1=5                  #input frequency1(Hz)\n",
      "fi2=200*10**3          #input frequency2(Hz)\n",
      "\n",
      "#Calculation\n",
      "Av=0.707*Avm                     #voltage gain at either frequency\n",
      "Av1=Avm/(1+(f1/fi1)**2)**0.5     #voltage gain for 5Hz\n",
      "Av2=Avm/(1+(fi2/f2)**2)**0.5     #voltage gain for 200KHz\n",
      "\n",
      "#Result\n",
      "print 'voltage gain for 200KHz = ',round(Av1,2)\n",
      "print 'voltage gain for 5Hz = ',round(Av2,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain for 200KHz =  48.51\n",
        "voltage gain for 5Hz =  19.9\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-2, Page 568"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.2.py\n",
      "#In figure 16-4a OP-Amp with midband Av of 100,000. \n",
      "#if f2=10Hz, then what does frequency response look like? \n",
      "\n",
      "#Variable declaration\n",
      "Avm=100000             #mid band voltage gain\n",
      "f2=10                  #cutoff frequency (Hz)\n",
      "\n",
      "#Calculation\n",
      "Av=0.707*Avm                     #voltage gain at cutoff frequency\n",
      "\n",
      "#Result\n",
      "print 'voltage gain for 10Hz = ',Av"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain for 10Hz =  70700.0\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-3, Page 569"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.3.py\n",
      "#In preceding example , what is Av if input frequencies: 100Hz, 1KHz, 10KHZ, 100 KHz, 1MHz?\n",
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "#Variable declaration\n",
      "Avm=100000               #mid band voltage gain\n",
      "fc=10.0                  #cutoff frequency (Hz)\n",
      "fi1=100.0                #input frequency1(Hz)\n",
      "fi2=1*10**3              #input frequency2(Hz)\n",
      "fi3=10*10**3             #input frequency3(Hz)\n",
      "fi4=100*10**3            #input frequency4(Hz)\n",
      "fi5=1*10**6              #input frequency5(Hz)\n",
      "\n",
      "#Calculation\n",
      "Av1=Avm/(1+(fi1/fc)**2)**0.5     #voltage gain for 100Hz\n",
      "Av2=Avm/(1+(fi2/fc)**2)**0.5     #voltage gain for 1KHz\n",
      "Av3=Avm/(1+(fi3/fc)**2)**0.5     #voltage gain for 10KHz\n",
      "Av4=Avm/(1+(fi4/fc)**2)**0.5     #voltage gain for 100KHz\n",
      "Av5=Avm/(1+(fi5/fc)**2)**0.5     #voltage gain for 1MHz\n",
      "\n",
      "#Result\n",
      "print 'voltage gain for 100Hz = ',math.ceil(Av1)\n",
      "print 'voltage gain for 1KHz = ',math.ceil(Av2)\n",
      "print 'voltage gain for 10KHz = ',math.ceil(Av3)\n",
      "print 'voltage gain for 100KHz = ',math.ceil(Av4)\n",
      "print 'voltage gain for 1MHz = ',math.ceil(Av5)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain for 100Hz =  9951.0\n",
        "voltage gain for 1KHz =  1000.0\n",
        "voltage gain for 10KHz =  100.0\n",
        "voltage gain for 100KHz =  10.0\n",
        "voltage gain for 1MHz =  1.0\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-4, Page 571"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.4.py\n",
      "#Calculate power gain(dB) for following values Ap=1,2,4,8\n",
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "#Variable declaration\n",
      "Ap1=1                    #power gain1\n",
      "Ap2=2                    #power gain2\n",
      "Ap3=4                    #power gain3\n",
      "Ap4=8                    #power gain4\n",
      "\n",
      "#Calculation\n",
      "Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)\n",
      "Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)\n",
      "Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)\n",
      "Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)\n",
      "\n",
      "#Result\n",
      "print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
      "print 'decibel power gain Ap2(dB) = ',round(Ap_db2,2),'dB'\n",
      "print 'decibel power gain Ap3(dB) = ',round(Ap_db3,2),'dB'\n",
      "print 'decibel power gain Ap4(dB) = ',round(Ap_db4,2),'dB'\n",
      "print 'Each time Ap increase by factor 2, decibel power gain increases by 3 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel power gain Ap1(dB) =  0.0 dB\n",
        "decibel power gain Ap2(dB) =  3.01 dB\n",
        "decibel power gain Ap3(dB) =  6.02 dB\n",
        "decibel power gain Ap4(dB) =  9.03 dB\n",
        "Each time Ap increase by factor 2, decibel power gain increases by 3 dB\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-5, Page 571"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.5.py\n",
      "#Calculate decibel power gain for following values Ap=1,0.5,0.25,0.125\n",
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "#Variable declaration\n",
      "Ap1=1                        #power gain1\n",
      "Ap2=0.5                      #power gain2\n",
      "Ap3=0.25                     #power gain3\n",
      "Ap4=0.125                    #power gain4\n",
      "\n",
      "#Calculation\n",
      "Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)\n",
      "Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)\n",
      "Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)\n",
      "Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)\n",
      "\n",
      "#Result\n",
      "print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
      "print 'decibel power gain Ap2(dB) = ',round(Ap_db2,2),'dB'\n",
      "print 'decibel power gain Ap3(dB) = ',round(Ap_db3,2),'dB'\n",
      "print 'decibel power gain Ap4(dB) = ',round(Ap_db4,2),'dB'\n",
      "print 'Each time Ap decreases by factor 2, decibel power gain decreases by 3 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel power gain Ap1(dB) =  0.0 dB\n",
        "decibel power gain Ap2(dB) =  -3.01 dB\n",
        "decibel power gain Ap3(dB) =  -6.02 dB\n",
        "decibel power gain Ap4(dB) =  -9.03 dB\n",
        "Each time Ap decreases by factor 2, decibel power gain decreases by 3 dB\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-6, Page 572"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.6.py\n",
      "#Calculate decibel power gain for following values Ap=1,10,100,1000\n",
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "#Variable declaration\n",
      "Ap1=1                       #power gain1\n",
      "Ap2=10                      #power gain2\n",
      "Ap3=100                     #power gain3\n",
      "Ap4=1000                    #power gain4\n",
      "\n",
      "#Calculation\n",
      "Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)\n",
      "Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)\n",
      "Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)\n",
      "Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)\n",
      "\n",
      "#Result\n",
      "print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
      "print 'decibel power gain Ap2(dB) = ',Ap_db2,'dB'\n",
      "print 'decibel power gain Ap3(dB) = ',Ap_db3,'dB'\n",
      "print 'decibel power gain Ap4(dB) = ',Ap_db4,'dB'\n",
      "print 'Each time Ap increases by factor 10, decibel power gain increases by 10 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel power gain Ap1(dB) =  0.0 dB\n",
        "decibel power gain Ap2(dB) =  10.0 dB\n",
        "decibel power gain Ap3(dB) =  20.0 dB\n",
        "decibel power gain Ap4(dB) =  30.0 dB\n",
        "Each time Ap increases by factor 10, decibel power gain increases by 10 dB\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-7, Page 572"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.7.py\n",
      "#Calculate decibel power gain for following values Ap=1,0.1,0.01,0.001\n",
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "#Variable declaration\n",
      "Ap1=1                        #power gain1\n",
      "Ap2=0.1                      #power gain2\n",
      "Ap3=0.01                     #power gain3\n",
      "Ap4=0.001                    #power gain4\n",
      "\n",
      "#Calculation\n",
      "Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)\n",
      "Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)\n",
      "Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)\n",
      "Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)\n",
      "\n",
      "#Result\n",
      "print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
      "print 'decibel power gain Ap2(dB) = ',Ap_db2,'dB'\n",
      "print 'decibel power gain Ap3(dB) = ',Ap_db3,'dB'\n",
      "print 'decibel power gain Ap4(dB) = ',Ap_db4,'dB'\n",
      "print 'Each time Ap decreases by factor 10, decibel power gain decreases by 10 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel power gain Ap1(dB) =  0.0 dB\n",
        "decibel power gain Ap2(dB) =  -10.0 dB\n",
        "decibel power gain Ap3(dB) =  -20.0 dB\n",
        "decibel power gain Ap4(dB) =  -30.0 dB\n",
        "Each time Ap decreases by factor 10, decibel power gain decreases by 10 dB\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-8, Page 575"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.8.py\n",
      "#What is total voltage gain in decibels?\n",
      "#find decibel voltage gain of each stage and total.\n",
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "#Variable declaration\n",
      "Av1=100                     #voltage gain1\n",
      "Av2=200                     #voltage gain2\n",
      "\n",
      "#Calculation\n",
      "Av=Av1*Av2                    #total voltage gain\n",
      "Av_db=20*math.log10(Av)       #decibel total voltage gain(dB)\n",
      "Av_db1=20*math.log10(Av1)     #decibel voltage gain(dB)\n",
      "Av_db2=20*math.log10(Av2)     #decibel voltage gain(dB)\n",
      "Avt_db=Av_db1+Av_db2          #decibel total voltage gain(dB)\n",
      "\n",
      "#Result \n",
      "print 'decibel total voltage gain Av(dB) = ',round(Av_db,2),'dB'\n",
      "print 'decibel voltage gain Av1(dB) = ',Av_db1,'dB'\n",
      "print 'decibel voltage gain Av2(dB) = ',round(Av_db2,2),'dB'\n",
      "print 'so, again, decibel total voltage gain by addition of both: Avt(dB) = ',round(Avt_db,2),'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel total voltage gain Av(dB) =  86.02 dB\n",
        "decibel voltage gain Av1(dB) =  40.0 dB\n",
        "decibel voltage gain Av2(dB) =  46.02 dB\n",
        "so, again, decibel total voltage gain by addition of both: Avt(dB) =  86.02 dB\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-9, Page 577"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.9.py\n",
      "#Impedance matched stages with R=50 Ohm. \n",
      "#Find total decibel gain, total power gain & total voltage gain.\n",
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "#Variable declaration\n",
      "Av_db1=23                    #voltage gain1(dB)\n",
      "Av_db2=36                    #voltage gain2(dB)\n",
      "Av_db3=31                    #voltage gain3(dB)\n",
      "\n",
      "#Calculation\n",
      "Avt_db=Av_db1+Av_db2+Av_db3          #decibel total voltage gain(dB)\n",
      "Ap=10**(Avt_db/10)                   #power gain by taking antilog\n",
      "Avt=10**(Avt_db/20.0)                #total voltage gain by taking antilog\n",
      "\n",
      "#Result \n",
      "print 'decibel total voltage gain Avt(dB) = ',Avt_db,'dB'\n",
      "print 'power gain Ap = ',Ap\n",
      "print 'total voltage gain Avt = ',math.ceil(Avt)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel total voltage gain Avt(dB) =  90 dB\n",
        "power gain Ap =  1000000000\n",
        "total voltage gain Avt =  31623.0\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-10, Page 577"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.10.py\n",
      "#In preceding example, What is ordinary Av of each stage?\n",
      "\n",
      "#Variable declaration\n",
      "Av_db1=23                    #voltage gain1(dB)\n",
      "Av_db2=36                    #voltage gain2(dB)\n",
      "Av_db3=31                    #voltage gain3(dB)\n",
      "\n",
      "#Calculation\n",
      "Av1=10**(Av_db1/20.0)        #voltage gain of stage 1 by taking antilog\n",
      "Av2=10**(Av_db2/20.0)        #voltage gain of stage 2 by taking antilog\n",
      "Av3=10**(Av_db3/20.0)        #voltage gain of stage 3 by taking antilog\n",
      "\n",
      "#Result \n",
      "print 'voltage gain of stage 1 : Av1 = ',round(Av1,2)\n",
      "print 'voltage gain of stage 1 : Av2 = ',round(Av2,2)\n",
      "print 'voltage gain of stage 1 : Av3 = ',round(Av3,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain of stage 1 : Av1 =  14.13\n",
        "voltage gain of stage 1 : Av2 =  63.1\n",
        "voltage gain of stage 1 : Av3 =  35.48\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-11, Page 579"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.11.py\n",
      "#Output of an amplifier is 24 dBm. What is output power?\n",
      "\n",
      "#Variable declaration\n",
      "Ap_dbm=24                           #power gain(dBm)\n",
      "\n",
      "#Calculation\n",
      "P=10**(Ap_dbm/10.0)                 #Output power(mW)\n",
      "\n",
      "#Result \n",
      "print 'Output power P = ',round(P,2),'mW'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output power P =  251.19 mW\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-12, Page 580"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.12.py\n",
      "#Output of an amplifier is -34 dBV. What is output voltage?\n",
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "#Variable declaration\n",
      "Av_dbV=-34                          #voltage gain(dBV)\n",
      "\n",
      "#Calculation\n",
      "V=10**(Av_dbV/20.0)                 #Output voltage(V)\n",
      "\n",
      "#Result \n",
      "print 'Output voltage V = ',math.ceil(V*1000),'mV'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage V =  20.0 mV\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-13, Page 583"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.13.py\n",
      "#OP-Amp gives midband Av of 100,000. \n",
      "#a cutoff f=10Hz, and roll off rate of 20 dB per decade. find ordinary voltage gain at 1MHz.\n",
      "\n",
      "#Variable declaration\n",
      "Avm=100000             #mid band voltage gain\n",
      "f2=10                  #cutoff frequency (Hz)\n",
      "\n",
      "#Calculation\n",
      "Av_db=20*math.log10(Avm)       #decibel total voltage gain(dB)\n",
      "\n",
      "#Result\n",
      "print 'voltage gain for 10Hz = ',Av_db1,'dB'\n",
      "print 'At 1MHz, due to roll off factor of 20 dB, voltage gain reduce to 0 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain for 10Hz =  20.0 dB\n",
        "At 1MHz, due to roll off factor of 20 dB, voltage gain reduce to 0 dB\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-14, Page 588"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.14.py\n",
      "#Draw ideal bode plot for lag circuit of figure 16-18a.\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "R=5*10**3                      #resistance(Ohm)\n",
      "C=100*10**-12                  #Capacitance (F)\n",
      "\n",
      "#Calculation\n",
      "f2=(2*math.pi*R*C)**-1          #cutoff frequency (Hz)\n",
      "\n",
      "#Result\n",
      "print 'cutoff frequency f2 = ',round((f2/1000),2),'KHz'\n",
      "print 'After f2, response rolls off at rate of 20 dB/decade'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cutoff frequency f2 =  318.31 KHz\n",
        "After f2, response rolls off at rate of 20 dB/decade\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-15, Page 589"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.15.py\n",
      "#dc amplifier stage has a midband Av of 100. \n",
      "#If RTH facing bypass capacitor is 2KOhm. What is the ideal bode plot?\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "R=2*10**3                      #resistance(Ohm)\n",
      "C=500*10**-12                  #Capacitance (F)\n",
      "\n",
      "#Calculation\n",
      "f2=(2*math.pi*R*C)**-1          #cutoff frequency (Hz)\n",
      "\n",
      "#Result\n",
      "print 'cutoff frequency f2 = ',round((f2/1000),2),'KHz'\n",
      "print 'After f2, response rolls off at rate of 20 dB/decade up to funity of 15.9 MHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cutoff frequency f2 =  159.15 KHz\n",
        "After f2, response rolls off at rate of 20 dB/decade up to funity of 15.9 MHz\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-17, Page 592"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.17.py\n",
      "#The amplifier of figure 16-22a has a Av of 100,000.\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "R=5.3*10**3                #resistance(Ohm)\n",
      "C=30*10**-12               #Capacitance (F)\n",
      "Av=100000                  #voltage gain\n",
      "\n",
      "#Calculation\n",
      "Cout_M=C                     #input Miller Capacitance (F)\n",
      "Cin_M=Av*C                   #input Miller Capacitance (F)\n",
      "f2=(2*math.pi*R*Cin_M)**-1    #cutoff frequency (Hz)\n",
      "\n",
      "#Result\n",
      "print 'cutoff frequency f2 = ',round(f2,3),'Hz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cutoff frequency f2 =  10.01 Hz\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-18, Page 595"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.18.py\n",
      "#What is upper cutoff frequency for circuit shown in figure 16-24a?\n",
      "\n",
      "#Variable declaration\n",
      "TR=1*10**-6                #rise time(s)\n",
      "\n",
      "#Calculation\n",
      "f2=0.35/TR                 #cutoff frequency (Hz)\n",
      "\n",
      "#Result\n",
      "print 'cutoff frequency f2 = ',f2/1000,'KHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cutoff frequency f2 =  350.0 KHz\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-19, Page 597"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.19.py\n",
      "#calculate low-cutoff frequency for each coupling and by-pass capacitor. \n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "re=22.7                 #from past dc calculation (example:9-5)(Ohm)\n",
      "VCC=10                  #collector voltage(V)\n",
      "RC=3.6                  #Collector resistance (KOhm)\n",
      "RE=1                    #Emitter resistance (KOhm)\n",
      "R1=10                   #Base resistance1 (KOhm)\n",
      "R2=2.2                  #Base resistance2 (KOhm)\n",
      "VBE=0.7                 #Base-emitter voltage drop(V)\n",
      "RL=10                   #Load resistance2 (KOhm)\n",
      "B=150                   #current gain\n",
      "RG=0.6                  #source resistance(KOhm)\n",
      "C1=0.47*10**-6          #input capacitance(F)\n",
      "C3=2.2*10**-6           #output capacitance(F)\n",
      "C2=10*10**-6            #emitter capacitance(F)\n",
      "\n",
      "#Calculation\n",
      "Rinb=B*re/1000                                #Rin(base) (KOhm)\n",
      "Ri=RG+((R1**-1)+(Rinb**-1)+(R2**-1))**-1      #thevenin resistance facing i/p capacitor\n",
      "f1i=((2*math.pi*Ri*C1)**-1)/1000                      #input cutoff frequency (Hz)\n",
      "Ro=RC+RL                                      #thevenin resistance facing o/p capacitor\n",
      "f1o=((2*math.pi*Ro*C3)**-1)/1000                      #output cutoff frequency (Hz)\n",
      "Zout=(((RE**-1)+((re/1000)**-1))**-1)+((((R1**-1)+(R2**-1)+(RG**-1))**-1)/B) #thevenin resistance facing emitter-bypass capacitor\n",
      "f1z=((2*math.pi*Zout*C2)**-1)/1000                    #cutoff frequency for bypass circuit (Hz)\n",
      "\n",
      "\n",
      "#Result\n",
      "print 'input cutoff frequency f1 = ',round(f1i,2),'Hz'\n",
      "print 'output cutoff frequency f1 = ',round(f1o,2),'Hz'\n",
      "print 'cutoff frequency for bypass circuit f1 = ',round(f1z,2),'Hz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "input cutoff frequency f1 =  190.36 Hz\n",
        "output cutoff frequency f1 =  5.32 Hz\n",
        "cutoff frequency for bypass circuit f1 =  631.63 Hz\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-20, Page 602"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.20.py\n",
      "#calculate high cutoff frequency for base bypass and collector bypass circuit. \n",
      "#B=150 & Cstray=10pF.\n",
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "#Variable declaration\n",
      "re=22.7                 #from past dc calculation (example:9-5)(Ohm)\n",
      "VCC=10                  #collector voltage(V)\n",
      "RC=3.6                  #Collector resistance (KOhm)\n",
      "RE=1                    #Emitter resistance (KOhm)\n",
      "R11=10                  #Base resistance1 (KOhm)\n",
      "R12=2.2                 #Base resistance2 (KOhm)\n",
      "RL=10                   #Load resistance2 (KOhm)\n",
      "B=150                   #current gain\n",
      "RG=0.6                  #source resistance(KOhm)\n",
      "fT=300*10**6            #current gain bandwidth product(Hz)\n",
      "CC1=2.1*10**-12         #Cc' capacitance(F)\n",
      "Cs=10*10**-12           #stray capacitance(F)\n",
      "\n",
      "\n",
      "#Calculation\n",
      "Rinb=B*re/1000                                #Rin(base) (KOhm)\n",
      "Ce1=((2*math.pi*re*fT)**-1)                    #capacitance Ce'(F)\n",
      "rc=RC*RL/(RC+RL)                              #collector resistance(KOhm) \n",
      "rg=((R11**-1)+(RG**-1)+(R12**-1))**-1         #source resistance (Ohm)\n",
      "Av=math.ceil(1000*rc/re)                      #voltage gain\n",
      "Cin_M=CC1*(Av+1)                              #input Miller capacitance(F)\n",
      "C1=Ce1+Cin_M                                  #base bypass capacitance(F)\n",
      "R1=int(1000*rg*Rinb/(rg+Rinb))                #resistance facing this capacitance(Ohm) \n",
      "f2=((2*math.pi*R1*C1)**-1)                     #base bypass circuit cutoff frequency (Hz)\n",
      "Cout_M=CC1*((Av+1)/Av)                        #output Miller capacitance(F)\n",
      "C2=Cout_M+Cs                                  #output bypass capacitance(F)\n",
      "R2=1000*RC*RL/(RC+RL)                         #resistance facing this capacitance(Ohm)\n",
      "f21=((2*math.pi*R2*C2)**-1)                    #collector bypass circuit cutoff frequency (Hz)\n",
      "\n",
      "#Result\n",
      "print 'base bypass circuit cutoff frequency f2 = ',round((f2/10**6),2),'MHz'\n",
      "print 'collector bypass circuit cutoff frequency f21 = ',round((f21/10**6),2),'MHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "base bypass circuit cutoff frequency f2 =  1.48 MHz\n",
        "collector bypass circuit cutoff frequency f21 =  4.96 MHz\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-21, Page 605"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.21.py\n",
      "#Determine input-coupling & output coupling circuit low-frequency cutoff points.\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "re=22.7                      #from past dc calculation (example:9-5)(Ohm)\n",
      "RC=3.6                       #Collector resistance (KOhm)\n",
      "R1=2*10**6                   #Base resistance1 (Ohm)\n",
      "R2=1*10**6                   #Base resistance2 (Ohm)\n",
      "RD=150                       #drain resistance(Ohm) \n",
      "RL=1*10**3                   #Load resistance2 (Ohm)\n",
      "RG=0.6*10**3                 #source resistance(Ohm)\n",
      "Cin=0.1*10**-6               #Cin capacitance(F)\n",
      "Cout=10*10**-6               #Cout capacitance(F)\n",
      "\n",
      "\n",
      "#Calculation\n",
      "Rthi=RG+((R1**-1)+(R2**-1))**-1                  #Thevenin resistance facing input coupling capacitor resistance (Ohm)\n",
      "f1=((2*math.pi*Rthi*Cin)**-1)                     #base bypass circuit cutoff frequency (Hz)\n",
      "Rtho=RD+RL                                       #Thevenin resistance facing output coupling capacitor resistance (Ohm)\n",
      "f2=((2*math.pi*Rtho*Cout)**-1)                    #base bypass circuit cutoff frequency (Hz)\n",
      "\n",
      "#Result\n",
      "print 'base bypass circuit cutoff frequency f1 = ',round(f1,2),'Hz'\n",
      "print 'collector bypass circuit cutoff frequency f2 = ',round(f2,2),'Hz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "base bypass circuit cutoff frequency f1 =  2.39 Hz\n",
        "collector bypass circuit cutoff frequency f2 =  13.84 Hz\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-22, Page 606"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 16.22.py\n",
      "#In figure 16-32, capacitances are: Ciss=60 pF, Coss=25 pF, Crss=5 pF.\n",
      "#gm=97mS then find high frequency cut off values for gate & drain circuits.\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Ciss=60                     #Capacitance Ciss (pF)\n",
      "Coss=25                     #Capacitance Coss (pF)\n",
      "Crss=5                      #Capacitance Crss (pF)\n",
      "gm=93*10**-3                #gm (S)\n",
      "R1=2*10**6                  #resiatance 1(Ohm)\n",
      "R2=1*10**6                  #resiatance 2(Ohm)\n",
      "RG=600                      #resiatance(Ohm)\n",
      "RD=150                      #resiatance(Ohm)\n",
      "RL=1*10**3                  #load resiatance(Ohm)\n",
      "\n",
      "#Calculation\n",
      "Cgd=Crss                            #Internal Capacitance Cgd (pF)\n",
      "Cgs=Ciss-Crss                       #Internal Capacitance Cgs (pF)\n",
      "Cds=Coss-Crss                       #Internal Capacitance Cds (pF)\n",
      "rd=((RD**-1)+(RL**-1))**-1          #rd (Ohm)\n",
      "Av=gm*rd                            #voltage gain\n",
      "Cin_M=Cgd*(Av+1)                    #Cin(M) (pF)\n",
      "C=Cgs+Cin_M                         #gate bypass capacitance (pF)\n",
      "R=((R1**-1)+(R2**-1)+(RG**-1))**-1  #resistance (Ohm)\n",
      "f2=((2*math.pi*R*C*10**-12)**-1)    #gate bypass cutoff frequency (Hz)\n",
      "Cout_M=Cgd*((Av+1)/Av)              #Cout(M) (pF)\n",
      "C1=Cds+Cout_M                       #drain bypass capacitance(pF)\n",
      "f21=((2*math.pi*rd*C1*10**-12)**-1) #drain bypass cutoff frequency (Hz)\n",
      "\n",
      "#Result\n",
      "print 'Gate bypass cutoff frequency = ',round(f2*10**-6,2),'MHz'\n",
      "print 'Drain bypass cutoff frequency = ',round(f21*10**-6,2),'MHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gate bypass cutoff frequency =  2.2 MHz\n",
        "Drain bypass cutoff frequency =  48.02 MHz\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}