summaryrefslogtreecommitdiff
path: root/Electronic_Principles_/Chapter_20_New.ipynb
blob: 1b58e3b85c08f234e3359e003879932f1c59def1 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "CHAPTER 20 LINEAR OP-AMP CIRCUITS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-1, Page 741"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.1.py\n",
      "#In figure 20-6, R1=100KOhm, Rf=100KOhm, R2=1KOhm, what is the voltage gain when JFET is On & off?\n",
      "\n",
      "#Variable declaration\n",
      "Rf=100.0                             #feedback path resistance Rf (KOhm)\n",
      "R1=100.0                             #inverting input resistance R1(KOhm)\n",
      "R2=1.0                               #inverting input  & drain resistance R2(KOhm)\n",
      "\n",
      "#Calculation\n",
      "Av1=(Rf/(R1**-1+R2**-1)**-1)+1          #maximum voltage gain\n",
      "Av2=(Rf/R1)+1                           #minimum voltage gain\n",
      "\n",
      "#Result\n",
      "print 'maximum voltage gain = ',Av1\n",
      "print 'minimum voltage gain = ',Av2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum voltage gain =  102.0\n",
        "minimum voltage gain =  2.0\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-2, Page 747"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.2.py\n",
      "#In figure 20-10. R1=1.2KOhm, R2=91KOhm, what are the max & min Av?\n",
      "\n",
      "#Variable declaration\n",
      "R1=1.2                                #inverting input resistance R1(KOhm)\n",
      "R2=91.0                               #feedback resistance R2(KOhm)\n",
      "\n",
      "#Calculation\n",
      "Av1=-R2/R1                              #maximum voltage gain\n",
      "Av2=0                                   #minimum voltage gain\n",
      "\n",
      "#Result\n",
      "print 'maximum voltage gain = ',round(Av1,2)\n",
      "print 'minimum voltage gain = ',Av2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum voltage gain =  -75.83\n",
        "minimum voltage gain =  0\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-3, Page 747"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.3.py\n",
      "#If R=1.5KOhm, nR=7.5KOhm in figure 20-10, what is the maximum positive voltage gain & other fixed resistance?\n",
      "\n",
      "#Variable declaration\n",
      "R=1.5                                 #inverting input resistance R1(KOhm)\n",
      "nR=7.5                                #feedback resistance(KOhm)\n",
      "\n",
      "#Calculation\n",
      "n=nR/R                                  #max. limit of voltage gain \n",
      "rf=nR/(n-1)                             #fixed resistor (KOhm)\n",
      "\n",
      "#Result\n",
      "print 'maximum positive voltage gain = ',n\n",
      "print 'other fixed resistor = ',rf,'KOhm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum positive voltage gain =  5.0\n",
        "other fixed resistor =  1.875 KOhm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-4, Page 757"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.4.py\n",
      "#In figure 20-18 R1=1KOhm, R2=100KOhm, R=10KOhm. what is differential voltage gain & common mode voltage gain? \n",
      "#resistance tolerance is 0.01% ,Vin=10mV, Vin(CM)=20V, what are the values of differential & common mode output signals?\n",
      "\n",
      "#Variable declaration\n",
      "R1=1.0                                   #inverting input resistance R1(KOhm)\n",
      "R2=100.0                                 #feedback resistance R2(KOhm)\n",
      "R=10.0                                   #resistor of opamp in seconnd stage(KOhm)\n",
      "Vin=10*10**-3                            #input voltage(V)\n",
      "Vin_CM=10                                #common mode input voltage(V)\n",
      "T=0.0001                                 #tolerance of resistor  \n",
      "\n",
      "#Calculation\n",
      "Av=(R2/R1)+1                             #preamp voltage gain\n",
      "Av_CM=2*T                                #common mode voltage gain of 2nd stage\n",
      "Vout=-Av*Vin                             #output siganl voltage(V)\n",
      "Vout_CM=Av_CM*Vin_CM                    #output siganl voltage for common mode signal(V)\n",
      "\n",
      "#Result\n",
      "print 'output siganl voltage for common mode signal Vout(CM) = ',Vout_CM,'V'\n",
      "print 'output siganl voltage Vout = ',Vout,'V'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "output siganl voltage for common mode signal Vout(CM) =  0.002 V\n",
        "output siganl voltage Vout =  -1.01 V\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-5, Page 759"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.5.py\n",
      "#In figure 20-22, R1=1KOhm, R2=2KOhm, R3=3KOhm, R4=4KOhm, R5=5KOhm ,Rf=6KOhm. what is voltage gain of each channel?\n",
      "\n",
      "#Variable declaration\n",
      "Rf=6.0                                   #feedback path resistance Rf (KOhm)\n",
      "R1=1.0                                   #inverting input resistance R1(KOhm)\n",
      "R2=2.0                                   #inverting input resistance R2(KOhm)\n",
      "R3=3.0                                   #non-inverting input resistance R3(KOhm)\n",
      "R4=4.0                                   #non-inverting input resistance R4(KOhm)\n",
      "R5=5.0                                   #non-inverting input resistance R5(KOhm)\n",
      "\n",
      "#Calculation\n",
      "Av1=(-Rf/R1)                             #voltage gain1\n",
      "Av2=(-Rf/R2)                             #voltage gain2\n",
      "Av3=(1+(Rf/((R1**-1+R2**-1)**-1)))*(((R4**-1+R5**-1)**-1)/(R3+((R4**-1+R5**-1)**-1)))            #voltage gain3\n",
      "Av4=(1+(Rf/((R1**-1+R2**-1)**-1)))*(((R3**-1+R5**-1)**-1)/(R4+((R3**-1+R5**-1)**-1)))            #voltage gain4\n",
      "\n",
      "#Result\n",
      "print 'Voltage gain channel-1 Av1 = ',Av1\n",
      "print 'Voltage gain channel-2 Av2 = ',Av2\n",
      "print 'Voltage gain channel-3 Av3 = ',round(Av3,2)\n",
      "print 'Voltage gain channel-4 Av4 = ',round(Av4,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage gain channel-1 Av1 =  -6.0\n",
        "Voltage gain channel-2 Av2 =  -3.0\n",
        "Voltage gain channel-3 Av3 =  4.26\n",
        "Voltage gain channel-4 Av4 =  3.19\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-6, Page 762"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.6.py\n",
      "#In figure 20-25, D0=1,D1=0,D2=0, and D3=1. using Vref =5V, \n",
      "#determine decimal equivalent of BIN and output voltage of converter.\n",
      "\n",
      "#Variable declaration \n",
      "D0=1                           #digital input0 (binary)\n",
      "D1=0                           #digital input1 (binary)\n",
      "D2=0                           #digital input2 (binary)\n",
      "D3=1                           #digital input3 (binary)\n",
      "Vref=5                         #reference voltage(V)\n",
      "N=4                            #no. of inputs\n",
      "\n",
      "#Calculation \n",
      "BIN=(D0*2**0)+(D1*2**1)+(D2*2**2)+(D3*2**3)   #decimal equivalent BIN\n",
      "Vout=-((2*Vref*BIN)/2.0**N)                   #output voltage of converter(V)\n",
      "\n",
      "#Result\n",
      "print 'decimal equivalent BIN = ',BIN\n",
      "print 'output voltage of converter Vout = ',Vout,'V'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decimal equivalent BIN =  9\n",
        "output voltage of converter Vout =  -5.625 V\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-7, Page 764"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.7.py\n",
      "#In figure 20-27, R1=1KOhm, R2=51 KOhm, what is voltage gain & closed loop output impedance? \n",
      "#what is shorted load current of circuit if each transistor has B = 125?\n",
      "\n",
      "#Variable declaration\n",
      "R2=51                               #feedback path resistance (KOhm)\n",
      "R1=1                                #inverting input resistance R1(KOhm)\n",
      "Bdc=125                             #current gain\n",
      "Zout=75                             #open loop output impedance(Ohm)\n",
      "AVOL=100000                         #741C voltage gain\n",
      "\n",
      "#Calculation\n",
      "Av=-R2/R1                          #closed loop voltage gain\n",
      "B=R1/(R1+R2)                       #feedback fraction\n",
      "Zout_CL=Zout/(1+(AVOL*B))          #closed loop output impedance(Ohm)\n",
      "Isc=25.0/1000                      #shorted current for 741C op-amp(A)\n",
      "Imax=Bdc*Isc                       #maximum load current(A)\n",
      "\n",
      "#Result\n",
      "print 'closed loop output impedance Zout(CL) = ',Zout_CL,'Ohm'\n",
      "print 'maximum load current Imax = ',Imax,'A'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "closed loop output impedance Zout(CL) =  75 Ohm\n",
        "maximum load current Imax =  3.125 A\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-8, Page 768"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.8.py\n",
      "#if the current source of figure 20-28 has R=10KOhm, Vin =1 V, VCC=15V. what is output current? \n",
      "#what is maximum load resistance for vin = 10V?\n",
      "\n",
      "#Variable declaration\n",
      "Vin=1.0                            #input voltage(V)\n",
      "VCC=15                             #supply voltage(V)\n",
      "R=10                               #inverting input resistance(KOhm)\n",
      "Vin2=10.0                          #larger input(V)\n",
      "\n",
      "#Calculation\n",
      "iout=Vin/R                         #output current(mA)\n",
      "RL_max=R*(VCC/Vin2-1)              #Maximum load resistance(KOhm) \n",
      "\n",
      "#Result\n",
      "print 'Output current iout = ',iout,'mA'\n",
      "print 'Maximum load resistance RL(max) = ',RL_max,'KOhm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output current iout =  0.1 mA\n",
        "Maximum load resistance RL(max) =  5.0 KOhm\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-9, Page 768"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.9.py\n",
      "#figure 20-31 has R=15KOhm, Vin =3 V, VCC=15V. what is output current? \n",
      "#what is maximum load resistance for maximum Vin = 9V?\n",
      "\n",
      "#Variable declaration\n",
      "Vin=3.0                            #input voltage(V)\n",
      "VCC=15                             #supply voltage(V)\n",
      "R=15                               #inverting input resistance(KOhm)\n",
      "Vin2=12.0                          #larger input(V)\n",
      "\n",
      "#Calculation\n",
      "iout=-Vin/R                         #output current(mA)\n",
      "RL_max=(R/2.0)*(VCC/Vin2-1)         #Maximum load resistance(KOhm) \n",
      "\n",
      "#Result\n",
      "print 'Output current iout = ',iout,'mA'\n",
      "print 'Maximum load resistance RL(max) = ',RL_max,'KOhm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output current iout =  -0.2 mA\n",
        "Maximum load resistance RL(max) =  1.875 KOhm\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20-10, Page 771"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Example 20.10.py\n",
      "#If rds varies from 50 Ohm to 120 KOhm in figure 20-32, what is the maximum & minimum voltage gain?\n",
      "\n",
      "#Variable declaration\n",
      "R2=47                                   #feedback path resistance (KOhm)\n",
      "R1=1.0                                  #inverting input resistance R1(KOhm)\n",
      "R3=100                                  #non-inverting input resistance R3(KOhm)\n",
      "rds1=0.050                              #ohmic resistance of JFET (KOhm)\n",
      "rds2=120.0                              #ohmic resistance of JFET (KOhm)\n",
      "\n",
      "#Calculation\n",
      "Av1=((R2/R1)+1)*(rds1/(rds1+R3))      #minimum voltage gain\n",
      "Av2=((R2/R1)+1)*(rds2/(rds2+R3))      #maximum voltage gain\n",
      "\n",
      "#Result\n",
      "print 'Maximum voltage gain Av = ',round(Av2,2)\n",
      "print 'Minimum voltage gain Av = ',round(Av1,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum voltage gain Av =  26.18\n",
        "Minimum voltage gain Av =  0.024\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}