summaryrefslogtreecommitdiff
path: root/Electronics_Circuits_and_Systems_by_Y._N._Bapat/Ch5.ipynb
blob: 4278055dba306398829e2b9becd6c4e466fceacd (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 5 - Basic Transistor Amplifiers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5_1 Page No. 136"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RL= 5000.00  ohm\n",
      "R1= 100000.00  ohm\n",
      "R2= 10000.00  ohm\n",
      "rc= 50000.00  ohm\n",
      "rbe= 1000.00  ohm\n",
      "gm = 0.05  A/V\n",
      "For BJT,Av=(-gm*RL)= -250.00\n",
      "AI=(gm*rbe)= 50.00\n",
      "gm = 0.01  A/V\n",
      "For FET,Av=(-gm*RL)= -25.00  \n",
      "R0= 50000.00  ohm\n",
      "Ri= 1000.00  ohm\n",
      "RB=(R1*R2)/(R1+R2)= 9090.91  ohm\n",
      "Ri= (RB*rbe)/(RB+rbe)=900.90  ohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division  \n",
    "RL=5*10**(3)\n",
    "print \"RL= %0.2f\"%(RL),\" ohm\"  #Load resistance\n",
    "R1=100*10**(3)\n",
    "print \"R1= %0.2f\"%(R1),\" ohm\"  # resistance\n",
    "R2=10*10**(3)\n",
    "print \"R2= %0.2f\"%(R2),\" ohm\"  # resistance\n",
    "rc=50*10**(3)\n",
    "print \"rc= %0.2f\"%(rc),\" ohm\"  #collector resistance\n",
    "rd=rc # Drain and collector  resistance are equal\n",
    "rbe=1*10**(3)\n",
    "print \"rbe= %0.2f\"%(rbe),\" ohm\"  #Load resistance\n",
    "gm=50*10**(-3)\n",
    "print \"gm = %0.2f\"%(gm),\" A/V\"#  transconductance for BJT \n",
    "Av=(-gm*RL)\n",
    "print \"For BJT,Av=(-gm*RL)= %0.2f\"%(Av) #Voltage gain for BJT\n",
    "AI=gm*rbe\n",
    "print \"AI=(gm*rbe)= %0.2f\"%(AI) # current gain for BJT\n",
    "gm=5*10**(-3)\n",
    "print \"gm = %0.2f\"%(gm),\" A/V\"#  transconductance for FET \n",
    "Av=(-gm*RL)\n",
    "print \"For FET,Av=(-gm*RL)= %0.2f\"%(Av),\" \" # gain for FET\n",
    "R0=rd\n",
    "print \"R0= %0.2f\"%(R0),\" ohm\"  #output resistance for FET and BJT\n",
    "Ri=rbe\n",
    "print \"Ri= %0.2f\"%(Ri),\" ohm\"  #BJT input resistance \n",
    "RB=(R1*R2)/(R1+R2)\n",
    "print \"RB=(R1*R2)/(R1+R2)= %0.2f\"%(RB),\" ohm\"  # eqivalent Base resistance for  BJT\n",
    "Ri=(RB*rbe)/(RB+rbe)\n",
    "print \"Ri= (RB*rbe)/(RB+rbe)=%0.2f\"%(Ri),\" ohm\"  #New value of BJT input resistance "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5_2 Page No. 137"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RL= 5000.00  ohm\n",
      "R1= 100000.00  ohm\n",
      "R2= 100000.00  ohm\n",
      "Rs= 5000.00  ohm\n",
      "Beta_o = 50.00\n",
      "rbe= 1000.00  ohm\n",
      "gm = 0.05  A/V\n",
      "rc= 50000.00  ohm\n",
      "Av=RL/(RL+1/gm)= 1.00\n",
      "Avs=RL/[(Rs/Beta_o)+(1/gm)+(RL)]= 0.98\n",
      "AI=-(Beta_o+1)= -51.00\n",
      "R0= (Rs+rbe)/Beta_o=120.00  ohm\n",
      "Ri= rbe+Beta_o*RL=251000.00  ohm\n",
      "RB=(R1*R2)/(R1+R2)= 50000.00  ohm\n",
      "Rieff= (Ri*RB)/(RB+Ri)=41694.35  ohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division  \n",
    "RL=5*10**(3)\n",
    "print \"RL= %0.2f\"%(RL),\" ohm\"  #Load resistance\n",
    "R1=100*10**(3)\n",
    "print \"R1= %0.2f\"%(R1),\" ohm\"  # resistance\n",
    "R2=100*10**(3)\n",
    "print \"R2= %0.2f\"%(R2),\" ohm\"  # resistance\n",
    "Rs=5*10**(3)\n",
    "print \"Rs= %0.2f\"%(Rs),\" ohm\"  # Source resistance\n",
    "Beta_o=50\n",
    "print \"Beta_o = %0.2f\"%(Beta_o) #BJT gain\n",
    "rbe=1*10**(3)\n",
    "print \"rbe= %0.2f\"%(rbe),\" ohm\"  #Base-emitter resistance\n",
    "gm=50*10**(-3)\n",
    "print \"gm = %0.2f\"%(gm),\" A/V\"#  transconductance for BJT \n",
    "rc=50*10**(3)\n",
    "print \"rc= %0.2f\"%(rc),\" ohm\"  #collector resistance\n",
    "Av=RL/(RL+1/gm) # Gain formulae\n",
    "print \"Av=RL/(RL+1/gm)= %0.2f\"%(Av) # voltage gain for BJT\n",
    "Avs=RL/((Rs/Beta_o)+(1/gm)+(RL))\n",
    "print \"Avs=RL/((Rs/Beta_o)+(1/gm)+(RL))= %0.2f\"%(Avs) # Overall voltage gain for BJT\n",
    "AI=-(Beta_o+1)\n",
    "print \"AI=-(Beta_o+1)= %0.2f\"%(AI) # current gain for BJT\n",
    "R0=(Rs+rbe)/Beta_o\n",
    "print \"R0= (Rs+rbe)/Beta_o=%0.2f\"%(R0),\" ohm\"  #output resistance for  BJT\n",
    "Ri=rbe+Beta_o*RL # formulae\n",
    "print \"Ri= rbe+Beta_o*RL=%0.2f\"%(Ri),\" ohm\"  # value of BJT input resistance \n",
    "RB=(R1*R2)/(R1+R2)\n",
    "print \"RB=(R1*R2)/(R1+R2)= %0.2f\"%(RB),\" ohm\"  # eqivalent Base resistance for  BJT\n",
    "Rieff=(Ri*RB)/(RB+Ri)\n",
    "print \"Rieff= (Ri*RB)/(RB+Ri)=%0.2f\"%(Rieff),\" ohm\"  #Effective value of BJT input resistance "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5_3 Page No. 142"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RL= 5000.00  ohm\n",
      "RF= 5000.00  ohm\n",
      "Beta_o = 50.00\n",
      "rbe= 1000.00  ohm\n",
      "gm = 0.05  A/V\n",
      "rc= 50000.00  ohm\n",
      "Ri= rbe+RF*(1+gm*rbe)=256000.00  ohm\n",
      "Av=(-gm*RL)/(1+gm*RF)= -1.00\n",
      "AI=(Beta_o)= 50.00\n",
      "R0= Beta_o*rc=2500000.00  ohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division  \n",
    "RL=5*10**(3)\n",
    "print \"RL= %0.2f\"%(RL),\" ohm\"  #Load resistance\n",
    "RF=5*10**(3)\n",
    "print \"RF= %0.2f\"%(RF),\" ohm\"  # resistance\n",
    "Beta_o=50\n",
    "print \"Beta_o = %0.2f\"%(Beta_o) #BJT gain\n",
    "rbe=1*10**(3)\n",
    "print \"rbe= %0.2f\"%(rbe),\" ohm\"  #Base-emitter resistance\n",
    "gm=50*10**(-3)\n",
    "print \"gm = %0.2f\"%(gm),\" A/V\"#  transconductance for BJT \n",
    "rc=50*10**(3)\n",
    "print \"rc= %0.2f\"%(rc),\" ohm\"  #collector resistance\n",
    "Ri=rbe+RF*(1+gm*rbe) # formulae\n",
    "print \"Ri= rbe+RF*(1+gm*rbe)=%0.2f\"%(Ri),\" ohm\"  #  BJT input resistance \n",
    "Av=(-gm*RL)/(1+gm*RF)# formulae\n",
    "print \"Av=(-gm*RL)/(1+gm*RF)= %0.2f\"%(Av) # voltage gain for BJT\n",
    "AI=Beta_o\n",
    "print \"AI=(Beta_o)= %0.2f\"%(AI) # current gain for BJT\n",
    "R0=Beta_o*rc\n",
    "print \"R0= Beta_o*rc=%0.2f\"%(R0),\" ohm\"  #output resistance for  BJT"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5_4 Page No. 148"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RL= 5000.00  ohm\n",
      "RF= 2500.00  ohm\n",
      "Rs= 50.00  ohm\n",
      "ro= 50000.00  ohm\n",
      "rc= 50000.00  ohm\n",
      "rbe= 1000.00  ohm\n",
      "For CG Amplifier\n",
      "gm = 0.01  A/V\n",
      "Ri= 1/gm=200.00  ohm\n",
      "Avs=gm*RL/(1+gm*Rs)= 20.00\n",
      "Ro=rd*(1+gm*Rs)=62500.00  ohm\n",
      "For CB Amplifier\n",
      "gm = 0.05  A/V\n",
      "Ri= 1/gm=20.00  ohm\n",
      "Avs=gm*RL/(1+gm*Rs)= 71.43\n",
      "Ro=gm*(rbe*rc)=2.50e+06  ohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division  \n",
    "RL=5*10**(3)\n",
    "print \"RL= %0.2f\"%(RL),\" ohm\"  #Load resistance\n",
    "RF=2.5*10**(3)\n",
    "print \"RF= %0.2f\"%(RF),\" ohm\"  # resistance\n",
    "Rs=50\n",
    "print \"Rs= %0.2f\"%(Rs),\" ohm\"  # resistance\n",
    "ro=50*10**(3)\n",
    "print \"ro= %0.2f\"%(ro),\" ohm\"  # output resistance\n",
    "rd=ro # drain resistance\n",
    "rc=ro# Collector resistance\n",
    "print \"rc= %0.2f\"%(rc),\" ohm\"  # Collector resistance\n",
    "rbe=1*10**(3)\n",
    "print \"rbe= %0.2f\"%(rbe),\" ohm\"  #base -emitter resistance\n",
    "print \"For CG Amplifier\"\n",
    "gm=5*10**(-3)\n",
    "print \"gm = %0.2f\"%(gm),\" A/V\"#  transconductance for FET \n",
    "Ri=1/gm # formulae\n",
    "print \"Ri= 1/gm=%0.2f\"%(Ri),\" ohm\"  # value of CGA (common gate amplifier)input resistance for FET\n",
    "Avs=gm*RL/(1+gm*Rs)\n",
    "print \"Avs=gm*RL/(1+gm*Rs)= %0.2f\"%(Avs) # Overall voltage gain for FET (CGA)\n",
    "Ro=rd*(1+gm*Rs)\n",
    "print \"Ro=rd*(1+gm*Rs)=%0.2f\"%(Ro),\" ohm\"  #output resistance for  FET (CGA)\n",
    "print \"For CB Amplifier\"\n",
    "gm=50*10**(-3)\n",
    "print \"gm = %0.2f\"%(gm),\" A/V\"#  transconductance for BJT\n",
    "Ri=1/gm # formulae\n",
    "print \"Ri= 1/gm=%0.2f\"%(Ri),\" ohm\"  # value of CBA (common base amplifier)input resistance for BJT\n",
    "Avs=gm*RL/(1+gm*Rs)\n",
    "print \"Avs=gm*RL/(1+gm*Rs)= %0.2f\"%(Avs) # Overall voltage gain for BJT (CBA)\n",
    "Ro=gm*(rbe*rc)\n",
    "print \"Ro=gm*(rbe*rc)=%0.2e\"%(Ro),\" ohm\"  #output resistance for  BJT (CBA)\n",
    "\n",
    "#NOTE: I have calculated first all the parameters for CG amplifier and then for CB amplifier but in book parameters have been calculated alternatingly for CG and CB amplifiers."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5_5 Page No. 152"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RL= 5000.00  ohm\n",
      "Cc= 1.00e-07  farad\n",
      "Ri= 100000.00  ohm\n",
      "CSH= 0.00  farad\n",
      "Avm=100.00\n",
      "fL=1/(2*(pi)*(Ri)*(Cc))= 15.92 Hz \n",
      "fH=1/(2*(pi)*(RL)*(CSH))= 3.18e+05  Hz\n",
      "BW=fH-fL= 318293.97  Hz\n",
      "fT=Avm*fH= 3.18e+07  Hz\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "from __future__ import division  \n",
    "RL=5*10**(3)\n",
    "print \"RL= %0.2f\"%(RL),\" ohm\"  #Load resistance\n",
    "Cc=0.1*10**(-6)\n",
    "print \"Cc= %0.2e\"%(Cc),\" farad\"  #capacitance\n",
    "Ri=100*10**(3)\n",
    "print \"Ri= %0.2f\"%(Ri),\" ohm\"  #  input resistance for Amplifier\n",
    "CSH=100*10**(-12)\n",
    "print \"CSH= %0.2f\"%(CSH),\" farad\"  #shunt load capacitance\n",
    "Avm=100\n",
    "print \"Avm=%0.2f\"%(Avm) # Mid-frequency gain \n",
    "fL=1/(2*(pi)*(Ri)*(Cc))\n",
    "print \"fL=1/(2*(pi)*(Ri)*(Cc))= %0.2f\"%(fL),\"Hz \" # Lower cutoff-frequency \n",
    "fH=1/(2*(pi)*(RL)*(CSH))\n",
    "print \"fH=1/(2*(pi)*(RL)*(CSH))= %0.2e\"%(fH),\" Hz\" # Higher cutoff-frequency \n",
    "BW=fH-fL\n",
    "print \"BW=fH-fL= %0.2f\"%(BW),\" Hz\" # Bandwidth\n",
    "fT=Avm*fH\n",
    "print \"fT=Avm*fH= %0.2e\"%(fT),\" Hz\" # Unity gain bandwidth\n",
    "# ERROR NOTE: calculated value of lower cutoff frequency, fL= 15.915494 Hz but in book given as 15.0 Hz   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5_6 Page No. 152"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "IDSS = 0.02  ampere\n",
      "VP= -4.00  volts\n",
      "VGSQ= -2.00  volts\n",
      "Vsm= 0.20  volts\n",
      "D=(((0.5)*(Vsm)**2)/(4*Vsm))*100  =2.50 % \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division  \n",
    "IDSS=16*10**(-3)\n",
    "print \"IDSS = %0.2f\"%(IDSS),\" ampere\" #  maximum drain current JFET \n",
    "VP=(-4)\n",
    "print \"VP= %0.2f\"%(VP),\" volts\" # pinch off voltage for JFET \n",
    "VGSQ=(-2)\n",
    "print \"VGSQ= %0.2f\"%(VGSQ),\" volts\" # Gate  operating point voltage \n",
    "Vsm=(0.2)\n",
    "print \"Vsm= %0.2f\"%(Vsm),\" volts\" #  sinusoidal input voltage for JFET \n",
    "D=(((0.5)*(Vsm)**2)/(4*Vsm))*100 # derived from ID=IDSS(1-VGS/VP)**2 and putting value of VGS=VGSQ+Vs, where Vs=Vsm sinwt\n",
    "print \"D=(((0.5)*(Vsm)**2)/(4*Vsm))*100  =%0.2f\"%(D),\"% \" #  Percentage second harmonic distortion calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5_7 Page No. 153"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ic = 1.00e-03  ampere\n",
      "rbe= 2000.00  ohm\n",
      "gm = 0.05  A/V\n",
      "Beta_o = 100.00  \n",
      "rc= 50000.00  ohm\n",
      "Cbe= 1.00e-11  farad\n",
      "Ctc= 1.00e-12  farad\n",
      "part(i)\n",
      "RL= 10000.00  ohm\n",
      "Rs= 500.00  ohm\n",
      "Rth=(Rs*rbe)/(Rs+rbe)=400.00  ohm\n",
      "Avm=(-gm*RL)=-500.00\n",
      "CM=Ctc*(1-Avm)= 0.00  farad\n",
      "Ci=Cbe= 0.00  farad\n",
      "fHi=1/(2*(pi)*(Rth)*(Cbe+CM))= 778644.54  Hz\n",
      "Ri=rbe =2000.00  ohm\n",
      "R0= rc=50000.00  ohm\n",
      "fB=1/(2*(pi)*(rbe)*(Cbe))= 7.96e+06  Hz\n",
      "fT=Beta_o*fB= 7.96e+08  Hz\n",
      "part(ii)\n",
      "Rs= 50000.00  ohm\n",
      "RL= 1000.00  ohm\n",
      "fhi=1/(2*(pi)*(Rs)*(Ctc))= 3.18e+06  Hz\n",
      "Avm=(gm*RL)/(1+gm*RL)=0.98\n",
      "Ro= 1/gm=20.00  ohm\n",
      "Ri=Beta_o*RL =100000.00  ohm\n",
      "part(iii)\n",
      "RL= 10000.00  ohm\n",
      "Rs= 50.00  ohm\n",
      "fHi=gm/(2*(pi)*(Cbe))= 7.96e+08  Hz\n",
      "fHo=gm/(2*(pi)*(Ctc)*(RL))= 1.59e+07  Hz\n",
      "Avs=(gm*RL)/(1+gm*Rs)=142.86\n",
      "Ri= 1/gm=20.00  ohm\n",
      "Ro=Beta_o*rc =5.00e+06  ohm\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "from __future__ import division  \n",
    "Ic=1*10**(-3)\n",
    "print \"Ic = %0.2e\"%(Ic),\" ampere\" #  collector current BJT\n",
    "rbe=2*10**(3)\n",
    "print \"rbe= %0.2f\"%(rbe),\" ohm\"  #base -emitter resistance\n",
    "gm=50*10**(-3)\n",
    "print \"gm = %0.2f\"%(gm),\" A/V\"#  transconductance for BJT\n",
    "Beta_o=100\n",
    "print \"Beta_o = %0.2f\"%(Beta_o),\" \" #BJT gain\n",
    "rc=50*10**(3)\n",
    "print \"rc= %0.2f\"%(rc),\" ohm\"  #collector resistance\n",
    "Cbe=10*10**(-12)\n",
    "print \"Cbe= %0.2e\"%(Cbe),\" farad\"  #base -emitter capacitance\n",
    "Ctc=1*10**(-12)\n",
    "print \"Ctc= %0.2e\"%(Ctc),\" farad\"  #input device capacitance\n",
    "print \"part(i)\"# part(i)of question\n",
    "RL=10*10**(3)\n",
    "print \"RL= %0.2f\"%(RL),\" ohm\"  #Load resistance\n",
    "Rs=500\n",
    "print \"Rs= %0.2f\"%(Rs),\" ohm\"  #input source resistance\n",
    "Rth=(Rs*rbe)/(Rs+rbe)\n",
    "print \"Rth=(Rs*rbe)/(Rs+rbe)=%0.2f\"%(Rth),\" ohm\"  # eqivalent resistance\n",
    "Avm=(-gm*RL)\n",
    "print \"Avm=(-gm*RL)=%0.2f\"%(Avm) # Mid-frequency gain for CE amplifier\n",
    "CM=Ctc*(1-Avm)\n",
    "print \"CM=Ctc*(1-Avm)= %0.2f\"%(CM),\" farad\"  #calculated capacitance\n",
    "Ci=Cbe\n",
    "print \"Ci=Cbe= %0.2f\"%(Ci),\" farad\"  #calculated input capacitance\n",
    "fHi=1/(2*(pi)*(Rth)*(Cbe+CM))\n",
    "print \"fHi=1/(2*(pi)*(Rth)*(Cbe+CM))= %0.2f\"%(fHi),\" Hz\" # Higher-frequency cutoff for CE amplifier\n",
    "Ri=rbe\n",
    "print \"Ri=rbe =%0.2f\"%(Ri),\" ohm\"  #input resistance CE amplifier\n",
    "Ro=rc\n",
    "print \"R0= rc=%0.2f\"%(Ro),\" ohm\"  #output  resistance for CE amplifier\n",
    "fB=1/(2*(pi)*(rbe)*(Cbe))\n",
    "print \"fB=1/(2*(pi)*(rbe)*(Cbe))= %0.2e\"%(fB),\" Hz\" # base terminal frequency cutoff\n",
    "fT=Beta_o*fB\n",
    "print \"fT=Beta_o*fB= %0.2e\"%(fT),\" Hz\" # Unity gain bandwidth for CE amplifier\n",
    "print \"part(ii)\"# part(ii)of question\n",
    "Rs=50*10**(3)\n",
    "print \"Rs= %0.2f\"%(Rs),\" ohm\"  #input source resistance for CC amplifier\n",
    "RL=1*10**(3)\n",
    "print \"RL= %0.2f\"%(RL),\" ohm\"  #Load resistance  for CC amplifier\n",
    "fhi=1/(2*(pi)*(Rs)*(Ctc))\n",
    "print \"fhi=1/(2*(pi)*(Rs)*(Ctc))= %0.2e\"%(fhi),\" Hz\" # Higher-frequency cutoff for CC amplifier\n",
    "Avm=(gm*RL)/(1+gm*RL)\n",
    "print \"Avm=(gm*RL)/(1+gm*RL)=%0.2f\"%(Avm) # Mid-frequency gain for CC amplifier\n",
    "Ro=1/gm\n",
    "print \"Ro= 1/gm=%0.2f\"%(Ro),\" ohm\"  #output  resistance for CC amplifier\n",
    "Ri=Beta_o*RL\n",
    "print \"Ri=Beta_o*RL =%0.2f\"%(Ri),\" ohm\"  #input resistance CE amplifier\n",
    "print \"part(iii)\"# part(iii)of question\n",
    "RL=10*10**(3)\n",
    "print \"RL= %0.2f\"%(RL),\" ohm\" #Load resistance  for CB amplifier\n",
    "Rs=50\n",
    "print \"Rs= %0.2f\"%(Rs),\" ohm\"  #input source resistance for CB amplifier\n",
    "fHi=gm/(2*(pi)*(Cbe))\n",
    "print \"fHi=gm/(2*(pi)*(Cbe))= %0.2e\"%(fHi),\" Hz\" # Higher-frequency cutoff for CB amplifier\n",
    "fHo=1/(2*(pi)*(Ctc)*(RL))\n",
    "print \"fHo=gm/(2*(pi)*(Ctc)*(RL))= %0.2e\"%(fHo),\" Hz\" # Higher-frequency cutoff for CB amplifier\n",
    "Avs=(gm*RL)/(1+gm*Rs)\n",
    "print \"Avs=(gm*RL)/(1+gm*Rs)=%0.2f\"%(Avs) # Mid-frequency gain for CB amplifier\n",
    "Ri=1/gm\n",
    "print \"Ri= 1/gm=%0.2f\"%(Ri),\" ohm\"  #output  resistance for CB amplifier\n",
    "Ro=Beta_o*rc\n",
    "print \"Ro=Beta_o*rc =%0.2e\"%(Ro),\" ohm\"  #input resistance CB amplifier\n",
    "#ERROR NOTE:some parameters in the book have been calculated using gm=40 mA/V while given value is gm=50 mA/V. So ,for part(ii) CC amplifier correct value of R0=20 ohm,Ri=100000 ohm,and for part(iii)CB amplifier over all voltage gain Avs=142.85714 ,Ri=20 ohm all calculated for gm=50 mA/V."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5_8 Page No. 154"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tp= 0.01  s\n",
      "tr= 5.00e-08  s\n",
      "CSH= 5.00e-11  farad\n",
      "percentage tilt= 5.00 %\n",
      "Ri= 100000.00  ohm\n",
      "RL=tr/(2.2*CSH)= 454.55  ohm\n",
      "Cc= (tp*100)/( tilt*Ri)=2.00e-06  farad\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division  \n",
    "tp=10*10**(-3)\n",
    "print \"tp= %0.2f\"%(tp),\" s\" # Time period of pulse\n",
    "tr=0.05*10**(-6)\n",
    "print \"tr= %0.2e\"%(tr),\" s\" # Rise-Time of pulse\n",
    "CSH=50*10**(-12)\n",
    "print \"CSH= %0.2e\"%(CSH),\" farad\"  #output capacitor\n",
    "tilt=5\n",
    "print \"percentage tilt= %0.2f\"%(tilt),\"%\"  #Sag or percentage tilt of output \n",
    "Ri=100*10**(3)\n",
    "print \"Ri= %0.2f\"%(Ri),\" ohm\"  # source resistance\n",
    "RL=tr/(2.2*CSH)\n",
    "print \"RL=tr/(2.2*CSH)= %0.2f\"%(RL),\" ohm\"  #Load resistance calculation\n",
    "Cc=(tp*100)/(tilt*Ri)\n",
    "print \"Cc= (tp*100)/( tilt*Ri)=%0.2e\"%(Cc),\" farad\"  #capacitance\n",
    "#ERROR NOTE: calculated value of RL=454.54545 ohm but in book given as 455 ohm  "
   ]
  }
 ],
 "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
}