{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9 Wired Digital Communications"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1 Page no 405"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "M=110\n",
      "x=7.0\n",
      "\n",
      "#calculation\n",
      "import math\n",
      "a=math.log10(110)/(math.log10(2))\n",
      "n=math.log(M)\n",
      "b=2**a\n",
      "u=(a/x)*100\n",
      "y=math.log10(b)\n",
      "u1=(y/3.0)*100\n",
      "\n",
      "#result\n",
      "print\"the number of bits required = \",round(a,2)         #number of bits\n",
      "print\"The efficiency is \",round(u1,0),\"percent\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the number of bits required =  6.78\n",
        "The efficiency is  68.0 percent\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2 Page no 407"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "m=10**7\n",
      "Pe=10**-6         #error probability\n",
      "\n",
      "#calculation\n",
      "a=m*Pe            #average number of errors\n",
      "\n",
      "#result\n",
      "print\"expected number of errors =\",a\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "expected number of errors = 10.0\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3 Page no 407"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "Tb=1/9600.0                    #bit frequency\n",
      "Pt=0.8                         #transmit power\n",
      "\n",
      "#calculation\n",
      "Eb=Pt*Tb                       #energy per bit\n",
      "\n",
      "#result\n",
      "print\"Energy per bit = \",round(Eb,7),\"J\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy per bit =  8.33e-05 J\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4 Page no 410"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "bw=3*10**3                    #bandwidth\n",
      "x=1023                        #signal-to-noise ratio\n",
      "\n",
      "#calculation\n",
      "import math\n",
      "C=bw*math.log(1+x)/math.log(2)           #capacity of telephone channel\n",
      "\n",
      "#result\n",
      "print\"the capacity of a telephone channel =\",C,\"bit per second\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the capacity of a telephone channel = 30000.0 bit per second\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.5 Page no 411"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "Tb=1/(8.0*10**3)               #bit frequency\n",
      "BWmin=1/(2.0*Tb)               #minimum bandwidth\n",
      "\n",
      "#result\n",
      "print\"minimum bandwidth  = \",BWmin,\"Hz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "minimum bandwidth  =  4000.0 Hz\n"
       ]
      }
     ],
     "prompt_number": 33
    }
   ],
   "metadata": {}
  }
 ]
}