{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "chapter 8 Digital Communication-Coding Techniques"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.1 Page no 357"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "fa=20*10**3\n",
      "\n",
      "#calculation\n",
      "fs=2*fa                                     #minimum sample rate\n",
      "\n",
      "#result\n",
      "print\"maximum sample rate\",\"is greater than equal to\",fs,\"Hz\"        #frequency\n",
      "  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum sample rate is greater than equal to 40000 Hz\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2 Page no 362"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "dr=55\n",
      "\n",
      "#calculation\n",
      "import math\n",
      "n=(dr/6.02)\n",
      "l=2**10\n",
      "y=10*math.log10(3*(l**2))             #signal-to-quantization-noise level\n",
      "x=(1.76+(6.02*10))                    #signal-to-noise ratio for digitizing system\n",
      "\n",
      "#result\n",
      "print\"(S/N)q =\",round(y,2),\"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(S/N)q = 64.98 dB\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3 Page no 368"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=100.0*10**3                    #resistance, ohm\n",
      "Rf=10*10**3\n",
      "Vref=-10                         #reference voltage\n",
      "\n",
      "#calculation\n",
      "Vo=-(Vref)*(Rf/R)                # resolution\n",
      "a=(10/100.0)\n",
      "b=(10/50.0)\n",
      "c=(10/25.0)\n",
      "d=(10/12.5)\n",
      "V=-(Vref)*(a+b+c+d)              #output voltage\n",
      "\n",
      "#result\n",
      "print\"The step-size is \",Vo\n",
      "print\"output voltage = \",V,\"volts\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The step-size is  1.0\n",
        "output voltage =  15.0 volts\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4 Page no 375"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "d=2                     #Dmin\n",
      "d1=3\n",
      "d2=4\n",
      "\n",
      "#calculation\n",
      "x=d-1               \n",
      "a=(d/2.0)-1\n",
      "y=d1-1\n",
      "b=1/2.0*(d1-1)\n",
      "z=d2-1\n",
      "c=(d2/2.0)-1 \n",
      "#part (a)\n",
      "\n",
      "#result\n",
      "print\"(a) the no. of error detected for the distance 2 is \",x\n",
      "print\" the no. of errors corrected  = \",a\n",
      "print\"(b) the no. of error detected for the distance 3 is \",y\n",
      "print\" the no. of errors corrected  = \",b\n",
      "print\"(c) the no. of error detected for the distance 4 is \",z\n",
      "print\" the no. of errors corrected  = \",c\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) the no. of error detected for the distance 2 is  1\n",
        " the no. of errors corrected  =  0.0\n",
        "(b) the no. of error detected for the distance 3 is  2\n",
        " the no. of errors corrected  =  1.0\n",
        "(c) the no. of error detected for the distance 4 is  3\n",
        " the no. of errors corrected  =  1.0\n"
       ]
      }
     ],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}