summaryrefslogtreecommitdiff
path: root/Electronic_Devices_And_Circuits/EDC_ch_5_1.ipynb
blob: 6f5add30a2ece0d4e555191b8900438cf1939618 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "chapter 5: Feed Back"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.1, Page No.192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Percentage of output which is fed back\n",
      "import math\n",
      "#variable declaration\n",
      "A=50.0                         #gain(unitless)\n",
      "Af=10.0                        #gain(unitless)\n",
      "\n",
      "#calculation\n",
      "\n",
      "#Formula : Af=A/(1+A*Beta)\n",
      "Beta=(A/Af-1)/A               #feedback ratio (unitless)\n",
      "\n",
      "#Result\n",
      "print(\"Percentage of output feed back : %.0f%%\"%(Beta*100))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage of output feed back : 8%\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.2, Page No.192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Voltage gain and reduction in voltage\n",
      "import math\n",
      "#variable declaration\n",
      "A=1000.0                     #gainWithoutFeedback(unitless)\n",
      "Adash=800                    #gainWithoutFeedback(unitless) \n",
      "g_reduce=0.40                #factor by which gain reduced\n",
      "#Calculations\n",
      "\n",
      "#Part (i) : \n",
      "Af=A-A*g_reduce              #gainWithFeedback(unitless)\n",
      "#Formula : Af=A/(1+A*Beta)\n",
      "Beta=(A/Af-1)/A           #feedback factor (unitless)\n",
      "\n",
      "Af_dash=Adash/(1+Adash*Beta)\n",
      "\n",
      "#Part (ii)\n",
      "Reduction=((A-Adash)/A)*100  #% reduction without feedback\n",
      "Reduction1=((Af-Af_dash)/Af)*100 #% reduction without feedback\n",
      "\n",
      "#Result\n",
      "print(\"At normal collector supply :\")\n",
      "print(\"with feedback gain reduces by a factor %.2f\"%g_reduce)\n",
      "print(\"At normal collector supply, Gain with feedback :%.0f \"%Af)\n",
      "print(\"\\nAt reduced power supply :\")\n",
      "print(\"At Reduced collector supply, Gain with feedback : %.0f\"%(math.ceil(Af_dash)))\n",
      "print(\"%% reduction in gain without feedback :%.0f%%\"%Reduction)\n",
      "print(\"%% reduction in gain with feedback :%.0f%%\"%Reduction1)\n",
      "#Note : answer of Af is wrong in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "At normal collector supply :\n",
        "with feedback gain reduces by a factor 0.40\n",
        "At normal collector supply, Gain with feedback :600 \n",
        "\n",
        "At reduced power supply :\n",
        "At Reduced collector supply, Gain with feedback : 522\n",
        "% reduction in gain without feedback :20%\n",
        "% reduction in gain with feedback :13%\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.3, Page No.192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Gain with feedback factor and feedback voltage\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "A=100.0                           #gain without feedback(unitless)\n",
      "Beta=1.0/25.0                     #feedback ratio (unitless)\n",
      "Vi=50.0                           #in mV\n",
      "\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Part (i) :\n",
      "Af=A/(1+A*Beta)                   #gain with feedback(unitless)\n",
      "\n",
      "\n",
      "#Part (ii) :\n",
      "FeedbackFactor=Beta*A            #unitless\n",
      "\n",
      "\n",
      "#Part (iii) :\n",
      "Vo_dash=Af*Vi*10**-3             #in volt\n",
      "\n",
      "\n",
      "#Part (iv) :\n",
      "FeedbackVoltage=Beta*Vo_dash     #in volt\n",
      "\n",
      "\n",
      "#Part (v) :\n",
      "Vi_dash=Vi*(1+Beta*A)            #in mv\n",
      "\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"(i)\\n Gain with feedback :%.0f\"%Af)\n",
      "print(\"(ii)\\n Feedback Factor :%.0f\"%FeedbackFactor)\n",
      "print(\"(iii)\\n Output Voltage in volts :%.0f\"%Vo_dash)\n",
      "print(\"(iv)\\n Feedback Voltage in volts :%.2f\"%FeedbackVoltage)\n",
      "print(\"(v)\\n New Increased Input Voltage in milli volts :%.0f\"%Vi_dash)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)\n",
        " Gain with feedback :20\n",
        "(ii)\n",
        " Feedback Factor :4\n",
        "(iii)\n",
        " Output Voltage in volts :1\n",
        "(iv)\n",
        " Feedback Voltage in volts :0.04\n",
        "(v)\n",
        " New Increased Input Voltage in milli volts :250\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.4, Page no.193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Bandwidth with negative feedback\n",
      "import math\n",
      "#variable declaration\n",
      "BW=200.0                              #in kHz\n",
      "A=40.0                                #gain without feedback(in dB)\n",
      "Beta=5.0                              #negative feedback in %\n",
      "Beta=Beta/100.0                       #feedback factor\n",
      "\n",
      "#calculation\n",
      "\n",
      "#Formula : Af=A/(1+A*Beta)\n",
      "Af=A/(1+A*Beta)                    #gain with feedback(in dB)\n",
      "BW_dash=A*BW/Af                    #in kHz\n",
      "\n",
      "#Result\n",
      "print(\"Since gain bandwidth product remains constant, A*BW=Af*BW_dash\")\n",
      "print(\"New Bandwidth in kHz : %.0f\"%BW_dash)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Since gain bandwidth product remains constant, A*BW=Af*BW_dash\n",
        "New Bandwidth in kHz : 600\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.5, Page No.193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Fraction of output fed back\n",
      "import math\n",
      "#variable declaration\n",
      "A=140.0                     #gain without feedback(unitless)\n",
      "Af=17.5                     #gain with feedback(unitless)\n",
      "\n",
      "#Calculations\n",
      "#Formula : Af=A/(1+A*Beta)\n",
      "Beta=(A/Af-1)/A             #feedback ratio (unitless)\n",
      "\n",
      "#Result\n",
      "print(\"Fraction of output fed back to input : %.2f or 1/20\"%Beta)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fraction of output fed back to input : 0.05 or 1/20\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.6, Page No.205"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Small Change in gain\n",
      "import math\n",
      "#variable declaration\n",
      "A=200.0                           #gain without feedback(unitless)\n",
      "Beta=0.25                         #fraction ratio(unitless)\n",
      "\n",
      "#CAlculations\n",
      "#Given : Normal gain changes by 10 %, it means dA/A=10/100\n",
      "dABYA=10.0/100.0                  #change in gain\n",
      "dAfBYAf=(1/(1+Beta*A))*(dABYA)    #change in gain\n",
      "\n",
      "#Result\n",
      "print(\"We have, Af=A/(1+Beta*A).................eqn(1)\")\n",
      "print(\"\\nDifferentiating it with respect to A, we get\")\n",
      "print(\"\\ndAf/dA=((1+Beta*A)-Beta*A)/(1+Beta*A)^2=1/(1+Beta*A)^2\")\n",
      "print(\"\\ndAf=dA/(1+Beta*A)^2.......................eqn(2)\")\n",
      "print(\"\\nDividing eqn(2) by eqn(1),\")\n",
      "print(\"\\ndAf/Af=(dA/((1+Beta*A)^2))*((1+Beta*A)/A)=(1/(1+Beta*A))*(dA/A)\")\n",
      "print(\"\\n\\nChange in gain : %.4f\"%((math.floor(dAfBYAf*10**4))/10**4))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "We have, Af=A/(1+Beta*A).................eqn(1)\n",
        "\n",
        "Differentiating it with respect to A, we get\n",
        "\n",
        "dAf/dA=((1+Beta*A)-Beta*A)/(1+Beta*A)^2=1/(1+Beta*A)^2\n",
        "\n",
        "dAf=dA/(1+Beta*A)^2.......................eqn(2)\n",
        "\n",
        "Dividing eqn(2) by eqn(1),\n",
        "\n",
        "dAf/Af=(dA/((1+Beta*A)^2))*((1+Beta*A)/A)=(1/(1+Beta*A))*(dA/A)\n",
        "\n",
        "\n",
        "Change in gain : 0.0019\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.7, Page No.206"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#New gain distortion and input voltage\n",
      "import math\n",
      "#Variable declaration\n",
      "A=200.0                               #gain without feedback(unitless)\n",
      "Dn=10.0                               #Distortion in %\n",
      "Vi=0.5                                #Initial input voltage in volt\n",
      "Beta=0.05                             #feedback ratio (unitless)\n",
      "\n",
      "#Calculations\n",
      "#Formula : Af=A/(1+A*Beta)\n",
      "Af=A/(1+A*Beta)                       #gain with feedback(unitless)\n",
      "Dn_dash=Dn/(1+A*Beta)                 #new distortion in %\n",
      "InitialOutputVoltage=A*Vi             #in Volt\n",
      "NewInputVoltage=InitialOutputVoltage/Af\n",
      "\n",
      "print(\"New gain :%.3f\"%Af)\n",
      "print(\"Distortion with negative feedback : %.3f%%\"%Dn_dash)\n",
      "print(\"Initial Output Voltage in volt:%.0f\"%InitialOutputVoltage)\n",
      "print(\"New Input Voltage in volts :%.2f\"%NewInputVoltage)\n",
      "#Note :Ans of Af and  NewInputVoltage is not acurate in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "New gain :18.182\n",
        "Distortion with negative feedback : 0.909%\n",
        "Initial Output Voltage in volt:100\n",
        "New Input Voltage in volts :5.50\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.8, Page No. 206"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Feedback rction voltage and impedence\n",
      "import math\n",
      "\n",
      "#variable declaration\n",
      "A=10000.0                             #gain without feedback(unitless)\n",
      "Zi=10.0                               #in kOhm\n",
      "Zo=100.0                              #in Ohm\n",
      "R1=2.0                                #in Ohm\n",
      "R2=18.0                               #in Ohm\n",
      "\n",
      "#calculations\n",
      "\n",
      "#Part (i) :\n",
      "Beta=R1/(R1+R2)                     #feedback fraction(unitless)\n",
      "\n",
      "#Part (ii) :\n",
      "Af=A/(1+A*Beta)                     #Gain with negative feedback(unitless)\n",
      "\n",
      "#Part (iii) :\n",
      "inputVoltge=0.5                     #in mV\n",
      "outputVoltge=Af*inputVoltge         #in mV\n",
      "\n",
      "#Part (iv) :\n",
      "Zif=Zi*(1+Beta*A)                   #in kOhm\n",
      "\n",
      "#Part (v) :\n",
      "Zof=Zo/(1+Beta*A)                   #in kOhm\n",
      "\n",
      "print(\"(i)\\nFeedback Fraction :%.1f\"%Beta)\n",
      "print(\"\\n(ii)\\nGain with negative feedback :%.0f\"%(math.ceil(Af)))\n",
      "print(\"\\n(iii)\\nOutput Voltage in milli volts :%.0f\"%(math.ceil(outputVoltge)))\n",
      "print(\"\\n(iv)\\nInput impedance of feedback amplifier in Mohm : %.2f\"%(Zif*10**-3))\n",
      "print(\"\\n(v)\\nOutput impedance with feedback in Ohm : %.1f\"%Zof)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)\n",
        "Feedback Fraction :0.1\n",
        "\n",
        "(ii)\n",
        "Gain with negative feedback :10\n",
        "\n",
        "(iii)\n",
        "Output Voltage in milli volts :5\n",
        "\n",
        "(iv)\n",
        "Input impedance of feedback amplifier in Mohm : 10.01\n",
        "\n",
        "(v)\n",
        "Output impedance with feedback in Ohm : 0.1\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.9, Page No.207"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Voltage gain input and output resistance\n",
      "import math\n",
      "#variable declaration\n",
      "A=200                                #gain without feedback(unitless)\n",
      "Ri=2                                 #in kOhm\n",
      "Ro=12                                #in kOhm\n",
      "Beta=0.02                            #feedbak ratio(unitless)\n",
      "\n",
      "#Calculation\n",
      "\n",
      "#Part (i) :\n",
      "Af=A/(1+A*Beta)                      #gain with feedback(unitless)\n",
      "\n",
      "#Part (ii) :\n",
      "Rif=Ri*(1+A*Beta)                    #in kOhm\n",
      "\n",
      "#Part (ii) :\n",
      "Rof=Ro/(1+A*Beta)                    #in kOhm\n",
      "\n",
      "#Result\n",
      "print(\"(i)\\nGain with Negative Feedback :%.0f\"%Af)\n",
      "print(\"\\n(ii)\\nInput resistance with feedback in kOhm :%.0f\"%Rif)\n",
      "print(\"\\n(iii)\\nOutput resistance with feedback in kOhm :%.1f\"%Rof)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)\n",
        "Gain with Negative Feedback :40\n",
        "\n",
        "(ii)\n",
        "Input resistance with feedback in kOhm :10\n",
        "\n",
        "(iii)\n",
        "Output resistance with feedback in kOhm :2.4\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.10, Page No.207"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Gain wih feedbck in dB\n",
      "import math\n",
      "#variable declaration\n",
      "A=1000.0                       #gain(unitless)\n",
      "Beta=1.0/20.0                  #feedback ratio (unitless)\n",
      "\n",
      "#Calculation\n",
      "#Formula : Af=A/(1+A*Beta)\n",
      "Af=A/(1+A*Beta)                #gain with feedback(unitless)\n",
      "Af=20*math.log10(Af)           #in dB\n",
      "\n",
      "#Result\n",
      "print(\"Gain with feedback in dB : %.1f\"%Af)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain with feedback in dB : 25.8\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " example 5.11, page No.208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Bandwidth after feedback\n",
      "import math\n",
      "#Variable declarations\n",
      "\n",
      "A=800.0                               #gain(unitless)\n",
      "f1=40.0                               #in Hz\n",
      "f2=16.0                               #in kHz\n",
      "Beta=2.0/100.0                        #feedback fator (unitless)\n",
      "\n",
      "#caalculations\n",
      "\n",
      "#Formula : Af=A/(1+A*Beta)\n",
      "Af=A/(1+A*Beta)                       #gain with feedback(unitless)\n",
      "BW=f2*10**3-f1                        #Bandwidth of amplifier in Hz\n",
      "f1_f=f1/(1+A*Beta)                    #in Hz\n",
      "f2_f=f2*(1+A*Beta)                    #in kHz\n",
      "BW_f=f2_f*10**3-f1_f                  #Bandwith after feedback in Hz\n",
      "\n",
      "#result\n",
      "print(\"Voltage gin with feedback : %.0f\"%Af)\n",
      "print(\"Bandwidth of amplifier in kHz : %.2f\"%(BW*10**-3))\n",
      "print(\"Bandwith after feedback in KHz : %.0f\"%(BW_f*10**-3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage gin with feedback : 47\n",
        "Bandwidth of amplifier in kHz : 15.96\n",
        "Bandwith after feedback in KHz : 272\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " example 5.12, Page No.208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Gain and new bandwidth\n",
      "import math\n",
      "#Variable declaration\n",
      "A=100.0                           #gain(unitless)\n",
      "BW=10.0                           #in Hz\n",
      "Beta=5.0                          #in %\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Part (i) :\n",
      "#Formula : Af=A/(1+A*Beta)\n",
      "Af=A/(1+A*Beta/100.0)            #gain with feedback(unitless)\n",
      "\n",
      "#Part (ii)\n",
      "BW_f=BW*(1+A*Beta/100.0)         #Bandwith after feedback in Hz\n",
      "\n",
      "#Result\n",
      "print(\"Voltage gain with feedback :%.2f \"%Af)\n",
      "print(\"Bandwith with negative feedback in KHz : %.0f\"%BW_f)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage gain with feedback :16.67 \n",
        "Bandwith with negative feedback in KHz : 60\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 5.13, Page No.208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Input resistance and voltage gain\n",
      "import math\n",
      "#variable decclaration\n",
      "hfe=50.0                                #unitless\n",
      "hie=1.1                                 #in kOhm\n",
      "hoe=0.0                                 #unitless\n",
      "hre=0.0                                 #unitless\n",
      "RL=4.0                                  #in kOhm\n",
      "Rs=10.0                                 #in kOhm\n",
      "RB=40.0                                 #in kOhm\n",
      "\n",
      "#calculation\n",
      "\n",
      "RLdash=RB*RL/(RB+RL)                    #in Kohm\n",
      "AV=-hfe*RLdash/hie                      #unitless\n",
      "\n",
      "#Part (i) ;\n",
      "Rif=hie*(RB/(1-AV))/(hie+(RB/(1-AV)))   #in kOhm\n",
      "print(\"Input resistance with feedback in Ohm : %.0f\"%(Rif*1000))\n",
      "#Part (ii) :\n",
      "AVf=AV*(Rif/(Rs+Rif))                   #unitless\n",
      "print(\"Voltage gain with feedback : %.2f\"%((math.ceil(AVf*100))/100))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input resistance with feedback in Ohm : 197\n",
        "Voltage gain with feedback : -3.19\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}