summaryrefslogtreecommitdiff
path: root/Electronic_Communication_Systems_by_Roy_Blake/Chapter14.ipynb
blob: 421e7ca80a35fa1ea9d2e807732e7ed4fe8e8198 (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
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 14 : Transmission lines"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 : pg 461"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The inductance of 1m length is 225.0 nH/m\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 461\n",
    "#prob no. 14.1\n",
    "#calculate the inductance\n",
    "#A coaxial cable with capacitance=90pF/m & characteristic impedance=50 ohm\n",
    "#given\n",
    "C=90.*10**-12;Zo=50.;\n",
    "#Determination of inductance of 1m length\n",
    "#calculations\n",
    "L=(Zo**2)*C;\n",
    "#results\n",
    "print 'The inductance of 1m length is',L*10**9,'nH/m'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 : pg 462"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a)The characteristic impedance of conductor is 227.399 ohm\n",
      "b)The characteristic impedance of coaxial cable is 54.784 ohm\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 462\n",
    "#prob no. 14.2\n",
    "#calculate the imepdance \n",
    "from math import log10,sqrt\n",
    "#a)Determination of impedance of open wire with diameter 3mm & r=10mm\n",
    "#given\n",
    "D=3./2.;r=10.;#All values are in mm\n",
    "#calculations and results\n",
    "Zo1=276*log10(r/D); \n",
    "print 'a)The characteristic impedance of conductor is',round(Zo1,3),'ohm'\n",
    "#b)Determination of impedance of coaxial with er=2.3,inner diameter=2mm & outer diameter=8mm\n",
    "er=2.3;D=8.;d=2;#All diameter values in mm\n",
    "Zo2=(138/sqrt(er))*log10(D/d);\n",
    "print 'b)The characteristic impedance of coaxial cable is',round(Zo2,3),'ohm'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 : pg 463"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of velocity factor is 0.69\n",
      "The value of propagation velo. is 207019667.803 m/s\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 463\n",
    "#prob no. 14.3\n",
    "#calculate the velocity factor and propagation velocity\n",
    "#Cable with teflon dielectric er=2.1\n",
    "from math import sqrt\n",
    "#given\n",
    "er=2.1;c=3.*10**8;#Velocity of light\n",
    "#calculations and results\n",
    "#Determination of velocity factor\n",
    "Vf=1/sqrt(er);\n",
    "print 'The value of velocity factor is',round(Vf,3)\n",
    "#Determination of propagation velocity\n",
    "Vp=Vf*c;\n",
    "print 'The value of propagation velo. is',Vp,'m/s'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4 : pg 468"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The total voltage at the load is 0.333 V\n",
      "The voltage across the line 0.333 V\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 468\n",
    "#prob no. 14.4\n",
    "#calculate the voltage\n",
    "#Refer fig. 14.13(a)\n",
    "vs=1;#source voltage\n",
    "Rs=50.;#source resistance\n",
    "Zo=50.;#line impedance\n",
    "RL=25.;#load resistance\n",
    "l=10.;#length of line\n",
    "vf=0.7;#velocity factor\n",
    "Vi=0.5;\n",
    "c=3.*10**8;#velo of light\n",
    "#calculations\n",
    "#Vs will divide between Rs and Zo of the line.Since two resistors are equal,the voltage will divide equally.\n",
    "#Therefore at t=0,the voltage at the source end of the line will rise from zero to 0.5V. \n",
    "#The voltage at the load will remain zero untill the surge reaches it.The time for this is\n",
    "T=l/(vf*c);\n",
    "# After T sec, the voltage at the load will rise.The reflection coefficient is given as\n",
    "refl_coeff=(RL-Zo)/(RL+Zo)\n",
    "#Now reflection voltage is \n",
    "Vr=refl_coeff * Vi;\n",
    "#The total voltage at the load is\n",
    "Vt=Vr+Vi;\n",
    "# The reflected voltage will propogate back along the line,reaching \n",
    "#the source at time 2T.After this the voltage will be 0.3335V all along the line\n",
    "#The voltage across the line, and the load will be\n",
    "VL=vs*(RL/(RL+Zo));\n",
    "#results\n",
    "print 'The total voltage at the load is',round(Vt,3),'V'\n",
    "print 'The voltage across the line',round(VL,3),'V'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5 : pg 472"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The length reqd for phase shift is 0.12375 m\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 472\n",
    "#prob no. 14.5\n",
    "#calculate the length reqd\n",
    "#Standard coaxial cable RG-8/U with 45 degree phase shift at 200MHz\n",
    "#given\n",
    "p=45.;f=200.*10**6;c=3.*10**8;#Speed of light in m/s\n",
    "vf=0.66;#velo. factor for this line\n",
    "#calculations\n",
    "vp=vf*c;#Determination of propagation velo.\n",
    "wav=vp/f;#Determination of wavelength of signal\n",
    "#Determination of reqd length for 45 degree phase shift\n",
    "L=wav*(p/360.);\n",
    "#results\n",
    "print 'The length reqd for phase shift is',L,'m'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6 : pg 476"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of SWR is 2.0\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 476\n",
    "#prob no. 14.6\n",
    "#calculate the value of SWR\n",
    "#A 50ohm line terminated in 25ohm resistance\n",
    "Zo=50.;Zl=25.;\n",
    "#calculations\n",
    "#Determination of SWR\n",
    "SWR=Zo/Zl;#In this case Zo>Zl\n",
    "#results\n",
    "print 'The value of SWR is',SWR"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7 : pg 477"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The amount of power reflected is 12.5 mW\n",
      "The power dissipated in load is 37.5 mW\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 477\n",
    "#prob no. 14.7\n",
    "#calculate the power\n",
    "#A generator sends 50mW at 50ohm line & reflection coeff I=0.5\n",
    "#given\n",
    "Pi=50.;I=0.5;\n",
    "#calculations\n",
    "#Determination of amount of power reflected\n",
    "Pr=(I**2)*Pi;\n",
    "#Determination of remainder power that reaches load\n",
    "Pl=Pi-Pr;\n",
    "#results\n",
    "print 'The amount of power reflected is',Pr,'mW'\n",
    "print 'The power dissipated in load is',Pl,'mW'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8 : pg 478"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The power absorbed by load is 44.444 W\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 478\n",
    "#prob no. 14.8\n",
    "#A transmitter supplies 50W with SWR 2:1\n",
    "#calculate the power\n",
    "#given \n",
    "Pi=50.;SWR=2.;\n",
    "#calculations\n",
    "#Determination of power absorbed by load\n",
    "Pl=(4*SWR*Pi)/(1+SWR)**2;\n",
    "#results\n",
    "print 'The power absorbed by load is',round(Pl,3),'W'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9 : pg 480"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The impedance looking toward the load (40-30j) ohm\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 545\n",
    "# prob no 14.9\n",
    "#calculate the impedance\n",
    "from math  import pi,tan\n",
    "#given\n",
    "Zo=50.;# line impedence in ohm\n",
    "ZL=100.;# load impedance in ohm\n",
    "vf=0.8;#velocity factor\n",
    "l=1.;#length of line\n",
    "f=30.*10**6;# freq of operation\n",
    "c=3.*10**8;#velo of light\n",
    "#calculations\n",
    "# we have to find the length of line in degree\n",
    "wl=vf*c/f#wavelength\n",
    "# Then the length of line in degree is\n",
    "ang=l/wl*360\n",
    "# calculation of impedance\n",
    "Z=Zo*(ZL+(1j*Zo*tan(ang*pi/180)))/(Zo+(1j*ZL*tan(ang*pi/180.)));\n",
    "print 'The impedance looking toward the load',Z,'ohm'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10 : pg 481"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The length should be 0.1425 m\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 481\n",
    "#prob no. 14.10\n",
    "#calculate the length required\n",
    "#A series tuned ckt tuned at 1GHz\n",
    "#given\n",
    "vf=0.95;c=3.*10**8;f=10**9;\n",
    "#calculations\n",
    "vp=vf*c;#determination of propagation velo.\n",
    "wav=vp/f;#Determination of wavelength \n",
    "#Determination of length\n",
    "L=wav/2;#Since half wavelength section wiil be series resonant\n",
    "#results\n",
    "print 'The length should be',L,'m'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11 : pg 481"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The transmitter power must be 151.356 W\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 481\n",
    "#prob no. 14.10\n",
    "#calculate the transmitter power\n",
    "#A Tx deliver 100W to antenna through 45m coaxial cable  with loss=4dB/100m\n",
    "#given\n",
    "loss=4./100;L=45.;Pout=100.;\n",
    "#calculations\n",
    "loss_dB=L*loss;#Determination of loss in dB\n",
    "Pin_Pout=10**(loss_dB/10);\n",
    "#Determination of Tx power\n",
    "Pin=Pout*Pin_Pout;\n",
    "#results\n",
    "print 'The transmitter power must be',round(Pin,3),'W'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 13 : pg 490"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Input impedance is (19.36+5.44j) ohm\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 490\n",
    "#prob no. 14.13\n",
    "#calculate the input impedance\n",
    "Zo=50.;#line impedance in ohm\n",
    "f=100.*10**6;#operating freq\n",
    "vf=0.7;#velocity factor\n",
    "L=6.;#length in m\n",
    "c=3.*10**8;#velo of light\n",
    "ZL=50+1j*50;#load impedance in ohm\n",
    "#calculations\n",
    "# we have to calculate length in degree,so for this first find wl\n",
    "wl=vf*c/f;#wavength in m\n",
    "ang=360*L/wl;\n",
    "# now from the graph input impedance is 19.36+%i5.44;\n",
    "Zi=19.36+1j*5.44;\n",
    "#results\n",
    "print 'Input impedance is',Zi,'ohm'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 14 : pg 492"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The required turn ratio is (0.752156137344+0j)\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 492\n",
    "#prob no. 14.14\n",
    "from cmath import  sqrt\n",
    "#given\n",
    "Zo=50.;#line impedance in ohm\n",
    "ZL=75.+1j*25;\n",
    "# the requirment of this is simply to match the 50ohm line to the impedsnce at this point on the line,which is 88.38 ohm,resistive.\n",
    "Z2=88.38;#in ohm\n",
    "#calculations\n",
    "#The required turn ratio is\n",
    "N1_N2=sqrt(Zo/Z2);\n",
    "#results\n",
    "print 'The required turn ratio is',N1_N2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 15 : pg 494"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Zo =  66.476\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 494\n",
    "#prob no. 14.15\n",
    "#calculate the impedance\n",
    "# refer prob no 14.14\n",
    "from math import sqrt\n",
    "#given\n",
    "Zo=50.;#line impedance in ohm\n",
    "Z2=88.38;#in ohm\n",
    "#calculations\n",
    "Zo_=sqrt(Zo*Z2);\n",
    "#results\n",
    "print 'Zo = ',round(Zo_,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 16 : pg 494"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Capacitance is 2.12206590789e-11 F\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 494\n",
    "#prob no. 14.16\n",
    "#calculate the capacitance\n",
    "from math import pi\n",
    "#given\n",
    "Zo=50.;#line impedance in ohm\n",
    "f=100.*10**6;#operating freq in Hz\n",
    "ZL1=50+1j*75;# load impedance with Xc=75\n",
    "Xc=75;\n",
    "#calculations\n",
    "# Capacitance in farads is given as\n",
    "C=1/(2*pi*f*Xc);\n",
    "#results\n",
    "print 'Capacitance is',C,'F'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 17 : pg 497"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of stude is 0.014 S\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 497\n",
    "#prob no. 14.17\n",
    "#calculate the value of stude\n",
    "#given\n",
    "Zo=72.;#line impedance in ohm\n",
    "ZL=120.-1j*100;#load impedance\n",
    "#calculations\n",
    "#The stub must be inserted at a point on the line where the real part of the load admittance is correct. This value is\n",
    "s=1/Zo;\n",
    "#results\n",
    "print 'The value of stude is',round(s,3),'S'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 18 : pg 501"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The distance is 168.0 m\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 501\n",
    "#prob no. 14.18\n",
    "#calculate the distance\n",
    "#given\n",
    "#A TDR display shows dscontinuity  at 1.4us & vf=0.8\n",
    "t=1.4*10**-6;vf=0.8;c=3.*10**8;#Speed of light\n",
    "#Determination of distance of fault\n",
    "#calculations\n",
    "d=(vf*c*t)/2;#One-half time is used to calculate\n",
    "#results\n",
    "print 'The distance is',d,'m'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 19 : pg 503"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The wavelength is 46.0 cm\n",
      "The freq is 619.565 MHz\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 503\n",
    "#prob no. 14.19\n",
    "#calculate the wavelength and freq\n",
    "#given\n",
    "#2 adjacent minima on slotted are 23cm apart with velo factor=95%\n",
    "L=23*10**-2;vf=0.95;c=3*10**8;#Velo. of light in m/s\n",
    "#calculations and results\n",
    "#Determination of wavelength\n",
    "wav=2*L;#Minima are seperated by one-half wavelength\n",
    "print 'The wavelength is',wav*100,'cm'\n",
    "#Determination of freq.\n",
    "f=(vf*c)/wav;#vp=vf*c\n",
    "print 'The freq is' ,round(f/10**6,3),'MHz'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 20 : pg 504"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of SWR is 2.15\n"
     ]
    }
   ],
   "source": [
    " \n",
    "#page no 504\n",
    "#prob no. 14.20\n",
    "#calculate the value of SWR\n",
    "from math import sqrt\n",
    "#given\n",
    "#Frwd power in Tx line is 150W,Reverse power=20W\n",
    "Pi=150.;Pr=20.;#All power in watt\n",
    "#calculations\n",
    "#Determination of SWR\n",
    "SWR=(1+sqrt(Pr/Pi))/(1-sqrt(Pr/Pi));\n",
    "#results\n",
    "print 'The value of SWR is',round(SWR,3)"
   ]
  }
 ],
 "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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}