summaryrefslogtreecommitdiff
path: root/Grob's_Basic_Electronics_by_M._E._Schultz/Chapter33.ipynb
blob: c663815f5f7a3a2f2a0e2bbeaf9fb276917c64a0 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 33 : Operational Amplifiers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_1 Page No.  1072"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Differential Voltage Gain =143.00\n",
      "The Ac Output Voltage = 1.43 Volts(p-p)\n"
     ]
    }
   ],
   "source": [
    "# Calculate the differential voltage gain, Ad, and the ac output voltage, Vout.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Vin = 10*10**-3#    # Input voltage=10 mVolts(p-p)\n",
    "Rc = 10*10**3#      # Collector resistance=10 kOhms\n",
    "Ie = 715.*10**-6#    # Emitter current=715 uAmps\n",
    "\n",
    "re = (25*10**-3)/Ie#\n",
    "\n",
    "Ad = Rc/(2*re)#\n",
    "print 'The Differential Voltage Gain =%0.2f'%Ad\n",
    "\n",
    "Av = Ad\n",
    "\n",
    "Vo = Av*Vin#\n",
    "print 'The Ac Output Voltage = %0.2f Volts(p-p)'%Vo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_2 Page No.  1073"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Common-Mode Voltage Gain Acm = 0.50\n",
      "The Commom-Mode Rejection Ratio = 49.12 dB\n"
     ]
    }
   ],
   "source": [
    "from math import log10\n",
    "# calculate the common-mode voltage gain, ACM, and the CMRR (dB).\n",
    "\n",
    "# Given data\n",
    "\n",
    "Rc = 10*10**3#     # Collector resistance=10 kOhms\n",
    "Re = 10.*10**3#     # Emitter resistance=10 kOhms\n",
    "Ad = 142.86#      # Differential gain=142.86\n",
    "\n",
    "Acm = Rc/(2*Re)#\n",
    "print 'The Common-Mode Voltage Gain Acm = %0.2f'%Acm\n",
    "\n",
    "CMRR = 20*log10(Ad/Acm)#\n",
    "print 'The Commom-Mode Rejection Ratio = %0.2f dB'%CMRR"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_3 Page No.  1074"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Output Frequency = 7.96e+04 Hertz\n",
      "i.e 79.6 kHz\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "# Calculate fmax for an op amp that has an Sr of 5 V/u\u0002s and a peak output voltage of 10 V.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Vpk = 10.#       # Peak output voltage=10 Volts\n",
    "Sr = 5./10**-6#   # Slew rate=5 V/us\n",
    "\n",
    "\n",
    "fo = Sr/(2*pi*Vpk)#\n",
    "print 'The Output Frequency = %0.2e Hertz'%fo\n",
    "print 'i.e 79.6 kHz'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_4 Page No.  1075"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Closed-Loop Voltage Gain Acl =-10.00\n",
      "The Output Voltage = 10.00 Volts(p-p)\n",
      "The -ve sign indicates that input and output voltages are 180° out-of-phase\n"
     ]
    }
   ],
   "source": [
    "# calculate the closed-loop voltage gain, Acl, and the output voltage, Vout.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Vin = 1.#        # Input voltage=1 Volts(p-p)\n",
    "Rf = 10.*10**3#   # Feedback resistance=10 kOhms\n",
    "Ri = 1.*10**3#    # Input resistance=1 kOhms\n",
    "\n",
    "Acl = -(Rf/Ri)#\n",
    "print 'The Closed-Loop Voltage Gain Acl =%0.2f'%Acl\n",
    "\n",
    "Vo = -Vin*Acl#\n",
    "print 'The Output Voltage = %0.2f Volts(p-p)'%Vo\n",
    "print 'The -ve sign indicates that input and output voltages are 180° out-of-phase'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_5 Page No.  1076"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Differential Input Voltage = 1.00e-04 Volts(p-p)\n",
      "i.e 100 uVolts(p-p)\n"
     ]
    }
   ],
   "source": [
    "#If Avol equals 100,000, calculate the value of Vid.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Avol = 100000.#  # Open loop voltage gain=100,000\n",
    "Vo = 10.#        # Output voltage=10 Volts(p-p)\n",
    "\n",
    "Vid = Vo/Avol#\n",
    "print 'The Differential Input Voltage = %0.2e Volts(p-p)'%Vid\n",
    "print 'i.e 100 uVolts(p-p)'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_6 Page No. 1078"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Input Impedence = 1.00e+03 Ohms\n",
      "i.e 1 kOhms\n",
      "The Closed Loop Output Impedence = 0.01 Ohms\n"
     ]
    }
   ],
   "source": [
    "# calculate Zin and Zout(CL). Assume AVOL is\u0004 100,000 and Zout(OL) is\u0004 75 Ohms.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Avol = 100000.#  # Open loop voltage gain=100,000\n",
    "Rf = 10.*10**3#   # Feedback resistance=10 kOhms\n",
    "Ri = 1.*10**3#    # Input resistance=1 kOhms\n",
    "Zool = 75.#      # Output impedence (open-loop)=75 Ohms\n",
    "\n",
    "Zi = Ri#\n",
    "print 'The Input Impedence = %0.2e Ohms'%Zi\n",
    "print 'i.e 1 kOhms'\n",
    "\n",
    "Beta = Ri/(Ri+Rf)#\n",
    "\n",
    "A = Avol*Beta#\n",
    "\n",
    "Zocl = Zool/(1+A)#\n",
    "print 'The Closed Loop Output Impedence = %0.2f Ohms'%Zocl"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_7 Page No.  1083"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Output Frequency = 1.59e+04 Hertz\n",
      "i.e 15.915 kHz\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "# Calculate the 5-V power bandwidth.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Vo = 10.#            # Output voltage=10 Volts(p-p)\n",
    "Sr = 0.5/10**-6#     # Slew rate=0.5 V/us\n",
    "\n",
    "Vpk = Vo/2#\n",
    "\n",
    "fo = Sr/(2*pi*Vpk)#\n",
    "print 'The Output Frequency = %0.2e Hertz'%fo\n",
    "print 'i.e 15.915 kHz'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_8 Page No.  1085"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Closed-Loop Voltage Gain Acl =11.00\n",
      "The Output Voltage = 11.00 Volts(p-p)\n"
     ]
    }
   ],
   "source": [
    "# Calculate the closed-loop voltage gain, Acl, and the output voltage, Vout.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Vin = 1#        # Input voltage=1 Volts(p-p)\n",
    "Rf = 10.*10**3#   # Feedback resistance=10 kOhms\n",
    "Ri = 1.*10**3#    # Input resistance=1 kOhms\n",
    "\n",
    "Acl = 1+(Rf/Ri)#\n",
    "print 'The Closed-Loop Voltage Gain Acl =%0.2f'%Acl\n",
    "\n",
    "Vo = Vin*Acl#\n",
    "print 'The Output Voltage = %0.2f Volts(p-p)'%Vo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_9 Page No.  1089"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Input Impedence Closed-Loop = 1.82e+10 Ohms\n",
      "i.e 18 GOhms\n",
      "The Closed-Loop Output Impedence = 0.01 Ohms\n"
     ]
    }
   ],
   "source": [
    "# Calculate Zin(CL) and Zout(CL). Assume Rin is\u0004 2 MOhms\u0006, Avol is 100,000, and Zout(OL) is 75 Ohms.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Avol = 100000.#  # Open loop voltage gain=100,000\n",
    "Ri = 2.*10**6#    # Input resistance=2 MOhms\n",
    "B = 0.0909#     # Beta=0.0909\n",
    "Zool = 75.#      # Output impedence (open-loop)=75 Ohms\n",
    "\n",
    "Zicl = Ri*(1+Avol*B)#\n",
    "print 'The Input Impedence Closed-Loop = %0.2e Ohms'%Zicl\n",
    "print 'i.e 18 GOhms'\n",
    "\n",
    "A = Avol*B#\n",
    "\n",
    "Zocl = Zool/(1+A)#\n",
    "print 'The Closed-Loop Output Impedence = %0.2f Ohms'%Zocl"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_10 Page No.  1090"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Input impedence closed-loop = 2.00e+11 Ohms\n",
      "i.e 200 GOhms\n",
      "The Closed loop Output Impedence = 0.001 Ohms\n"
     ]
    }
   ],
   "source": [
    "# Assume Rin is 2 MOhms, Avol is 100,000, and Zout(OL) is 75 Ohms. Calculate Zin(CL) and Zout(CL)\n",
    "\n",
    "# Given data\n",
    "\n",
    "Avol = 100000.#  # Open loop voltage gain=100,000\n",
    "Ri = 2.0*10**6#    # Input resistance=2 MOhms\n",
    "B = 1.0#          # Beta=1\n",
    "Zool = 75.#      # Output impedence (open-loop)=75 Ohms\n",
    "\n",
    "Zicl = Ri*(1+Avol*B)#\n",
    "print 'The Input impedence closed-loop = %0.2e Ohms'% Zicl\n",
    "print 'i.e 200 GOhms'\n",
    "\n",
    "A = Avol*B#\n",
    "\n",
    "Zocl = Zool/(1+A)#\n",
    "print 'The Closed loop Output Impedence = %0.3f Ohms'%Zocl"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_11 Page No.  1091"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Closed-Loop Voltage Gain Acl =-10.00\n",
      "The Output Voltage = 7.50 Volts\n"
     ]
    }
   ],
   "source": [
    "# Calculate the closed-loop voltage gain, Acl, and the dc voltage at the op-amp output terminal.\n",
    "\n",
    "# Given data\n",
    "\n",
    "V = 15.#         # Voltage at +ve terminal of op-amp=15 Volts\n",
    "Rf = 10.*10**3#   # Feedback resistance=10 kOhms\n",
    "Ri = 1.*10**3#    # Input resistance=1 kOhms\n",
    "R1 = 10.*10**3#   # Resistance1=10 kOhms\n",
    "R2 = 10.*10**3#   # Rsistance2=10 kOhms\n",
    "\n",
    "Acl = -(Rf/Ri)#\n",
    "print 'The Closed-Loop Voltage Gain Acl =%0.2f'%Acl\n",
    "\n",
    "Vo = V*(R2/(R1+R2))#\n",
    "print 'The Output Voltage = %0.2f Volts'%Vo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_12 Page No.  1095"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Output Voltage 1 Volts\n"
     ]
    }
   ],
   "source": [
    "# Calculate the output voltage, Vout.\n",
    "\n",
    "# Given data\n",
    "\n",
    "V1 = 1#     # Input voltage1=1 Volts\n",
    "V2 = -5#    # Input voltage2=-5 Volts\n",
    "V3 = 3#     # Input voltage3=3 Volts\n",
    "\n",
    "Vo = -(V1+V2+V3)#\n",
    "print 'The Output Voltage %0.f Volts'%Vo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_13 Page No.  1097"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Output Voltage = 3.00 Volts\n"
     ]
    }
   ],
   "source": [
    "# Calculate the output voltage, Vout.\n",
    "\n",
    "# Given data\n",
    "\n",
    "V1 = 0.5#       # Input voltage1=0.5 Volts\n",
    "V2 = -2.0#        # Input voltage2=-2 Volts\n",
    "Rf = 10.*10**3#   # Feedback resistance=10 kOhms\n",
    "R1 = 1.*10**3#    # Resistance1=1 kOhms\n",
    "R2 = 2.5*10**3#  # Rsistance2=2.5 kOhms\n",
    "\n",
    "A = Rf/R1#\n",
    "B = Rf/R2#\n",
    "\n",
    "Vo = -(A*V1+B*V2)#\n",
    "print 'The Output Voltage = %0.2f Volts'%Vo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_14 Page No.  1101"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Output Voltage of Case A = -12.50 Volts\n",
      "The Output Voltage of Case B = 10.00 Volts\n",
      "The Output Voltage of Case C = -0.00 Volts\n"
     ]
    }
   ],
   "source": [
    "# Calculate the output voltage, Vout, if (a) Vx is 1 Vdc and Vy is -0.25 Vdc, (b) -Vx is 0.5 Vdc and Vy is 0.5 Vdc, (c) Vx is 0.3 V and Vy is 0.3 V.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Rf = 10.*10**3#   # Feedback resistance=10 kOhms\n",
    "R1 = 1.*10**3#    # Resistance1=1 kOhms\n",
    "Vx1 = 1.#        # Input voltage Vx1 at -ve terminal of op-amp=1 Volts\n",
    "Vy1 = -0.25#    # Input voltage Vy1 at +ve terminal of op-amp=-0.25 Volts\n",
    "Vx2 = -0.5#     # Input voltage Vx2 at -ve terminal of op-amp=-0.5 Volts\n",
    "Vy2 = 0.5#    # Input voltage Vy2 at +ve terminal of op-amp=0.5 Volts\n",
    "Vx3 = 0.3#        # Input voltage Vx3 at -ve terminal of op-amp=0.3 Volts\n",
    "Vy3 = 0.3#    # Input voltage Vy3 at +ve terminal of op-amp=0.3 Volts\n",
    "\n",
    "A = -Rf/R1#\n",
    "\n",
    "#  Case A\n",
    "\n",
    "Voa = A*(Vx1-Vy1)#\n",
    "print 'The Output Voltage of Case A = %0.2f Volts'%Voa\n",
    "\n",
    "#  Case B\n",
    "\n",
    "Voa = A*(Vx2-Vy2)#\n",
    "print 'The Output Voltage of Case B = %0.2f Volts'%Voa\n",
    "\n",
    "#  Case C\n",
    "\n",
    "Voa = A*(Vx3-Vy3)#\n",
    "print 'The Output Voltage of Case C = %0.2f Volts'%Voa"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_15 Page No.  1102"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Output of Differential Amplifier = 5.00 Volts\n"
     ]
    }
   ],
   "source": [
    "# Assume that Rd increases to 7.5 k\u0006 due to an increase in the ambient temperature. Calculate the output of the differential amplifier. Note: Rb is 5 kOhms\u0006.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Vi = 5.#         # Voltage input=5 Volts(dc)\n",
    "Rf = 10.*10**3#   # Feedback resistance=10 kOhms\n",
    "R1 = 1.*10**3#    # Resistance1=1 kOhms\n",
    "Ra = 5.*10**3#    # Resistance A at wein bridge=5 kOhms\n",
    "Rb = 10.*10**3#   # Resistance B at wein bridge=10 kOhms\n",
    "Rc = 5.*10**3#    # Resistance C at wein bridge=5 kOhms\n",
    "Rd = 7.5*10**3#  # Resistance D at wein bridge=7.5 kOhms\n",
    "\n",
    "Vx = Vi*(Ra/Rb)#\n",
    "Vy = Vi*(Rd/(Rd+Rc))#\n",
    "A = -Rf/R1\n",
    "\n",
    "Vo = A*(Vx-Vy)#\n",
    "print 'The Output of Differential Amplifier = %0.2f Volts'%Vo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_16 Page No.  1103"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Cutoff Frequency = 1.59e+03 Hertz\n",
      "i.e 1.591 kHz\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "# Calculate the cutoff frequency, fc.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Rf = 10.*10**3#       # Feedback resistance=10 kOhms\n",
    "Cf = 0.01*10**-6#    # Feedback capacitance=0.01 uFarad\n",
    "\n",
    "fc = 1./(2.*pi*Rf*Cf)#\n",
    "print 'The Cutoff Frequency = %0.2e Hertz'%fc\n",
    "print 'i.e 1.591 kHz'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_17 Page No. 1104"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Closed-Loop Voltage Gain at 0 Hz =-10.00\n",
      "The Closed-Loop Voltage Gain at 1 MHz =-0.02\n"
     ]
    }
   ],
   "source": [
    "from math import pi,sqrt\n",
    "# Calculate the Voltage gain, Acl at (a)0 Hz and (b) 1 MHz\n",
    "\n",
    "# Given data\n",
    "\n",
    "f1 = 1.*10**6#        # Frequency=1 MHertz\n",
    "Rf = 10.*10**3#       # Feedback resistance=10 kOhms\n",
    "R1 = 1.*10**3#        # Resistance1=1 kOhms\n",
    "Cf = 0.01*10**-6#    # Feedback capacitance=0.01 uFarad\n",
    "\n",
    "# At 0 Hz, Xcf = infinity ohms, So, Zf=Rf \n",
    "\n",
    "Acl = -Rf/R1#\n",
    "print 'The Closed-Loop Voltage Gain at 0 Hz =%0.2f'%Acl\n",
    "\n",
    "# At 1 MHz\n",
    "\n",
    "Xcf = 1/(2*pi*f1*Cf)#\n",
    "\n",
    "A = (Rf*Rf)#\n",
    "B = (Xcf*Xcf)#\n",
    "\n",
    "Zf = ((Xcf*Rf)/sqrt(A+B))#\n",
    "\n",
    "Acl1 = -Zf/R1#\n",
    "print 'The Closed-Loop Voltage Gain at 1 MHz =%0.2f'%Acl1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_18 Page No. 1105"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Voltage Gain at 0 Hz = 20.00 dB\n",
      "The Voltage Gain at 1.591 kHz = 16.99 dB\n",
      "approx 17dB\n"
     ]
    }
   ],
   "source": [
    "from math import log10,pi,sqrt\n",
    "# Calculate the dB voltage gain, at (a)0 Hz and (b) 1.591 kHz\n",
    "\n",
    "# Given data\n",
    "\n",
    "f1 = 1.591*10**3#    # Frequency=1.591 kHertz\n",
    "Rf = 10.*10**3#       # Feedback resistance=10 kOhms\n",
    "Ri = 1.*10**3#        # Input resistance=1 kOhms\n",
    "Cf = 0.01*10**-6#    # Feedback capacitance=0.01 uFarad\n",
    "\n",
    "# At 0 Hz, Xcf = infinity ohms, So, Zf=Rf \n",
    "\n",
    "A = Rf/Ri\n",
    "\n",
    "Acl = 20*log10(A)#\n",
    "print 'The Voltage Gain at 0 Hz = %0.2f dB'%Acl\n",
    "\n",
    "# At 1.591 kHz\n",
    "\n",
    "Xcf = 1/(2*pi*f1*Cf)#\n",
    "B = (Rf*Rf)#\n",
    "C = (Xcf*Xcf)#\n",
    "Zf = (Xcf*Rf/sqrt(B+C))#\n",
    "D = Zf/Ri#\n",
    "\n",
    "Acl1 = 20*log10(D)#\n",
    "print 'The Voltage Gain at 1.591 kHz = %0.2f dB'%Acl1\n",
    "print 'approx 17dB'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_19 Page No.  1106"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Cutoff Frequency = 1591.55 Hertz\n",
      "i.e 1.591 kHz\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "# Calculate the cutoff frequency, fc.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Ri = 1.*10**3#       # Input resistance=10 kOhms\n",
    "Ci = 0.1*10**-6#    # Input capacitance=0.01 uFarad\n",
    "\n",
    "fc = 1/(2*pi*Ri*Ci)#\n",
    "print 'The Cutoff Frequency = %0.2f Hertz'%fc\n",
    "print 'i.e 1.591 kHz'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_20 Page No.  1118"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Output Current = 5.00e-03 Amps\n",
      "i.e 5 mAmps\n"
     ]
    }
   ],
   "source": [
    "# Vin is  5 V, R is  1 kOhms , and Rl is  100 Ohms . Calculate the output current, Iout.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Vin = 5.#        # Input votage=5 Volts\n",
    "Ri = 1.*10**3#    # Input resistance=1 kOhms\n",
    "Rl = 100.#       # Load resistance=100 Ohms\n",
    "\n",
    "Io = Vin/Ri#\n",
    "print 'The Output Current = %0.2e Amps'%Io\n",
    "print 'i.e 5 mAmps'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_21 Page No.  1120"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Output Voltage = 1.50 Volts\n"
     ]
    }
   ],
   "source": [
    "# Iin is 1.5 mA, R is 1 kOhms, and Rl is 10 kOhms. Calculate Vout.\n",
    "\n",
    "# Given data\n",
    "\n",
    "Iin = 1.5*10**-3#    # Input votage=5 Volts\n",
    "Ri = 1.*10**3#        # Input resistance=1 kOhms\n",
    "Rl = 100.#           # Load resistance=100 Ohms\n",
    "\n",
    "Vo = Iin*Ri#\n",
    "print 'The Output Voltage = %0.2f Volts'%Vo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_22 Page No. 1121"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Upper Trigger Point = 0.129 Volts\n",
      "i.e 128.7 mVolts\n",
      "The Lower Trigger Point = -0.129 Volts\n",
      "i.e -128.7 mVolts\n",
      "The Hysterisis Voltage = 0.257 Volts\n",
      "i.e 257.4 mVolts\n"
     ]
    }
   ],
   "source": [
    "# R1 is 1 kOhms and R2 is 100 kOhms . Calculate UTP, LTP, and VH.\n",
    "\n",
    "# Given data\n",
    "\n",
    "R1 = 1.*10**3#        # Resistance1=1 kOhms\n",
    "R2 = 100.*10**3#      # Resistance2=100 kOhms\n",
    "Vcc = 15.#           # Applied votage=15 Volts\n",
    "Vsat = 13.#          # Assume Saturation voltage=13 Volts\n",
    "\n",
    "Beta = R1/(R1+R2)#\n",
    "\n",
    "Utp = Beta*Vsat#\n",
    "print 'The Upper Trigger Point = %0.3f Volts'%Utp\n",
    "print 'i.e 128.7 mVolts'\n",
    "\n",
    "Ltp = -Beta*Vsat#\n",
    "print 'The Lower Trigger Point = %0.3f Volts'%Ltp\n",
    "print 'i.e -128.7 mVolts'\n",
    "\n",
    "Vh = Utp-Ltp#\n",
    "print 'The Hysterisis Voltage = %0.3f Volts'%Vh\n",
    "print 'i.e 257.4 mVolts'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 33_23 Page No.  1124"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Minimum value of required Capacitor = 1.00e-04 Farads\n",
      "i.e 100 uFarad\n"
     ]
    }
   ],
   "source": [
    "# Rl is 1 kOhms  and the frequency of the input voltage equals 100 Hz. Calculate the minimum value of C required.\n",
    "\n",
    "# Given data\n",
    "\n",
    "f = 100.#        # Applied frequency=100 Hertz\n",
    "Rl = 1.*10**3#    # Load resistance=1 kOhms\n",
    "\n",
    "T = 1./f#\n",
    "\n",
    "C = (10*T)/Rl#\n",
    "print 'The Minimum value of required Capacitor = %0.2e Farads'%C\n",
    "print 'i.e 100 uFarad'"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}