summaryrefslogtreecommitdiff
path: root/Electronic_Devices_and_Circuits_by_D._C._Kulshreshtha/Chapter06.ipynb
blob: 41c7fb9c0408587e8a8b6542b07e1ad80a38decf (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:cddd2c9e37ec7b804dfbcdffbef1b63f83f302e02514fa667b184fd9044289b8"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter06:Transistor Biasing and Stabilization"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 191"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the Q point\n",
      "#given\n",
      "B=50.;            #dc beta\n",
      "Rc=2.2*10.**3.;#ohm      #resistor connected to collector\n",
      "Rb=270.*10.**3.;#ohm      #resistor connected to base\n",
      "Vcc=9.;#V            #Voltage supply across the collector resistor\n",
      "Vbe=0.7;#V          #base to emitter voltage\n",
      "Ib=(Vcc-Vbe)/Rb;         #Base current\n",
      "Ic=B*Ib;         #Colletor current\n",
      "Ics=Vcc/Rc;       #Colletor saturation current\n",
      "\n",
      "#Actual Ic is the smaller of the above two values\n",
      "Vce=Vcc-Ic*Rc;\n",
      "print '%s %.1f %s %.1f %s' %(\"The Q point is =\",Vce,'V',Ic*1000,'mA');\n",
      "\n",
      "#Note--In book Vce = 5.7 V because of approaximation\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Q point is = 5.6 V 1.5 mA\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the Q point\n",
      "#given\n",
      "B=150.;            #dc beta\n",
      "Rc=1.*10.**3.;#ohm      #resistor connected to collector\n",
      "Rb=100.*10.**3.;#ohm      #resistor connected to base\n",
      "Vcc=10.;#V            #Voltage supply across the collector resistor\n",
      "Vbe=0.7;#V          #base to emitter voltage\n",
      "Ib=(Vcc-Vbe)/Rb;         #Base current\n",
      "Ic=B*Ib;         #Colletor current\n",
      "Ics=Vcc/Rc;       #Colletor saturation current\n",
      "\n",
      "#Actual Ic is the smaller of the above two values i.e. Ic(sat) and since the transistor is in saturation mode therefore Vce will become 0\n",
      "\n",
      "Vce=0;\n",
      "print '%s %.f %s %.f %s' %(\"The Q point is =\",Vce,\"V\",Ics*1000,\"mA\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Q point is = 0 V 10 mA\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine Rb and percentage change in collector current due to temperature rise\n",
      "#given\n",
      "\n",
      "#Calculating the base resistance\n",
      "B=20.;            #dc beta\n",
      "Rc=1.*10.**3.;#ohm      #resistor connected to collector\n",
      "Ic=1.*10.**-3.;#A       #collector current\n",
      "Vcc=6.;#V            #Voltage supply across the collector resistor\n",
      "Vbe=0.3;#V       #for germanium\n",
      "Icbo=2.*10.**-6.;#A       #collector  to base leakage current\n",
      "\n",
      "Ib=(Ic-(1.+B)*Icbo)/B;\n",
      "Rb=(Vcc-Vbe)/Ib;\n",
      "\n",
      "print '%s %.f %s' %(\"The value of resistor Ib is =\",120,'kohm');\n",
      "\n",
      "Rb=120.*10.**3.;#ohm approax\n",
      "\n",
      "#Now when temperature rise\n",
      "Icbo=10.*10.**-6.;#A #collector  to base leakage current\n",
      "B=25.;#dc beta\n",
      "Ic1=B*Ib+(B+1)*Icbo;# #changed collector current\n",
      "perc=(Ic1-Ic)*100./Ic;#percentage increase\n",
      "print '%s %.f %s' %(\"The percentage change in collector current is =\",perc,\"percent\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of resistor Ib is = 120 kohm\n",
        "The percentage change in collector current is = 46 percent\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the Q point at two different B\n",
      "#given\n",
      "\n",
      "#At B=50\n",
      "\n",
      "B=50.;            #dc beta\n",
      "Rc=2.*10.**3.;#ohm      #resistor connected to collector\n",
      "Rb=300.*10.**3.;#ohm      #resistor connected to base\n",
      "Vcc=9.;#V            #Voltage supply across the collector resistor\n",
      "Ib=Vcc/Rb;         #Base current\n",
      "Ic=B*Ib;         #Colletor current\n",
      "Ics=Vcc/Rc;       #Colletor saturation current\n",
      "\n",
      "#Actual Ic is the smaller of the above two values\n",
      "\n",
      "Vce=Vcc-Ic*Rc;\n",
      "print '%s %.2f %s %.1f %s' %(\"The Q point (At B=50) =\",Vce,\"V\",Ic*1000,\"mA\");\n",
      "\n",
      "#At B=150\n",
      "\n",
      "B1=150.;            #dc beta\n",
      "Ic1=B*Ib;         #Colletor current\n",
      "Ics1=Vcc/Rc;       #Colletor saturation current\n",
      "\n",
      "#Actual Ic is the smaller of the above two values i.e. Ic(sat) and since the transistor is in saturation mode therefore Vce will become 0\n",
      "\n",
      "Vce=0;\n",
      "print '%s %.f %s %.1f %s' %(\"\\nThe Q point (At B=150) is =\",Vce,\"V\",Ics*1000,\"mA\");\n",
      "\n",
      "print '%s %.f' %(\"\\nThe factor at which collector current increases =\",Ics1/Ic);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Q point (At B=50) = 6.00 V 1.5 mA\n",
        "\n",
        "The Q point (At B=150) is = 0 V 4.5 mA\n",
        "\n",
        "The factor at which collector current increases = 3\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 196"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine Q point in collector to base bias circuit\n",
      "#given\n",
      "B=100.;            #dc beta\n",
      "Rc=500.;#ohm      #resistor connected to collector\n",
      "Rb=500.*10.**3.;#ohm      #resistor connected to base\n",
      "Vcc=10.;#V            #Voltage supply across the collector resistor\n",
      "Ib=Vcc/(Rb+B*Rc);         #Base current\n",
      "Ic=B*Ib;         #Colletor current\n",
      "Ics=Vcc/Rc;       #Colletor saturation current\n",
      "\n",
      "#Actual Ic is the smaller of the above two values\n",
      "\n",
      "Vce=Vcc-(Ic+Ib)*Rc;\n",
      "print '%s %.1f %s %.1f %s' %(\"The Q point is =\",Vce,\"V\",Ic*1000,\"mA\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Q point is = 9.1 V 1.8 mA\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 196"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the collector current and change in it if B is changed by three times of previous B\n",
      "#given\n",
      "B=50.;            #dc beta\n",
      "Rc=2.*10.**3.;#ohm      #resistor connected to collector\n",
      "Rb=300.*10.**3.;#ohm      #resistor connected to base\n",
      "Vcc=9.;#V            #Voltage supply across the collector as it is PNP so taking positive\n",
      "Ib=Vcc/(Rb+B*Rc);         #Base current\n",
      "Ic=B*Ib;         #Colletor current\n",
      "print '%s %.3f %s' %(\"Collector current (B=50)=\",Ic*1000,\"mA\\n\");\n",
      "#Now B=150\n",
      "B=3.*B;      #three times of previous B\n",
      "Ib1=Vcc/(Rb+B*Rc);         #Base current\n",
      "Ic1=B*Ib1;         #Colletor current\n",
      "print '%s %.2f %s' %(\"Collector current (B=150)=\",Ic1*1000,\"mA\\n\");\n",
      "print '%s %.f' %(\"The factor at which collector current increases =\",Ic1/Ic);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Collector current (B=50)= 1.125 mA\n",
        "\n",
        "Collector current (B=150)= 2.25 mA\n",
        "\n",
        "The factor at which collector current increases = 2\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 199"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the value of all three current Ie and Ic and Ib\n",
      "#given\n",
      "B=90.;            #dc beta\n",
      "Rc=1.*10.**3.;#ohm      #resistor connected to collector\n",
      "Rb=500.*10.**3.;#ohm      #resistor connected to base\n",
      "Re=500.;#ohm      #resistor connected to emitter\n",
      "Vcc=9.;#V            #Voltage supply across the collector resistor\n",
      "Ib=Vcc/(Rb+B*Re);         #Base current\n",
      "Ic=B*Ib;         #Colletor current\n",
      "Ie=Ic+Ib;        #Emitter current\n",
      "print '%s %.1f %s %s %.3f %s %s %.3f %s' %(\"Base current =\",Ib*10**6,\"uA\\n\",\"\\nCollector current =\",Ic*10**3,\"mA\\n\",\"\\nEmitter current =\",Ie*10**3,\"mA\");\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Base current = 16.5 uA\n",
        " \n",
        "Collector current = 1.486 mA\n",
        " \n",
        "Emitter current = 1.503 mA\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 - Pg 199"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate max and min value of emitter current\n",
      "#given\n",
      "\n",
      "#At B=50\n",
      "\n",
      "B=50.;            #dc beta\n",
      "Rc=75.;#ohm      #resistor connected to collector\n",
      "Re=100.;#ohm      #resistor connected to emitter\n",
      "Rb=10.*10.**3.;#ohm      #resistor connected to base\n",
      "Vcc=6.;#V            #Voltage supply across the collector resistor\n",
      "Vbe=0.3;#V       #for germanium\n",
      "Ib=(Vcc-Vbe)/(Rb+(1.+B)*Re);         #Base current\n",
      "Ie=(1.+B)*Ib;\n",
      "Vce=Vcc-(Rc+Re)*Ie\n",
      "print '%s %.2f %s' %(\"Minimum emitter current =\",Ie*10**3,\"mA\\n\");\n",
      "print '%s %.2f %s' %(\"The collector to emitter volatge =\",Vce,\"V\\n\");\n",
      "\n",
      "#At B=300 \n",
      "\n",
      "B1=300.; #dc beta\n",
      "Ib1=(Vcc-Vbe)/(Rb+(1.+B1)*Re);#Base current\n",
      "Ie1=(1.+B1)*Ib1;\n",
      "Vce1=Vcc-(Rc+Re)*Ie1\n",
      "#Here Vce1= -1.4874 V but can never have negative voltage because Ie1 is wrong as it cant be more than saturation value therefore\n",
      "Ie1=Vcc/(Rc+Re);\n",
      "\n",
      "#And Vce=0 V\n",
      "\n",
      "Vce1=0;#V\n",
      "print '%s %.2f %s' %(\"Maximum emitter current =\",Ie1*10**3,\"mA\\n\");\n",
      "print '%s %.f %s' %(\"The collector to emitter volatge(saturation) =\",Vce1,\"V\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum emitter current = 19.25 mA\n",
        "\n",
        "The collector to emitter volatge = 2.63 V\n",
        "\n",
        "Maximum emitter current = 34.29 mA\n",
        "\n",
        "The collector to emitter volatge(saturation) = 0 V\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E9 - Pg 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the value of base resistance\n",
      "#given\n",
      "\n",
      "B=100.;            #dc beta\n",
      "Rc=200.;#ohm      #resistor connected to collector\n",
      "Re=500.;#ohm      #resistor connected to emitter\n",
      "Vcc=9.;#V         #Voltage supply across the collector as it is PNP so taking positive\n",
      "Vce=4.5;#V       #Collector to emitter voltage\n",
      "Ic=(Vcc-Vce)/(Rc+Re);\n",
      "Ib=Ic/B;\n",
      "Rb=(Vcc-B*Re*Ib)/Ib;\n",
      "print '%s %.f %s' %(\"The value of base resistance is =\",Rb/1000,\"kohm\");\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of base resistance is = 90 kohm\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10 - Pg 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the collector current at two different B\n",
      "#given\n",
      "\n",
      "#At B=50\n",
      "\n",
      "B=50.;#dc beta\n",
      "Rc=2.;#ohm #resistor connected to collector\n",
      "Re=1000.;#ohm #resistor connected to emitter\n",
      "Rb=300.*10.**3.;#ohm #resistor connected to base\n",
      "Vcc=9.;#V #Voltage supply across the collector resistor\n",
      "Ib=Vcc/(Rb+B*Re);         #Base current\n",
      "Ic=B*Ib;         #Colletor current\n",
      "print '%s %.2f %s' %(\"The collector current at (B=50)=\",Ic*1000,\"mA\\n\");\n",
      "\n",
      "#At B=150\n",
      "\n",
      "B1=150.;#dc beta\n",
      "Ib1=Vcc/(Rb+B1*Re);         #Base current\n",
      "Ic1=B1*Ib1;         #Colletor current\n",
      "print '%s %.1f %s' %(\"The collector current at (B=150)=\",Ic1*1000,\"mA\\n\");\n",
      "print '%s %.1f' %(\"The factor at which collector current increases=\",Ic1/Ic);\n",
      "\n",
      "#IN BOOK Ic(AT B=50)= 1.25 mA and Ic1/Ic=2.4 DUE TO APPROAXIMATION\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The collector current at (B=50)= 1.29 mA\n",
        "\n",
        "The collector current at (B=150)= 3.0 mA\n",
        "\n",
        "The factor at which collector current increases= 2.3\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E11 - Pg 205"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Q point in voltage divider\n",
      "#given\n",
      "B=100.;            #dc beta\n",
      "Rc=2.*10.**3.;#ohm      #resistor connected to collector\n",
      "R1=10.*10.**3.;#ohm      #voltage divider resistor 1\n",
      "R2=1.*10.**3.;#ohm      #voltage divider resistor 2\n",
      "Re=200.;#ohm      #resistor connected to emitter\n",
      "Vcc=10.;#V            #Voltage supply across the collector resistor\n",
      "Vbe=0.3;#V          #base to emitter voltage\n",
      "I=Vcc/(R1+R2);       #current through voltage divider\n",
      "Vb=I*R2;        #voltage at base\n",
      "Ve=Vb-Vbe;\n",
      "Ie=Ve/Re;\n",
      "Ic=Ie        #approaximating Ib is nearly equal to 0\n",
      "Vc=Vcc-Ic*Rc;\n",
      "Vce=(Vc)-Ve; \n",
      "print '%s %.1f %s %.f %s' %(\"The Q point is =\",Vce,\"V\",Ic*1000,\"mA\");\n",
      "\n",
      "Ibc=I/20.;     #critical value of base current\n",
      "Ib=Ic/B;      #actual base current\n",
      "\n",
      "#Since Ib < Ibc, hence assumption is alright\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Q point is = 3.3 V 3 mA\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E12 - Pg 207"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Solve the voltage divider accurately by applying thevenin's theorem\n",
      "#given\n",
      "B=100.;            #dc beta\n",
      "Rc=2.*10.**3.;#ohm      #resistor connected to collector\n",
      "R1=10.;#ohm      #voltage divider resistor 1\n",
      "R2=1.;#ohm      #voltage divider resistor 2\n",
      "Re=200.;#ohm      #resistor connected to emitter\n",
      "Vcc=10.;#V            #Voltage supply across the collector resistor\n",
      "Vbe=0.3;#V          #base to emitter voltage\n",
      "\n",
      "Vth=Vcc*R2/(R1+R2);\n",
      "Rth=R1*R2/(R1+R2);\n",
      "\n",
      "print '%s %.1f %s' %(\"\\nThevenin equivalent voltage Vth =\",Vth,\"V\");\n",
      "print '%s %.1f %s' %(\"\\nThevenin equivalent resistance Rth =\",Rth,\"kohm\");\n",
      "\n",
      "Ib=(Vth-Vbe)/(Rth+(1.+B)*Re);\n",
      "Ic=B*Ib;\n",
      "Ie=Ic+Ib;\n",
      "Vce=Vcc-Ic*Rc-Ie*Re; \n",
      "print '%s %.4f %s' %(\"\\nThe accurate value of Ic =\",Ic*10**3,\"mA\");\n",
      "print '%s %.5f %s' %(\"\\nThe accurate value of Vce =\",Vce,\"V\");\n",
      "Icp=3.*10.**-3.; # Current calculated by voltage divider in previous example\n",
      "Vcep=3.4; # Voltage calculated by voltage divider in previous example\n",
      "Err_Ic=(Ic-Icp)*100./Ic;\n",
      "Err_Vce=(Vce-Vcep)*100./Vce;\n",
      "print '%s %.1f %s' %(\"\\nError in Ic =\",Err_Ic,\"percent\\n\");\n",
      "print '%s %.1f %s' %(\"\\nError in Vce =\",Err_Vce,\"percent\");\n",
      "\n",
      "# The errors and The accurate values are different \n",
      "# because of the approaximation in Vth and Rth in book\n",
      "\n",
      "# In Book Ic = 2.8436 mA and Vce = 3.73839 V\n",
      "# Error in Ic = -5.5% \n",
      "# Error in Vce = +9% \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Thevenin equivalent voltage Vth = 0.9 V\n",
        "\n",
        "Thevenin equivalent resistance Rth = 0.9 kohm\n",
        "\n",
        "The accurate value of Ic = 3.0152 mA\n",
        "\n",
        "The accurate value of Vce = 3.36060 V\n",
        "\n",
        "Error in Ic = 0.5 percent\n",
        "\n",
        "\n",
        "Error in Vce = -1.2 percent\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E13 - Pg 209"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine the Q point for the emitter bias circuit\n",
      "#given\n",
      "B=100.;               #dc beta\n",
      "Rc=5.*10.**3.;#ohm      #resistor connected to collector\n",
      "Rb=10.*10.**3.;#ohm      #resistor connected to base\n",
      "Re=10.*10.**3.;#ohm      #resistor connected to emitter \n",
      "Vcc=12.;#V #Voltage supply across the collector resistor\n",
      "Vee=15;#V #supply at emitter\n",
      "Ie=Vee/Re;\n",
      "Ic=Ie;\n",
      "Vce=Vcc-Ic*Rc;\n",
      "print '%s %.1f %s %.1f %s' %(\"The Q point is =\",Vce,\"V\",Ic*1000,\"mA\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Q point is = 4.5 V 1.5 mA\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E14 - Pg 211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Vgs and Rs\n",
      "#given\n",
      "import math\n",
      "Vp=2.;#V\n",
      "Idss=1.75*10.**-3.;#A      #drain current at Vgs=0\n",
      "Vdd=24.;#V             #drain to supply source\n",
      "Id=1.*10.**-3.;#A       #drain current\n",
      "Vgs=(-Vp)*(1-math.sqrt(Id/Idss));\n",
      "Rs=abs(Vgs)/Id;\n",
      "print '%s %.3f %s' %(\"Vgs =\",Vgs,\"V\\n\");\n",
      "print '%s %.f %s' %(\"Rs =\",Rs,\"ohm\");\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vgs = -0.488 V\n",
        "\n",
        "Rs = 488 ohm\n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}