From 92cca121f959c6616e3da431c1e2d23c4fa5e886 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Tue, 7 Apr 2015 15:58:05 +0530 Subject: added books --- Digital_Communications/ChapterNo9.ipynb | 182 ++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100755 Digital_Communications/ChapterNo9.ipynb (limited to 'Digital_Communications/ChapterNo9.ipynb') diff --git a/Digital_Communications/ChapterNo9.ipynb b/Digital_Communications/ChapterNo9.ipynb new file mode 100755 index 00000000..8062105c --- /dev/null +++ b/Digital_Communications/ChapterNo9.ipynb @@ -0,0 +1,182 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chpater No 9: ERROR CONTROL CODING

" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.4, Page No 540" + ] + }, + { + "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 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file -- cgit