summaryrefslogtreecommitdiff
path: root/Electronic_Communication_Systems_by_Roy_Blake/Chapter7.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Electronic_Communication_Systems_by_Roy_Blake/Chapter7.ipynb')
-rw-r--r--Electronic_Communication_Systems_by_Roy_Blake/Chapter7.ipynb270
1 files changed, 270 insertions, 0 deletions
diff --git a/Electronic_Communication_Systems_by_Roy_Blake/Chapter7.ipynb b/Electronic_Communication_Systems_by_Roy_Blake/Chapter7.ipynb
new file mode 100644
index 00000000..3756f68c
--- /dev/null
+++ b/Electronic_Communication_Systems_by_Roy_Blake/Chapter7.ipynb
@@ -0,0 +1,270 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 7 : Digital Communication"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1 : pg 285"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "maximum data rate for four-level code in the available bandwidth 12.8 kb/s\n",
+ "maximum data rate for four-level code in the available bandwidth 37.21 kb/s\n"
+ ]
+ }
+ ],
+ "source": [
+ " \n",
+ "#page no 285\n",
+ "#prob no 7.1\n",
+ "#calculate the max data rate in both cases\n",
+ "from math import log\n",
+ "# In the given problem a signal is transmitted using a four level code\n",
+ "#given\n",
+ "M=4.;\n",
+ "B=3.2;# in KKz\n",
+ "SNR=35.;#in dB\n",
+ "#calculations and results\n",
+ "#By using Shannon-Hartley theorem, ignoring noise we have\n",
+ "c=2*B*log(M) / log(2);\n",
+ "print 'maximum data rate for four-level code in the available bandwidth',c,'kb/s'\n",
+ "#Now we have to use Shannon limit to find the maximum data rate for any code\n",
+ "#SNR in power ratio is \n",
+ "SNR1=10**(35./10.);\n",
+ "C=B*log(1+SNR1) /log(2);\n",
+ "print 'maximum data rate for four-level code in the available bandwidth',round(C,2),'kb/s'\n",
+ "# Both results are maxima, we have to choose lesser of the two.\n",
+ "# Therefore we choose c=12.8kp/s"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2 : pg 289"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The audible frequency is 14.1 KHz\n"
+ ]
+ }
+ ],
+ "source": [
+ " \n",
+ "#page no. 289\n",
+ "# prob no. 7.2\n",
+ "# In the given problem\n",
+ "#calculate the audible frequency \n",
+ "#given\n",
+ "fm = 30.# in KHz\n",
+ "fs = 44.1#sampling rate in KHz\n",
+ "#calculations\n",
+ "fa = fs - fm# audible frequency\n",
+ "#results\n",
+ "print 'The audible frequency is',fa,'KHz'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3 : pg 291"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a) The number of levels with m=8 are 256.0 levels\n",
+ "b) The number of levels with m=16 are 65536 levels\n"
+ ]
+ }
+ ],
+ "source": [
+ " \n",
+ "#page no 291\n",
+ "#prob no 7.3\n",
+ "#calculate the number of levels in both cases\n",
+ "#part a: no of samples,\n",
+ "#given\n",
+ "m=8.;\n",
+ "#calculations and results\n",
+ "N=2**m;# the number of levels\n",
+ "print 'a) The number of levels with m=8 are',N,'levels'\n",
+ "# part b:\n",
+ "m=16;\n",
+ "N=2**m;# the number of levels\n",
+ "print 'b) The number of levels with m=16 are',N,'levels'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4 : pg 292"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Dynamic range for a linear PCM 98.08 dB\n"
+ ]
+ }
+ ],
+ "source": [
+ " \n",
+ "# page no 292\n",
+ "# prob no 7.4\n",
+ "#calculate the dynamic range\n",
+ "#In the given problem\n",
+ "#given\n",
+ "m=16.;\n",
+ "#calculations\n",
+ "DR=1.76 +6.02*m ; #Dynamic range for a linear PCM in dB\n",
+ "#results\n",
+ "print 'Dynamic range for a linear PCM',DR,'dB'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5 : pg 295"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The minimum data rate needed to transmit audio is 560.0 Kb/s\n"
+ ]
+ }
+ ],
+ "source": [
+ " \n",
+ "#page no 295\n",
+ "# prob no 7.5\n",
+ "#calculate the min data rate required\n",
+ "# in the given problem\n",
+ "#given\n",
+ "fs=40.; m=14;\n",
+ "#calculations\n",
+ "# the minimum data rate needed to transmit audio is given by\n",
+ "D=fs*m;\n",
+ "#results\n",
+ "print 'The minimum data rate needed to transmit audio is ',D,'Kb/s'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6 : pg 294"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The maximum output voltage produced is 0.876 volts\n"
+ ]
+ }
+ ],
+ "source": [
+ " \n",
+ "# page no 294\n",
+ "# prob no 7.6\n",
+ "#calculate the max output voltage required\n",
+ "# In the given problem, input to a mu-law compresser is +ve,\n",
+ "# with its voltage one-half the max value\n",
+ "from math import log\n",
+ "#given\n",
+ "u=255.;\n",
+ "Vi=1.;#maximum input value is considered as unity volts\n",
+ "vi=0.5;\n",
+ "V0=1.;#consider maximum output voltage as unity volts\n",
+ "#calculations\n",
+ "vo=V0* log(1+u*vi/Vi)/log(1+u);\n",
+ "#results\n",
+ "print 'The maximum output voltage produced is',round(vo,3),'volts'"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.11"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}