{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1> Chpater 4: DIGITAL MULTIPLEXERS<h1>"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4, page no 190 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption: Sampling Rate\n",
      "\n",
      "#initialisation of variables\n",
      "f1=4.0*10**3\n",
      "f2=4.5*10**3\n",
      "\n",
      "#CALCULATIONS\n",
      "fsmin=(2*f2)/1000\n",
      "\n",
      "#RESULTS\n",
      "print(\" Sampling rate =%.2f kHz\" %fsmin)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Sampling rate =9.00 kHz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5, Page No 190 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption: Nyquest rate,Signaling rate,bandwidth\n",
      "\n",
      "#initialisation of variables\n",
      "f1=3000.0\n",
      "f4=1000.0\n",
      "f2=1000.0\n",
      "f3=1000.0\n",
      "\n",
      "#CALCULATIONS\n",
      "#Nyquest rate\n",
      "nq1=2*f1\n",
      "nq2=2*f2\n",
      "nq3=2*f3\n",
      "nq4=2*f4\n",
      "\n",
      "#RESULTS\n",
      "print('i. Nyquest rate of x1 =%.2fkHz' %nq1)\n",
      "print('ii. Nyquest rate of x2 =%.2fkHz' %nq2)\n",
      "print('iii. Nyquest rate of x3 =%.2fkHz' %nq3)\n",
      "print('iv. Nyquest rate of x4 =%.2fkHz' %nq4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i. Nyquest rate of x1 =6000.00kHz\n",
        "ii. Nyquest rate of x2 =2000.00kHz\n",
        "iii. Nyquest rate of x3 =2000.00kHz\n",
        "iv. Nyquest rate of x4 =2000.00kHz\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6, Page No 190 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Find The spacing between two successive pules\n",
      "\n",
      "#initialisation of variables\n",
      "samplingrate=8000.0\n",
      "totalsignals=24+1\n",
      "\n",
      "#CALCULATIONS\n",
      "t=1/samplingrate\n",
      "T=t/totalsignals\n",
      "T=T*10**6            #time is now u sec\n",
      "space=T-1\n",
      "\n",
      "#RESULTS\n",
      "print('The spacing between two successive pules %.f u sec' %space)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The spacing between two successive pules 4 u sec\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7, Page No 191"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Find signaling rate ,bandwidth\n",
      "\n",
      "#initialisation of variables\n",
      "N=6.0\n",
      "fm=5000.0\n",
      "\n",
      "#CALCULATIONS\n",
      "r=2*fm   #sampling rate\n",
      "sr=N*r   #signalingrate\n",
      "BW=N*fm  #Bandwith\n",
      "sr=sr/1000\n",
      "BW=BW/1000\n",
      "\n",
      "#RESULTS\n",
      "print('Signaling rate %.f K bits/sec' %sr)\n",
      "print('Bandwith to avoid the cross talk in TDM is %.f kHz' %BW)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Signaling rate 60 K bits/sec\n",
        "Bandwith to avoid the cross talk in TDM is 30 kHz\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9, Page No 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Find signaling rate ,bandwidth\n",
      "\n",
      "#initialisation of variables\n",
      "N=4.0\n",
      "x=24              #bits/frame\n",
      "D=1152\n",
      "s=1.0/3\n",
      "r=1.544*10**6\n",
      "\n",
      "#CALCULATIONS\n",
      "r0=N*r*((D+x)/(D-s*N))\n",
      "\n",
      "#RESULTS\n",
      "print('Output bit rate %.2f MB/sec' %(r0/(10**6)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output bit rate 6.31 MB/sec\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10, Page No 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Find signaling rate ,bandwidth\n",
      "\n",
      "#initialisation of variables\n",
      "N=24.0\n",
      "x=72.0              #bits\n",
      "D=192             #message and stuff bits\n",
      "s=1.0/3\n",
      "r=64              #kb/sec\n",
      "\n",
      "#CALCULATIONS\n",
      "r0=N*r*((D+x)/(D-s*N))\n",
      "r1=((N*r)/r0)*100\n",
      "\n",
      "#RESULTS\n",
      "print('i) Output bit rate %.2f MB/sec' %(r0/(10**3)))\n",
      "print('iI) Throughput efficiency is =  %.2f percent' %r1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i) Output bit rate 2.20 MB/sec\n",
        "iI) Throughput efficiency is =  69.70 percent\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}