summaryrefslogtreecommitdiff
path: root/Electrical_Circuit_Theory_And_Technology/chapter_28-checkpoint_1.ipynb
blob: 35880e509811ec17085228b31b6886378824c46e (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
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 28: Series resonance and Q-factor</h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1, page no. 492</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine at what frequency resonance occurs, and (b) the current flowing at resonance.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  10;#  in  ohms\n",
      "C  =  40e-6;#  IN  fARADS\n",
      "L  =  0.075;#  IN  Henry\n",
      "V  =  200;#  in  Volts\n",
      "\n",
      "#calculation:\n",
      " #Resonant  frequency,\n",
      "fr  =  1/(2*math.pi*((L*C)**0.5))\n",
      " #Current  at  resonance,  I\n",
      "I  =  V/R\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Resonant  frequency  =  \",round(fr,2),\"  Hz\\n\"\n",
      "print  \"\\n  (b)Current  at  resonance,  I  is  \",I,\"  A\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Resonant  frequency  =   91.89   Hz\n",
        "\n",
        "\n",
        "  (b)Current  at  resonance,  I  is   20.0   A\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 2, page no. 493</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the value of capacitor C for series resonance.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  8;#  in  ohms\n",
      "L  =  0.010;#  IN  Henry\n",
      "f  =  1000;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      " #At  resonance\n",
      " #capacitance  C\n",
      "C  =  1/(L*(2*math.pi*f)**2)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  capacitance,  C  is  \",round(C*1E6,2),\"uF\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  capacitance,  C  is   2.53 uF\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 3, page no. 493</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the values of (a) the stray capacitance CS, and (b) the coil inductance L.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "C1  =  1000e-12;#  IN  fARADS\n",
      "C2  =  500e-12;#  IN  fARADS\n",
      "fr1  =  92500;#  in  Hz\n",
      "fr2  =  127800;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      " #For  a  series  R\u2013L\u2013C  circuit  the  resonant  frequency  fr  is  given  by:\n",
      " #fr  =  1/(2pi*(L*C)**2)\n",
      "Cs  =  ((C1  -  C2)/((fr2/fr1)**2  -  1))  -  C2\n",
      "L  =  1/((C1  +  Cs)*(2*math.pi*fr1)**2)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)stray  capacitance,  Cs  is  \",round(Cs*1E12,2),\"pF\\n\"\n",
      "print  \"\\n  (b)inductance,  L  is  \",round(L*1000,2),\"mH\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)stray  capacitance,  Cs  is   50.13 pF\n",
        "\n",
        "\n",
        "  (b)inductance,  L  is   2.82 mH\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4, page no. 497</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine for this condition (a) the value of inductance L, (b) the p.d. across each component and (c) the Q-factor.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  10;#  in  ohms\n",
      "C  =  5e-6;#  IN  fARADS\n",
      "rv  =  20;#in  volts\n",
      "thetav  =  0;#  in  degrees\n",
      "f  =  318.3;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "wr  =  2*math.pi*f\n",
      " #The  maximum  voltage  across  the  resistance  occurs  at  resonance  when  the  current  is  a  maximum.  \n",
      "    #At  resonance,L  =  1/c*wr**2\n",
      "L  =  1/(C*wr**2)\n",
      " #voltage\n",
      "V  =  rv*math.cos(thetav*math.pi/180)  +  1j*rv*math.sin(thetav*math.pi/180)\n",
      " #Current  at  resonance  Ir\n",
      "Ir  =  V/R\n",
      " #p.d.  across  resistance,  VR\n",
      "VR  =  Ir*R\n",
      " #inductive  reactance,  XL\n",
      "XL  =  wr*L\n",
      " #p.d.  across  inductance,  VL\n",
      "VL  =  Ir*(1j*XL)\n",
      " #capacitive  reactance,  Xc\n",
      "Xc  =  1/(wr*C)\n",
      " #p.d.  across  capacitor,  Vc\n",
      "Vc  =  Ir*(-1j*Xc)\n",
      " #Q-factor  at  resonance,  Qr\n",
      "Qr  =  VL.imag/V\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)inductance,  L  is  \",round(L*1000,2),\"mH\\n\"\n",
      "print  \"\\n  (b)p.d.  across  resistance,  VR  is  \",VR,\"  V,  p.d.  across  inductance,  VL  \",round( VL.imag,2),\"j V  \"\n",
      "print   \"and  p.d.  across  capacitor,  VC  \",round(Vc.imag,2),\" V\\n\"\n",
      "print  \"\\n  (c)Q-factor  at  resonance,  Qr  is  \",round(abs(Qr),2),\"  \\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)inductance,  L  is   50.0 mH\n",
        "\n",
        "\n",
        "  (b)p.d.  across  resistance,  VR  is   (20+0j)   V,  p.d.  across  inductance,  VL   200.01 j V  \n",
        "and  p.d.  across  capacitor,  VC   -200.01  V\n",
        "\n",
        "\n",
        "  (c)Q-factor  at  resonance,  Qr  is   10.0   \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 5, page no. 502</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine (a) the resonant frequency, (b) the value of the p.d. across the capacitor at the resonant frequency, \n",
      "#(c) the frequency at which the p.d. across the capacitor is a maximum, and \n",
      "#(d) the value of the maximum voltage across the capacitor.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  80;#  in  ohms\n",
      "C  =  0.4e-6;#  IN  fARADS\n",
      "L  =  0.020;#  IN  Henry\n",
      "Vm  =  12;#in  volts\n",
      "\n",
      "#calculation:\n",
      " #Resonant  frequency,\n",
      "fr  =  1/(2*math.pi*((L*C)**0.5))\n",
      "wr  =  2*math.pi*fr\n",
      " #Q  =  wr*L/R\n",
      "Q  =  wr*L/R\n",
      "Vc  =  Q*Vm\n",
      " #the  frequency  f  at  which  VC  is  a  maximum  value,\n",
      "f  =  fr*(1  -  (1/(2*Q*Q)))**0.5\n",
      " #the  maximum  value  of  the  p.d.  across  the  capacitor  is  given  by:\n",
      "Vcm  =  Vc/((1  -  (1/(2*Q*Q)))**0.5)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)The  resonant  frequency  is  \",round(fr,2),\"  Hz\\n\"\n",
      "print  \"\\n  (b)the  value  of  the  p.d.  across  the  capacitor  at  the  resonant  frequency  \",round(Vc,2),\"  V\\n\"\n",
      "print  \"\\n  (c)the  frequency  f  at  which  Vc  is  a  maximum  value,  is  \",round(f,2),\"  Hz\\n\"\n",
      "print  \"\\n  (d)the  maximum  value  of  the  p.d.  across  the  capacitor  is  \",round(Vcm,2),\"  V\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)The  resonant  frequency  is   1779.41   Hz\n",
        "\n",
        "\n",
        "  (b)the  value  of  the  p.d.  across  the  capacitor  at  the  resonant  frequency   33.54   V\n",
        "\n",
        "\n",
        "  (c)the  frequency  f  at  which  Vc  is  a  maximum  value,  is   1721.52   Hz\n",
        "\n",
        "\n",
        "  (d)the  maximum  value  of  the  p.d.  across  the  capacitor  is   34.67   V\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6, page no. 503</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the overall Q-factor of the circuit.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "QL  =  60;#  Q-factor\n",
      "Qc  =  390;#  Q-factor\n",
      "\n",
      "#calculation:\n",
      "QT  =  QL*Qc/(QL  +  Qc)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  the  overall  Q-factor  is  \",QT"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  the  overall  Q-factor  is   52.0"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7, page no. 505</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the bandwidth of the filter.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  5;#  in  ohms\n",
      "L  =  0.010;#  IN  Henry\n",
      "fr  =  10000;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "wr  =  2*math.pi*fr\n",
      " #Q-factor  at  resonance  is  given  by\n",
      "Qr  =  wr*L/R\n",
      " #Since  Qr  =  fr/(f2  -  f1),\n",
      "bw  =  fr/Qr\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  bandwidth  of  the  filter  is  \",round(bw,2),\"  Hz\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  bandwidth  of  the  filter  is   79.58   Hz\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 8, page no. 507</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine the values of (a) the inductance, and (b) the capacitance. Find also (c) the bandwidth,\n",
      "#(d) the lower and upper half-power frequencies and (e) the value of the circuit impedance at the half-power frequencies\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Zr  =  50;#  in  ohms\n",
      "fr  =  1200;#  in  Hz\n",
      "Qr  =  30;#  Q-factor\n",
      "\n",
      "#calculation:\n",
      " #At  resonance  the  circuit  impedance,  Z\n",
      "R  =  Zr\n",
      "wr  =  2*math.pi*fr\n",
      " #Q-factor  at  resonance  is  given  by  Qr  =  wr*L/R,  then  L  is\n",
      "L  =  Qr*R/wr\n",
      " #At  resonance  r*L  =  1/(wr*C)\n",
      " #capacitance,  C\n",
      "C  =  1/(L*wr*wr)\n",
      " #bandwidth,.(f2  \u2212  f1)\n",
      "bw  =  fr/Qr\n",
      " #upper  half-power  frequency,  f2\n",
      "f2  =  (bw  +  ((bw**2)  +  4*(fr**2))**0.5)/2\n",
      " #lower  half-power  frequency,  f1\n",
      "f1  =  f2  -  bw\n",
      " #At  the  half-power  frequencies,  current  I\n",
      " #I  =  0.707*Ir\n",
      " #Hence  impedance\n",
      "Z  =  (2**0.5)*R\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)inductance,  L  is  \",round(L*1000,2),\"mH\\n\"\n",
      "print  \"\\n  (b)capacitance,  C  is  \",round(C*1E9,2),\"nF\\n\"\n",
      "print  \"\\n  (c)bandwidth  is  \",round(bw,2),\"  Hz\\n\"\n",
      "print  \"\\n  (d)the  upper  half-power  frequency,  f2  is  \",round(f2,2),\"  Hz \"\n",
      "print   \" and  the  lower  half-power  frequency,  f1  is  \",round(f1,2),\"  Hz\\n\"\n",
      "print  \"\\n  (e)impedance  at  the  half-power  frequencies  is  \",round(Z,2),\"  ohm\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)inductance,  L  is   198.94 mH\n",
        "\n",
        "\n",
        "  (b)capacitance,  C  is   88.42 nF\n",
        "\n",
        "\n",
        "  (c)bandwidth  is   40.0   Hz\n",
        "\n",
        "\n",
        "  (d)the  upper  half-power  frequency,  f2  is   1220.17   Hz \n",
        " and  the  lower  half-power  frequency,  f1  is   1180.17   Hz\n",
        "\n",
        "\n",
        "  (e)impedance  at  the  half-power  frequencies  is   70.71   ohm\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 9, page no. 508</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the value of (a) the circuit resistance,\n",
      "#(b) the circuit inductance, (c) the circuit capacitance, and\n",
      "#(d) the voltage across the capacitor\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "V  =  0.2;#  in  Volts\n",
      "I  =  0.004;#  in  Amperes\n",
      "fr  =  3000;#  in  Hz\n",
      "Qr  =  100;#  Q-factor\n",
      "\n",
      "#calculation:\n",
      "wr  =  2*math.pi*fr\n",
      " #At  resonance,  impedance\n",
      "Z  =  V/I\n",
      " #At  resonance  the  circuit  impedance,  Z\n",
      "R  =  Z\n",
      " #Q-factor  at  resonance  is  given  by  Qr  =  wr*L/R,  then  L  is\n",
      "L  =  Qr*R/wr\n",
      " #At  resonance  r*L  =  1/(wr*C)\n",
      " #capacitance,  C\n",
      "C  =  1/(L*wr*wr)\n",
      " #Q-factor  at  resonance  in  a  series  circuit  represents  the  voltage  magnification  Qr  =  Vc/V,  then  Vc  is\n",
      "Vc  =  Qr*V\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)the  circuit  resistance  is  \",round(R,2),\"  ohm\\n\"\n",
      "print  \"\\n  (b)inductance,  L  is  \",round(L*1000,2),\"mH\\n\"\n",
      "print  \"\\n  (c)capacitance,  C  is  \",round(C*1E9,2),\"nF\\n\"\n",
      "print  \"\\n  (d)the  voltage  across  the  capacitor  is  \",round(Vc,2),\"  V\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)the  circuit  resistance  is   50.0   ohm\n",
        "\n",
        "\n",
        "  (b)inductance,  L  is   265.26 mH\n",
        "\n",
        "\n",
        "  (c)capacitance,  C  is   10.61 nF\n",
        "\n",
        "\n",
        "  (d)the  voltage  across  the  capacitor  is   20.0   V\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 10, page no. 509</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine (a) the resonant frequency, (b) the Q-factor at resonance, (c) the bandwidth,\n",
      "#and (d) the lower and upper -3dB frequencies.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  8.84;#  in  ohms\n",
      "L  =  0.3518;#  IN  Henry\n",
      "C  =  20e-6;#  IN  fARADS\n",
      "\n",
      "#calculation:\n",
      " #Resonant  frequency,\n",
      "fr  =  1/(2*math.pi*((L*C)**0.5))\n",
      "wr  =  2*math.pi*fr\n",
      " #Q-factor  at  resonance,  Q  =  wr*L/R\n",
      "Qr  =  wr*L/R\n",
      " #bandwidth,.(f2  \u2212  f1)\n",
      "bw  =  fr/Qr\n",
      " #the  lower  \u22123  dB  frequency\n",
      "f1  =  fr  -  bw/2\n",
      " #the  upper  \u22123  dB  frequency\n",
      "f2  =  fr  +  bw/2\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Resonant  frequency,  fr  is  \",round(fr,2),\"  Hz\\n\"\n",
      "print  \"\\n  (b)Q-factor  at  resonance  is  \",round(Qr,2),\"\\n\"\n",
      "print  \"\\n  (c)Bandwidth  is  \",round(bw,2),\"  Hz\\n\"\n",
      "print  \"\\n  (d)the  lower  -3dB  frequency,  f1  is  \",round(f1,2),\"  Hz \"\n",
      "print   \" and  the  upper  -3dB  frequency,  f2  is  \",round(f2,2),\"  Hz\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Resonant  frequency,  fr  is   60.0   Hz\n",
        "\n",
        "\n",
        "  (b)Q-factor  at  resonance  is   15.0 \n",
        "\n",
        "\n",
        "  (c)Bandwidth  is   4.0   Hz\n",
        "\n",
        "\n",
        "  (d)the  lower  -3dB  frequency,  f1  is   58.0   Hz \n",
        " and  the  upper  -3dB  frequency,  f2  is   62.0   Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 11, page no. 511</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the current flowing in the circuit when the input voltage is 7.56/_0\u00b0 V and the frequency is \n",
      "#(a) the resonant frequency, (b) a frequency 3% above the resonant frequency\n",
      "#(c) the impedance of the circuit when the frequency is 3% above the resonant frequency.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  15;#  in  ohms\n",
      "L  =  0.008;#  IN  Henry\n",
      "C  =  0.3e-6;#  IN  fARADS\n",
      "rv  =  7.56;#in  volts\n",
      "thetav  =  0;#  in  degrees\n",
      "x  =  0.03;\n",
      "\n",
      "#calculation:\n",
      " #Resonant  frequency,\n",
      "fr  =  1/(2*math.pi*((L*C)**0.5))\n",
      "wr  =  2*math.pi*fr\n",
      " #At  resonance,\n",
      "Zr  =  R\n",
      " #voltage\n",
      "V  =  rv*math.cos(thetav*math.pi/180)  +  1j*rv*math.sin(thetav*math.pi/180)\n",
      " #Current  at  resonance\n",
      "Ir  =  V/Zr\n",
      " #Q-factor  at  resonance,  Q  =  wr*L/R\n",
      "Qr  =  wr*L/R\n",
      " #If  the  frequency  is  3%  above    fr,  then\n",
      "de  =  x\n",
      "I  =  Ir/(1  +  (2*de*Qr*1j))\n",
      "Z  =  V/I\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Current  at  resonance,  Ir  is  \",round(abs(Ir),2),\"  A\\n\"\n",
      "print  \"\\n  (b)current  flowing  in  the  circuit  when  frequency  3  percent\"\n",
      "print   \"      above  the  resonant  frequency  is  \",round(I.real,2),\"  +  (\",round(  I.imag,2),\")i  A\\n\"\n",
      "print  \"\\n  (c)impedance  of  the  circuit  when  the  frequency  is  3  percent\"\n",
      "print   \"      above  the  resonant  frequency  is  \",round(Z.real,2),\"  +  (\",round(Z.imag,2),\")i  A\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Current  at  resonance,  Ir  is   0.5   A\n",
        "\n",
        "\n",
        "  (b)current  flowing  in  the  circuit  when  frequency  3  percent\n",
        "      above  the  resonant  frequency  is   0.35   +  ( -0.23 )i  A\n",
        "\n",
        "\n",
        "  (c)impedance  of  the  circuit  when  the  frequency  is  3  percent\n",
        "      above  the  resonant  frequency  is   15.0   +  ( 9.8 )i  A\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}