{
 "metadata": {
  "name": "",
  "signature": "sha256:09f43d439565c21fbc9d48d0b329d310879f650b07dbafd58f9c9e880189ce2d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 44: Transmission lines</h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1, page no. 873</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "f  =  1910;#  in  Hz\n",
      "b  =  0.05;#  in  rad/km\n",
      "\n",
      "#calculation:\n",
      "w  =  2*math.pi*f\n",
      " #wavelength  \n",
      "Y  =  2*math.pi/b\n",
      " #speed  of  transmission\n",
      "u  =  f*Y\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  wavelength  Y  is  \",round(Y,1),\"  km\"\n",
      "print  \"\\n  speed  of  transmission  \",round(u,1),\"km/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  wavelength  Y  is   125.7   km\n",
        "\n",
        "  speed  of  transmission   240017.7 km/sec"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 2, page no. 873</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "L  =  0.004;#  in  Henry/loop\n",
      "C  =  0.004E-6;#  in  F/loop\n",
      "f  =  1000;#  in  Hz\n",
      "\n",
      " #calculation:\n",
      "w  =  2*math.pi*f\n",
      " #phase  delay\n",
      "b  =  w*(L*C)**0.5\n",
      " #wavelength  \n",
      "Y  =  2*math.pi/b\n",
      " #speed  of  transmission\n",
      "u  =  f*Y\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  phase  delay  is  \",round(b,3),\"  rad/km\"\n",
      "print  \"\\n  wavelength  Y  is  \",Y,\"  km\"\n",
      "print  \"\\n  speed  of  transmission  \",u,\"km/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  phase  delay  is   0.025   rad/km\n",
        "\n",
        "  wavelength  Y  is   250.0   km\n",
        "\n",
        "  speed  of  transmission   250000.0 km/sec"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 3, page no. 874</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "a  =  0.25;#  in  Np/km\n",
      "b  =  0.20;#  in  rad/km\n",
      "Vs  =  5;#  in  Volts\n",
      "n  =  10;#  in  km\n",
      "f  =  2000;#  in  Hz\n",
      "\n",
      " #calculation:\n",
      "w  =  2*math.pi*f\n",
      " #the  voltage  10  km  down  the  line\n",
      "r  =  a  +  1j*b\n",
      "VR  =  Vs*cmath.e**(-1*n*r)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n Result  \\n\\n\"\n",
      "print  \"voltage  10  km  down  the  line is \",round(abs(VR),2),\"/_\",round(cmath.phase(complex(VR.real,VR.imag))*180/math.pi,2),\"deg  V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " Result  \n",
        "\n",
        "\n",
        "voltage  10  km  down  the  line is  0.41 /_ -114.59 deg  V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4, page no. 875</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "a  =  0.5;#  in  Np/km\n",
      "b  =  0.25;#  in  rad/km\n",
      "rvs  =  2;#  in  Volts\n",
      "thetavs  =  0;#  in  degrees\n",
      "rzo  =  800;#  in  ohm\n",
      "thetazo  =  -25;#  in  degrees\n",
      "n  =  5;#  in  km\n",
      "\n",
      "#calculation:\n",
      " #voltage\n",
      "Vs  =  rvs*math.cos(thetavs*math.pi/180)  +  1j*rvs*math.sin(thetavs*math.pi/180)\n",
      " #characteristic  impedance\n",
      "Zo  =  rzo*math.cos(thetazo*math.pi/180)  +  1j*rzo*math.sin(thetazo*math.pi/180)\n",
      " #  receiving  end  voltage\n",
      "r  =  a  +  1j*b\n",
      "VR  =  Vs*cmath.e**(-1*n*r)\n",
      " #Receiving  end  current,\n",
      "IR  =  VR/Zo\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"Receiving end current, IR is  \",round(abs(IR)*1E3,3),\"/_\",round(cmath.phase(complex(IR.real,IR.imag))*180/math.pi,2),\"deg  mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "Receiving end current, IR is   0.205 /_ -46.62 deg  mA\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 5, page no. 875</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Vs  =  8;#  in  Volts\n",
      "VR  =  2;#  in  Volts\n",
      "x  =  2;  \n",
      "\n",
      "#calculation:\n",
      " #  receiving  end  voltage  VR  =  Vs*e**(-nr)\n",
      " #e**-nr  =  p\n",
      "p  =  VR/Vs\n",
      " #If  the  line  is  doubled  in  length,  then\n",
      "VR  =  Vs*(p)**2\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  Receiving  end  voltage  If  the  line  is  doubled  in  length,  VR  is  \",abs(VR),\" V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  Receiving  end  voltage  If  the  line  is  doubled  in  length,  VR  is   0.5  V"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6, page no. 876</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "rzoc  =  800;#  in  ohm\n",
      "thetazoc  =  -50;#  in  degrees\n",
      "rzsc  =  413;#  in  ohm\n",
      "thetazsc  =  -20;#  in  degrees\n",
      "f  =  1500;#  in  Hz\n",
      "\n",
      " #calculation:\n",
      " #open  circuit  impedance\n",
      "Zoc  =  rzoc*math.cos(thetazoc*math.pi/180)  +  1j*rzoc*math.sin(thetazoc*math.pi/180)\n",
      " #short  circuit  impedance\n",
      "Zsc  =  rzsc*math.cos(thetazsc*math.pi/180)  +  1j*rzsc*math.sin(thetazsc*math.pi/180)\n",
      " #characteristic  impedance  Zo\n",
      "Zo  =  (Zoc*Zsc)**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"characteristic impedance Zo is\",round(abs(Zo)),\"/_\",round(cmath.phase(complex(Zo.real,Zo.imag))*180/math.pi,2),\"deg  ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "characteristic impedance Zo is 575.0 /_ -35.0 deg  ohm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7, page no. 877</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  15;#  in  ohm/loop  km\n",
      "L  =  0.0034;#  in  H/loop  km\n",
      "C  =  10E-9;#  in  F/km\n",
      "G  =  3E-6;#  in  S/km\n",
      "f  =  2000;#  in  Hz\n",
      "\n",
      " #calculation:\n",
      "w  =  2*math.pi*f\n",
      " #characteristic  impedance  Zo\n",
      "Zo  =  ((R  +  1j*w*L)/(G  +  1j*w*C))**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"characteristic impedance Zo  is  \",round(abs(Zo),0),\"/_\",round(cmath.phase(complex(Zo.real,Zo.imag))*180/math.pi,2),\"deg  ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "characteristic impedance Zo  is   600.0 /_ -8.99 deg  ohm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 8, page no. 879</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "L  =  0.0005;#  in  H/loop  km\n",
      "C  =  0.12E-6;#  in  F/km\n",
      "f  =  400000;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "w  =  2*math.pi*f\n",
      " #characteristic  impedance  Zo\n",
      "Zo  =  (L/C)**0.5\n",
      " #the  propagation  coefficient\n",
      "r  =  1j*w*(L*C)**0.5\n",
      " #the  attenuation  coefficient  \n",
      "a  =  r.real\n",
      " #the  phaseshift  coefficient\n",
      "b  =  r.imag\n",
      " #wavelength\n",
      "Y  =  2*math.pi/b\n",
      " #velocity  of  propagation  \n",
      "u  =  f*Y\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  characteristic  impedance  Zo  is  \",abs(Zo),\"ohm\"\n",
      "print  \"\\n  propagation  coefficient  is  \",a,\"  +(\",round(b,2),\")i\"\n",
      "print  \"\\n  wavelength  Y  is  \",round(Y*1E3,0),\"m\"\n",
      "print  \"\\n  speed  of  transmission  \",round(u,2),\"km/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  characteristic  impedance  Zo  is   64.5497224368 ohm\n",
        "\n",
        "  propagation  coefficient  is   0.0   +( 19.47 )i\n",
        "\n",
        "  wavelength  Y  is   323.0 m\n",
        "\n",
        "  speed  of  transmission   129099.44 km/sec"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 9, page no. 880</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  25;#  in  ohm/loop  km\n",
      "L  =  0.005;#  in  H/loop  km\n",
      "C  =  0.04E-6;#  in  F/km\n",
      "G  =  80E-6;#  in  S/km\n",
      "f  =  1000;#  in  Hz\n",
      "\n",
      " #calculation:\n",
      "w  =  2*math.pi*f\n",
      " #characteristic  impedance  Zo\n",
      "Zo  =  ((R  +  1j*w*L)/(G  +  1j*w*C))**0.5\n",
      " #the  propagation  coefficient\n",
      "r  =  ((R  +  1j*w*L)*(G  +  1j*w*C))**0.5\n",
      " #the  attenuation  coefficient  \n",
      "a  =  r.real\n",
      " #the  phaseshift  coefficient\n",
      "b  =  r.imag\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"characteristic impedance Zo  is\",round(abs(Zo),2),\"/_\",round(cmath.phase(complex(Zo.real,Zo.imag))*180/math.pi,2),\"deg  ohm\"\n",
      "print  \"\\n  propagation  coefficient  is  \",round(abs(r),4),\"/_\",round(cmath.phase(complex(a,b))*180/math.pi,2),\"deg\"\n",
      "print  \"\\n  attenuation  coefficient  is  \",round(a,4),\"  Np/km\"\n",
      "print  \"\\n  the  phase-shift  coefficient  \",round(b,4),\"  rad/km\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "characteristic impedance Zo  is 390.16 /_ -10.43 deg  ohm\n",
        "\n",
        "  propagation  coefficient  is   0.1029 /_ 61.92 deg\n",
        "\n",
        "  attenuation  coefficient  is   0.0484   Np/km\n",
        "\n",
        "  the  phase-shift  coefficient   0.0908   rad/km\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 10, page no. 881</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  8;#  in  ohm/loop  km\n",
      "L  =  0.003;#  in  H/loop  km\n",
      "C  =  7500E-12;#  in  F/km\n",
      "G  =  0.25E-6;#  in  S/km\n",
      "f  =  1000;#  in  Hz\n",
      "n  =  300;#  in  km\n",
      "Zg  =  400  +  1j*0;#  in  ohm\n",
      "Vg  =  10;#  in  Volts\n",
      "\n",
      " #calculation:\n",
      "w  =  2*math.pi*f\n",
      " #characteristic  impedance  Zo\n",
      "Zo  =  ((R  +  1j*w*L)/(G  +  1j*w*C))**0.5\n",
      " #the  propagation  coefficient\n",
      "r  =  ((R  +  1j*w*L)*(G  +  1j*w*C))**0.5\n",
      " #the  attenuation  coefficient  \n",
      "a  =  r.real\n",
      " #the  phaseshift  coefficient\n",
      "b  =  r.imag\n",
      " #the  sending-end  current,\n",
      "Is  =  Vg/(Zg  +  Zo)\n",
      " #the  receiving-end  current,\n",
      "IR  =  Is*cmath.e**(-1*n*r)\n",
      " #wavelength\n",
      "Y  =  2*math.pi/b\n",
      " #velocity  of  propagation  \n",
      "u  =  f*Y\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"characteristic impedance Zo is\",round(abs(Zo),1),\"/_\",round(cmath.phase(complex(Zo.real,Zo.imag))*180/math.pi,2),\"deg  ohm\"\n",
      "print  \"propagation  coefficient  is  \",round(abs(r),5),\"/_\",round(cmath.phase(complex(r.real,r.imag))*180/math.pi,2),\"deg\"\n",
      "print  \"attenuation  coefficient  is  \",round(a,5),\"  Np/km  and  the  phaseshift  coefficient  \",round(b,5),\"  rad/km\"\n",
      "print  \"sending-end  current  Is  is  \",round(abs(Is)*1E3,3),\"/_\",round(cmath.phase(complex(Is.real,Is.imag))*180/math.pi,2),\"deg  mA\"\n",
      "print  \"receiving-end  current  IR is\",round(abs(IR)*1E3,3),\"/_\",round(cmath.phase(complex(IR.real,IR.imag))*180/math.pi,2),\"deg  mA\"\n",
      "print  \"wavelength  Y  is  \",round(Y,1),\"  km\"\n",
      "print  \"speed  of  transmission  \",round(u,1),\"km/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "characteristic impedance Zo is 659.2 /_ -11.35 deg  ohm\n",
        "propagation  coefficient  is   0.03106 /_ 78.35 deg\n",
        "attenuation  coefficient  is   0.00627   Np/km  and  the  phaseshift  coefficient   0.03042   rad/km\n",
        "sending-end  current  Is  is   9.485 /_ 7.07 deg  mA\n",
        "receiving-end  current  IR is 1.445 /_ -155.88 deg  mA\n",
        "wavelength  Y  is   206.5   km\n",
        "speed  of  transmission   206521.1 km/sec\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 11, page no. 884</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  10;#  in  ohm/loop  km\n",
      "L  =  0.0015;#  in  H/loop  km\n",
      "C  =  0.06E-6;#  in  F/km\n",
      "G  =  1.2E-6;#  in  S/km\n",
      "\n",
      " #calculation:\n",
      " #the  condition  for  minimum  distortion  is  given  by  LG  =  CR,  from  which,\n",
      "Lm  =  C*R/G\n",
      "dL  =  Lm  -  L\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  inductance  should  be  increased  by  \",round(dL*1E3,1),\"mH/loop  km  for  minimum  distortion\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  inductance  should  be  increased  by   498.5 mH/loop  km  for  minimum  distortion"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 12, page no. 884</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  80;#  in  ohm/loop  km\n",
      "C  =  5E-9;#  in  F/km\n",
      "G  =  2E-6;#  in  S/km\n",
      "f  =  1500;#  in  Hz\n",
      "\n",
      " #calculation:\n",
      "w  =  2*math.pi*f\n",
      " #the  condition  for  minimum  distortion  is  given  by  LG  =  CR,  from  which,  inductance\n",
      "L  =  C*R/G\n",
      " #attenuation  coefficient,\n",
      "a  =  (R*G)**0.5\n",
      " #phase  shift  coefficient,\n",
      "b  =  w*(L*C)**0.5\n",
      " #propagation  coefficient,\n",
      "r  =  a  +  1j*b\n",
      " #velocity  of  propagation,\n",
      "u  =  1/(L*C)**0.5\n",
      " #wavelength\n",
      "Y  =  u/f\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  inductance  is  \",round(L,2),\"  H\"\n",
      "print  \"\\n  propagation  coefficient  is  \",round(a,2),\"  +(\",round(b,2),\")i\"\n",
      "print  \"\\n  speed  of  transmission  \",round(u,2),\"km/sec\"\n",
      "print  \"\\n  wavelength  Y  is  \",round(Y,2),\"  km\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  inductance  is   0.2   H\n",
        "\n",
        "  propagation  coefficient  is   0.01   +( 0.3 )i\n",
        "\n",
        "  speed  of  transmission   31622.78 km/sec\n",
        "\n",
        "  wavelength  Y  is   21.08   km\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13, page no. 888</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Zo  =  75;#  in  ohm\n",
      "ZR  =  250;#  in  ohm\n",
      "VR  =  10;#  in  Volts\n",
      "\n",
      "#calculation:\n",
      " #reflection  coefficient\n",
      "p  =  (Zo  -  ZR)/(Zo  +  ZR)\n",
      " #Current  flowing  in  the  terminating  load\n",
      "IR  =  VR/ZR\n",
      " #incident  current,  Ii\n",
      "Ii  =  IR/(1  +  p)\n",
      " #incident  voltage,  Vi    \n",
      "Vi  =  Ii*Zo\n",
      " #reflected  current,  Ir\n",
      "Ir  =  IR  -  Ii\n",
      " #reflected  voltage,  Vr\n",
      "Vr  =  -1*Ir*Zo\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  reflection  coefficient  is  \",round(p,3),\"\"\n",
      "print  \"\\n  incident  current,  Ii  is  \",round(Ii,4),\"  A\"\n",
      "print  \"\\n  incident  voltage,  Vi  is  \",round(Vi,2),\"  V\"\n",
      "print  \"\\n  reflected  current,  Ir  is  \",round(Ir,4),\"  A\"\n",
      "print  \"\\n  reflected  voltage,  Vr  is  \",round(Vr,2),\"  V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  reflection  coefficient  is   -0.538 \n",
        "\n",
        "  incident  current,  Ii  is   0.0867   A\n",
        "\n",
        "  incident  voltage,  Vi  is   6.5   V\n",
        "\n",
        "  reflected  current,  Ir  is   -0.0467   A\n",
        "\n",
        "  reflected  voltage,  Vr  is   3.5   V"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 14, page no. 889</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Zo  =  500  -  1j*40;#  in  ohm\n",
      "ZR1  =  500  +  1j*40;#  in  ohm\n",
      "ZR2  =  600  +  1j*0;#  in  ohm\n",
      "\n",
      " #calculation:\n",
      " #reflection  coefficient\n",
      "p1  =  (Zo  -  ZR1)/(Zo  +  ZR1)\n",
      "p2  =  (Zo  -  ZR2)/(Zo  +  ZR2)\n",
      "p1mag  =  abs(p1)\n",
      "p2mag  =  abs(p2)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  reflection  coefficient  (a)\",p1mag,\"  and  (b)\", round(p2mag,2),\"\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  reflection  coefficient  (a) 0.08   and  (b) 0.1 "
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 15, page no. 890</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#(b) the incident voltage\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "rzo  =  500;#  in  ohm\n",
      "thetazo  =  0;#  in  degrees\n",
      "ZR  =  320  +  1j*240;#  in  ohm\n",
      "rvr  =  20;#  in  volts\n",
      "thetavr  =  35;#  in  degrees\n",
      "\n",
      " #calculation:\n",
      " #voltage\n",
      "VR  =  rvr*math.cos(thetavr*math.pi/180)  +  1j*rvr*math.sin(thetavr*math.pi/180)\n",
      " #characteristic  impedance\n",
      "Zo  =  rzo*math.cos(thetazo*math.pi/180)  +  1j*rzo*math.sin(thetazo*math.pi/180)\n",
      " #the  ratio  of  the  reflected  to  the  incident  voltage  \n",
      " #vr  =  VR/Vi\n",
      "vr  =  (ZR  -  Zo)/(Zo  +  ZR)\n",
      "vrmag  =  abs(vr)\n",
      " #incident  voltage,  Vi\n",
      "Vi  =  VR/vr\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  the  magnitude  of  the  ratio  Vr  :  Vi  is  \",round(vrmag,3),\"\"\n",
      "print  \"\\n  incident  voltage,  Vi  is  \",round(abs(Vi),1),\"/_\",round(cmath.phase(complex(Vi.real,Vi.imag))*180/math.pi,2),\"deg  V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  the  magnitude  of  the  ratio  Vr  :  Vi  is   0.351 \n",
        "\n",
        "  incident  voltage,  Vi  is   57.0 /_ -75.56 deg  V\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 16, page no. 895</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "rzo  =  600;#  in  ohm\n",
      "thetazo  =  0;#  in  degrees\n",
      "ZR  =  400  +  250j;#  in  ohm\n",
      "\n",
      " #calculation:\n",
      " #characteristic  impedance\n",
      "Zo  =  rzo*math.cos(thetazo*math.pi/180)  +  1j*rzo*math.sin(thetazo*math.pi/180)\n",
      " #reflection  coefficient\n",
      "p  =  (Zo  -  ZR)/(Zo  +  ZR)\n",
      "pmag  =  abs(p)\n",
      " #standing-wave  ratio,\n",
      "s  =  (1  +  pmag)/(1  -  pmag)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  reflection  coefficient,  is  \",round(abs(p),4),\"/_\",round(cmath.phase(complex(p.real,p.imag))*180/math.pi,2),\"deg\"\n",
      "print  \"\\n  standing-wave  ratio,  s  is  \",round(s,3),\"\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  reflection  coefficient,  is   0.3106 /_ -65.38 deg\n",
        "\n",
        "  standing-wave  ratio,  s  is   1.901 "
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17, page no. 896</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "rp  =  0.2;  \n",
      "thetap  =  -120;#  in  degrees\n",
      "Zo  =  80;#  in  ohm\n",
      "Ir  =  0.01;#  in  Amperes\n",
      "\n",
      "#calculation:\n",
      " #reflection  coefficient\n",
      "p  =  rp*math.cos(thetap*math.pi/180)  +  1j*rp*math.sin(thetap*math.pi/180)\n",
      " #standing-wave  ratio,\n",
      "s  =  (1  +  rp)/(1  -  rp)\n",
      " #load  impedance  ZR  \n",
      "ZR  =  Zo*(1  -  p)/(1  +  p)\n",
      " #incident  current\n",
      "Ii  =  Ir*(s  +  1)/(s  -  1)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  standing-wave  ratio,  s  is  \",s,\"\"\n",
      "print  \"\\n  load  impedance  ZR  is  \",round(ZR.real,2),\"  +(\",round(ZR.imag,1),\")i  ohm\"\n",
      "print  \"\\n  incident  current  is  \",Ii,\"  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  standing-wave  ratio,  s  is   1.5 \n",
        "\n",
        "  load  impedance  ZR  is   91.43   +( 33.0 )i  ohm\n",
        "\n",
        "  incident  current  is   0.05   A\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 18, page no. 897</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "s  =  1.6;\n",
      "Pi  =  0.2;#  in  Watts\n",
      "\n",
      "#calculation:\n",
      " #reflected  power,  Pr\n",
      "Pr  =  Pi*((s  -  1)/(s  +  1))**2\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  reflected  power,  Pr  is  \",round(Pr*1E3,2),\" mW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  reflected  power,  Pr  is   10.65  mW"
       ]
      }
     ],
     "prompt_number": 18
    }
   ],
   "metadata": {}
  }
 ]
}