{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "

Chpater 9: ERROR CONTROL CODING

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Find detected errors,corrected errors\n", "\n", "#initialisation of variables\n", "dmin=5.0\n", "#(s+1)<= dmin number errors can be detected(s)\n", " \n", "#CALCULATIONS\n", "s=dmin-1\n", "\n", "#RESULTS\n", "print(' i)Number of detected errors s <= %.f ' %s)\n", "#(2t+1)<=dmin number errors can be corrected(t)\n", "t=(dmin-1)/2.0\n", "print('ii) Number of corrected errors t<= %.f ' %t)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " i)Number of detected errors s <= 4 \n", "ii) Number of corrected errors t<= 2 \n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.17, Page No 569" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Determine all possible code vectors \n", "\n", "m3=1\n", "m2=0\n", "m1=1\n", "m0=0\n", "#M=Message Matrix\n", "#G=Generator Matrix\n", "G=[[1, 0, 1, 1, 0, 0, 0],[0, 1, 0, 1, 1, 0, 0],[0, 0, 1, 0, 1, 1, 0],[0, 0, 0, 1, 0, 1, 1]]\n", "M=[[m3,m2,m1,m0]]\n", "X = [[0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0]]\n", "\n", "for i in range(len(G)):\n", " # iterate through columns of PXd\n", " for j in range(len(M[0])):\n", " # iterate through rows of PYX\n", " for k in range(len(M)):\n", " X[i][j] += G[i][k] * M[k][j]\n", "print('The required code word')\n", "for r in range(0,7):\n", " print(X[0][r])" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The required code word\n", "1\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.19, Page No 572" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Determine code word \n", "m3=1\n", "m2=0\n", "m1=1\n", "m0=0\n", "#M=Message Matrix\n", "#G=Generator Matrix\n", "G=[[1, 0, 0, 0, 1, 0, 1],[0, 1, 0, 0, 1, 1, 1],[0, 0, 1, 0, 1, 1, 0],[0, 0, 0, 1, 0, 1, 1]]\n", "M=[[m3,m2,m1,m0]]\n", "X = [[0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0]]\n", "\n", "\n", "for i in range(len(G)):\n", " # iterate through columns of PXd\n", " for j in range(len(M[0])):\n", " # iterate through rows of PYX\n", " for k in range(len(M)):\n", " X[i][j] += G[i][k] * M[k][j]\n", "print('The required code word')\n", "for r in range(0,7):\n", " print(X[0][r] )\n", " \n", "\n", "print('The code in the book is wrong')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The required code word\n", "1\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "The code in the book is wrong\n" ] } ], "prompt_number": 7 } ], "metadata": {} } ] }