summaryrefslogtreecommitdiff
path: root/Analog_Integrated_Circuits_by_R.S._Tomar/Chapter4.ipynb
blob: c8040bf99288634b879dad8b9d04330df9bd5ce9 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:044922821cb1a1b0c88578b071d30db5925d3f145784f5c6308641fcf8036e67"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter4 - Op-amps with negative feedback"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.1 - page 91"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "AOL=2*10**5 #unitless\n",
      "fo=5 #Hz\n",
      "ACL=100 #unitless\n",
      "SF=AOL/ACL #unitless\n",
      "fodash=SF*fo #Hz\n",
      "fodash/=1000 #kHz\n",
      "print \"Bandwidth with feedback is %0.2f kHz\" %fodash\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bandwidth with feedback is 10.00 kHz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.2 - page : 99"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "AOL=2*10**5 #unitless\n",
      "Ri=1.5 #kohm\n",
      "Rf=12 #kohm\n",
      "Rio=1 #Mohm\n",
      "Ro=100 #ohm\n",
      "fo=5 #Hz\n",
      "Beta=Ri/(Ri+Rf) #unitless\n",
      "SF=(1+AOL)*Beta #unitless\n",
      "ACL=AOL/SF #unitless\n",
      "print \"Value of ACL is %0.2f\" % ACL\n",
      "#In case of ideal opamp\n",
      "ACL=1+Rf/Ri #unitless\n",
      "print \"In case of ideal opamp, Value of ACL is %0.2f \" %ACL \n",
      "Rif=Rio*SF #kohm\n",
      "print \"Value of Rif is %0.2f Mohm\" %Rif\n",
      "print \"This is a large value can be assumed as infity resistance.\"\n",
      "Rof=Ro/SF #ohm\n",
      "Rof*=1000  #mohm\n",
      "print \"Value of Rof is %0.2f mohm\" %Rof\n",
      "fodash=SF*fo #Hz\n",
      "fodash/=1000 #kHz\n",
      "print \"Bandwidth with feedback, fo_dash is %0.f kHz\" %fodash\n",
      "#Answer for Rif in the book has mistake of unit."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of ACL is 9.00\n",
        "In case of ideal opamp, Value of ACL is 9.00 \n",
        "Value of Rif is 22222.33 Mohm\n",
        "This is a large value can be assumed as infity resistance.\n",
        "Value of Rof is 4.50 mohm\n",
        "Bandwidth with feedback, fo_dash is 111 kHz\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.3 - page : 99"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "AOL=float(\"inf\") #unitless\n",
      "Rio=float(\"inf\") #ohm\n",
      "Ri=1.0 #kohm\n",
      "Rf=15.0 #kohm\n",
      "SF=float(\"inf\") #unitless #as SF=1+AOL*Beta\n",
      "Beta=Ri/(Ri+Rf) #unitless\n",
      "ACL=1/Beta #unitless\n",
      "print \"Input impedence(ohm) for ideal opamp is %0.2f \" %Rio \n",
      "print \"Gain of the circuit, ACL is %0.f \" %ACL "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input impedence(ohm) for ideal opamp is inf \n",
        "Gain of the circuit, ACL is 16 \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.4 - page : 100"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "AOL=400 #unitless\n",
      "Rio=500 #kohm\n",
      "Ro=75 #ohm\n",
      "ACL=100 #unitlessc\n",
      "SF=AOL/ACL #unitless\n",
      "Rif=Rio*SF #kohm\n",
      "Rif/=1000 #Mohm\n",
      "print \"Input impedence, Rif is %0.2f Mohm \" %Rif \n",
      "Rof=Ro/SF #ohm\n",
      "print \"Output impedence, Rof is %0.2f ohm \" %Rof\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input impedence, Rif is 2.00 Mohm \n",
        "Output impedence, Rof is 18.75 ohm \n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.5 - page : 100"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "ACL=200.0 #unitless\n",
      "AOL=2*10.0**5 #unitless\n",
      "Rio=2.0 #Mohm\n",
      "Ro=75 #ohm\n",
      "Ri=1 #kohm(Assumed)\n",
      "SF=AOL/ACL #unitless\n",
      "Beta=(SF-1)/AOL #unitless\n",
      "Rf=Ri*(1-Beta)/Beta #kohm\n",
      "print \"Input impedence, Rif is %0.f kohm\" %Ri \n",
      "print \"Feedback impedence, Rf is %0.f kohm \" %Rf \n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input impedence, Rif is 1 kohm\n",
        "Feedback impedence, Rf is 199 kohm \n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.6 - page : 101"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "AOL=50 #unitless\n",
      "Beta=0.8 #unitless\n",
      "deltaAOL=-20 #%(Change in open loop gain)\n",
      "deltaBeta=15 #%(Change in feedback factor)\n",
      "AOLnew=AOL+AOL*deltaAOL/100 #unitless(AOL after change)\n",
      "Betanew=Beta+Beta*deltaBeta/100 #unitless(Beta after change)\n",
      "ACL=AOLnew/(1+AOLnew*Betanew) #unitless\n",
      "print \"Close loop gain, ACL is %0.2f \" %ACL "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Close loop gain, ACL is 1.06 \n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.7 - page : 102"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "AOL=500 #unitless\n",
      "Rio=300 #kohm\n",
      "Ro=100 #ohm\n",
      "ACL=AOL/(1+AOL) #unitless\n",
      "Rif=Rio*(1+AOL)/1000 #Mohm\n",
      "Rof=Ro/(1+AOL) #ohm\n",
      "print \"Close loop gain, ACL is %0.2f \" %ACL  \n",
      "print \"Value of Rif is %0.f Mohm \" %Rif\n",
      "print \"Value of Rof is %0.1f ohm \" %Rof "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Close loop gain, ACL is 1.00 \n",
        "Value of Rif is 150 Mohm \n",
        "Value of Rof is 0.2 ohm \n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.8 - page : 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Iin=1 #mA\n",
      "Rf=1 #kohm\n",
      "IB=0 #for ideal opamp\n",
      "If=Iin-IB #mA\n",
      "Vout=-If*Rf #V\n",
      "print \"Output Voltage is %0.2f V \" %Vout "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output Voltage is -1.00 V \n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.9 - page : 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "I2=1 #mA\n",
      "Rf=4.7 #kohm\n",
      "#Case 1st\n",
      "I1=500 #micro A\n",
      "Vout1=-I1*10**-6*Rf*10**3 #V\n",
      "print \"For 500 uA current, Output Voltage is %0.2f V \" %Vout1 \n",
      "#Case 2nd\n",
      "I2=1 #mA\n",
      "Vout2=-I2*10**-3*Rf*10**3 #V\n",
      "print \"For 1 mA current, Output Voltage is %0.2f V \" %Vout2 \n",
      "deltaVout=Vout2-Vout1 #V\n",
      "print \"Variation in Output Voltage is %0.2f V \" %deltaVout "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For 500 uA current, Output Voltage is -2.35 V \n",
        "For 1 mA current, Output Voltage is -4.70 V \n",
        "Variation in Output Voltage is -2.35 V \n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.10 - page : 112"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "AOL=2*10**5 #unitless\n",
      "Rio=2 #Mohm\n",
      "Ro=75 #ohm\n",
      "Ri=1 #kohm\n",
      "Rf=10 #kohm\n",
      "ACL=-AOL*Rf/(Rf+Ri+AOL*Ri) #unitless(Exact)\n",
      "print \"Exact close loop voltage gain is %0.2f \" %ACL \n",
      "ACL=-Rf/Ri #unitless(Approximate)\n",
      "print \"Approximate close loop voltage gain is %0.2f \" %ACL\n",
      "Beta=Ri/(Ri+Rf) #unitless\n",
      "SF=1+AOL*Beta #unitless\n",
      "Rif=Rio*10**6/SF #ohm\n",
      "print \"Input impedence after feedback is %0.f ohm\" %Rif\n",
      "# Answer for last part wrong in the textbook."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Exact close loop voltage gain is -10.00 \n",
        "Approximate close loop voltage gain is -10.00 \n",
        "Input impedence after feedback is 110 ohm\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.11 - page : 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Ri=2 #kohm\n",
      "Rf=200 #kohm\n",
      "#For 741C\n",
      "fo=5 #Hz\n",
      "AOL=2*10**5 #unitless\n",
      "UGB=1 #MHz\n",
      "ACL=-AOL*Rf/(Rf+Ri+AOL*Ri) #unitless(Exact)\n",
      "print \"Close loop voltage gain is %0.2f \" %ACL \n",
      "fodash=fo*AOL/-ACL #Hz\n",
      "fodash/=1000   #kHz\n",
      "print \"Bandwidth, fo_dash is %0.f kHz \" %fodash "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Close loop voltage gain is -99.95 \n",
        "Bandwidth, fo_dash is 10 kHz \n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.12 - page : 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from math import sqrt\n",
      "Beta=0.06 #feedback factor\n",
      "fo=100 #Hz\n",
      "AOL=40000 #unitless(at dc)\n",
      "SFdc=1+AOL*Beta #sacrifice factor at dc\n",
      "f=1 #kHz\n",
      "f=f*10**3 #Hz\n",
      "SF1=1+AOL*Beta/sqrt(1+f**2/fo**2) #sacrifice factor at 1 kHz\n",
      "#(a)\n",
      "ACL=AOL/SFdc #(unitless)exact close loop gain at dc\n",
      "print \"Exact close loop gain at dc is %0.2f \" %ACL \n",
      "#(b)\n",
      "ACL=1/Beta #(unitless)approximate close loop gain at dc\n",
      "print \"Approximate close loop gain at dc is %0.2f \" %ACL \n",
      "#(c)\n",
      "AOL=3980 #unitless(at dc)\n",
      "ACL=AOL/SF1 #(unitless)exact close loop gain at 1kHz\n",
      "print \"Exact close loop gain at 1kHz is %0.2f \" %ACL\n",
      "# Answer not accurate in the textbook."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Exact close loop gain at dc is 16.66 \n",
        "Approximate close loop gain at dc is 16.67 \n",
        "Exact close loop gain at 1kHz is 16.60 \n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4.13 - page : 115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Beta=0.04 #feedback factor\n",
      "AOL=5000 #unitless(at dc)\n",
      "Rio=40 #kohm\n",
      "Ro=1 #kohm\n",
      "SF=1+AOL*Beta #sacrifice factor at dc\n",
      "Rif=Rio/SF*1000 #ohm\n",
      "print \"Input impedence is %0.f ohm \" %Rif \n",
      "Rof=Ro*1000/SF #ohm\n",
      "print \"Output impedence is %0.2f ohm \" %Rof "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input impedence is 199 ohm \n",
        "Output impedence is 4.98 ohm \n"
       ]
      }
     ],
     "prompt_number": 41
    }
   ],
   "metadata": {}
  }
 ]
}