{
 "metadata": {
  "name": "",
  "signature": "sha256:a1a2fd08204d20b25cb8797d32a1268bd037e7b99587377263388f4580e76a47"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Introduction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1  Page No : 4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "c = 3*10**8;     #in m/s\n",
      "f = 1.*10**6;     #in Hz\n",
      "\n",
      "# Calculations\n",
      "lembda = c/f;\n",
      "\n",
      "# Results\n",
      "print 'Wavelength (in m):',lembda\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength (in m): 300.0\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2  Page No : 4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "c = 3*10**8;     #in m/s\n",
      "f = 100.*10**6;     #in Hz\n",
      "\n",
      "# Calculations\n",
      "lembda = c/f;\n",
      "\n",
      "# Results\n",
      "print 'Wavelength (in m):',lembda\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength (in m): 3.0\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3  Page No : 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "G = 175.;     #absolute gain\n",
      "\n",
      "# Calculations\n",
      "Gdb = 10*math.log10(175);   #decibell gain\n",
      "\n",
      "# Results\n",
      "print 'The decibell power gain is:',Gdb,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The decibell power gain is: 22.4303804869 dB\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4  Page No : 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Gdb = 28.;   #decibell gain\n",
      "\n",
      "# Calculations\n",
      "G = 10**(Gdb/10);  #Absolute power gain\n",
      "\n",
      "# Results\n",
      "print 'The absolute power gain is:',G\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absolute power gain is: 630.95734448\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5  Page No : 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Gdb = 28.;   #decibell gain\n",
      "\n",
      "# Calculations\n",
      "G = 10**(Gdb/10);  #Absolute power gain\n",
      "Av = G**0.5;  #Voltage gain\n",
      "\n",
      "# Results\n",
      "print 'The voltage gain is:',Av\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The voltage gain is: 25.1188643151\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6  Page No : 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "G = 0.28; #Absolute gain\n",
      "P1 = 1;  \n",
      "P2 = .28;  #28 % of input power\n",
      "\n",
      "# Calculations and Results\n",
      "Gdb = 10*math.log10(G);\n",
      "print 'Decibell gain is',Gdb,'dB'\n",
      "\n",
      "Ldb = 10*math.log10(P1/P2); #dB loss\n",
      "print 'Decibell loss is:',Ldb,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Decibell gain is -5.52841968658 dB\n",
        "Decibell loss is: 5.52841968658 dB\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7  Page No : 11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "PmW = 100.; #power in mW\n",
      "\n",
      "# Calculations and Results\n",
      "PdBm = 10*math.log10(PmW/1);  #P in dBm level\n",
      "print '(a).   Power in dBm level is:',PdBm,'dBm'\n",
      "\n",
      "PdBW = PdBm-30;  #P in dBW level\n",
      "print '(b).   Power in dBW level is:',PdBW,'dBW'\n",
      "\n",
      "PdBf = PdBm+120;  #Pin dBf level\n",
      "print '(c)   Power in dBf level is:',PdBf,'dBf'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a).   Power in dBm level is: 20.0 dBm\n",
        "(b).   Power in dBW level is: -10.0 dBW\n",
        "(c)   Power in dBf level is: 140.0 dBf\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.8  Page No : 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "G1 = 5000.;\n",
      "L = 2000.;\n",
      "G2 = 400.;\n",
      "\n",
      "# Calculations and Results\n",
      "G = G1*(1/L)*G2;   #Absolute gain\n",
      "print '(a)  Net absolute gain is:',G\n",
      "\n",
      "GdB = 10*math.log10(G);  #System decibell gain\n",
      "print '(b)  System Decibel gain is:',GdB,'dB'\n",
      "\n",
      "G1dB = 10*math.log10(G1);\n",
      "LdB = 10*math.log10(L);\n",
      "G2dB = 10*math.log10(G2);\n",
      "print ('(c)   Individual stage gains are:');\n",
      "print 'G1dB = ',G1dB\n",
      "print 'LdB = ',LdB\n",
      "print 'G2dB = ',G2dB\n",
      "\n",
      "GdB = G1dB-LdB+G2dB;\n",
      "print 'The net dB gain is:',GdB,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  Net absolute gain is: 1000.0\n",
        "(b)  System Decibel gain is: 30.0 dB\n",
        "(c)   Individual stage gains are:\n",
        "G1dB =  36.9897000434\n",
        "LdB =  33.0102999566\n",
        "G2dB =  26.0205999133\n",
        "The net dB gain is: 30.0 dB\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.9  Page No : 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "G1 = 5000.;\n",
      "L = 2000.;\n",
      "G2 = 400.;\n",
      "Ps = 0.1;  #in mW\n",
      "\n",
      "# Calculations and Results\n",
      "P1 = G1*Ps;  #in mW\n",
      "print '(a)  Power level P1 is:',P1,'mW'\n",
      "\n",
      "P2 = P1/L;  #in mW\n",
      "print 'Line output power P2:',P2,'mW'\n",
      "\n",
      "Po = G2*P2;  #in mW\n",
      "print 'System output power Po:',Po,'mW'\n",
      "\n",
      "PsdBm = 10*math.log10(Ps/1);\n",
      "G1dB = 10*math.log10(G1);\n",
      "LdB = 10*math.log10(L);\n",
      "G2dB = 10*math.log10(G2);\n",
      "\n",
      "print ('(b)  Output power power levels in dBm are');\n",
      "P1dBm = PsdBm+G1dB;\n",
      "print 'P1(dBm) = ',P1dBm,'dBm'\n",
      "\n",
      "P2dBm = P1dBm-LdB;\n",
      "print 'P2(dBm) = ',P2dBm,'dBm'\n",
      "\n",
      "PodBm = P2dBm+G2dB;\n",
      "print 'Po(dBm) = ',PodBm,'dBm'\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  Power level P1 is: 500.0 mW\n",
        "Line output power P2: 0.25 mW\n",
        "System output power Po: 100.0 mW\n",
        "(b)  Output power power levels in dBm are\n",
        "P1(dBm) =  26.9897000434 dBm\n",
        "P2(dBm) =  -6.02059991328 dBm\n",
        "Po(dBm) =  20.0 dBm\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.10  Page No : 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "def voltage(PdBm):\n",
      "    P = 1*10**(-3)*(10**(PdBm/10));\n",
      "    return (75*P)**0.5;\n",
      "\n",
      "# Variables\n",
      "S = 10.;  #dBm\n",
      "G1 = 13.;  #dB\n",
      "L1 = 26.;  #dB\n",
      "G2 = 20.;  #dB\n",
      "L2 = 29.;  #dB\n",
      "\n",
      "# Calculations and Results\n",
      "print '(a)  The output levels are',\n",
      "PdBm = S;\n",
      "V = voltage(PdBm);\n",
      "print PdBm,'1. Signal source in dBm:',PdBm,'in Volts : ',V\n",
      "\n",
      "PdBm = S+G1;\n",
      "V = voltage(PdBm);\n",
      "print '2. Line Amplifier in dBm:',PdBm,'in Volts : ',V\n",
      "\n",
      "PdBm = S+G1-L1;\n",
      "V = voltage(PdBm);\n",
      "print '3. Cable section A in dBm:',PdBm,'in Volts : ',V\n",
      "\n",
      "PdBm = S+G1-L1+G2;\n",
      "V = voltage(PdBm);\n",
      "print '4. Booster amplifier in dBm:',PdBm,'in Volts : ',V\n",
      "\n",
      "PdBm = S+G1-L1+G2-L2;\n",
      "V = voltage(PdBm);\n",
      "print '5. Cable section B in dBm:',PdBm,'in Volts : ',V\n",
      "print ('(b).  The output power to get a voltage of 6V'),\n",
      "V = 6.;   #volts\n",
      "R = 75.;  #ohm\n",
      "Po = (V**2)/R;\n",
      "print Po,'W';\n",
      "PodBm = 10*math.log10(Po*1000/1);\n",
      "print 'power in dBm',PodBm,'dBm'\n",
      "\n",
      "GrdB = PodBm-PdBm;\n",
      "print 'The required gain is',GrdB,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  The output levels are 10.0 1. Signal source in dBm: 10.0 in Volts :  0.866025403784\n",
        "2. Line Amplifier in dBm: 23.0 in Volts :  3.86839338256\n",
        "3. Cable section A in dBm: -3.0 in Volts :  0.193878937799\n",
        "4. Booster amplifier in dBm: 17.0 in Volts :  1.93878937799\n",
        "5. Cable section B in dBm: -12.0 in Volts :  0.0687908430214\n",
        "(b).  The output power to get a voltage of 6V 0.48 W\n",
        "power in dBm 26.8124123738 dBm\n",
        "The required gain is 38.8124123738 dB\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.11  Page No : 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "P = 5.;   #In mW\n",
      "N = 100.*10**-6;  #in mW\n",
      "\n",
      "# Calculations and Results\n",
      "S2N = P/N;\n",
      "print '(a)    Absolute signal to noise ratio :',S2N\n",
      "\n",
      "S2NdB = 10*math.log10(S2N);\n",
      "print '(b)   dB signal to noise ratio is:',S2NdB,'dB'\n",
      "\n",
      "PdBm = 10*math.log10(P/1);\n",
      "print '(c)    Signal Power is',PdBm,'dBm'\n",
      "\n",
      "NdBm = 10*math.log10(N/1);\n",
      "print 'Noise power is',NdBm,'dBm'\n",
      "\n",
      "S2NdB = PdBm-NdBm;\n",
      "print 'Decinel S/N ratio is',S2NdB,'dB'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)    Absolute signal to noise ratio : 50000.0\n",
        "(b)   dB signal to noise ratio is: 46.9897000434 dB\n",
        "(c)    Signal Power is 6.98970004336 dBm\n",
        "Noise power is -40.0 dBm\n",
        "Decinel S/N ratio is 46.9897000434 dB\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}