{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 12 : Digital Modulation and Modems" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1 : pg 407" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "a)The theoretical max data rate is 50.278 kb/s\n", "b)The data rate for 4 states is 40.0 kb/s\n" ] } ], "source": [ " \n", "# page no 407\n", "# prob no 12_1\n", "#calculate the data rate and theoretical max\n", "#A radio channel with BW=10KHz and SNR=15 dB\n", "from math import log\n", "#given\n", "B=10.*10**3;\n", "snr=15.;\n", "#calculations and results\n", "#converting dB in power ratio\n", "SNR=10**(snr/10);\n", "#a)Determination of theoretical max data rate\n", "C1=B*log(1+SNR) /log(2);\n", "print 'a)The theoretical max data rate is',round(C1/1000,3),'kb/s'\n", "#b)Determination of data rate with 4 states i.e M=4\n", "M=4.;\n", "C2=2*B*log(M) / log(2);\n", "print 'b)The data rate for 4 states is',C2/1000,'kb/s'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2 : pg 408" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The baud rate is 10.0 kbaud\n", "The bit rate is 60.0 kb/s\n" ] } ], "source": [ " \n", "# page no 408\n", "# prob no 12_2\n", "#calculate the baud and bit rates\n", "from math import log\n", "#A modulator transmit symbol with symbol rate=10k/sec with 64 states\n", "#given\n", "M=64.;\n", "S=10000.;\n", "#calculations and results\n", "#Baud rate is simply symbol rate\n", "print 'The baud rate is ',S/1000,'kbaud'\n", "#Determination of bit rate\n", "C=S*log(64) / log(2);\n", "print 'The bit rate is ',C/1000,'kb/s'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3 : pg 411" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "a)The frequency shift is 135416.5 Hz\n", "b)The maximum frequency is 880067708.25 Hz\n", "The minimum frequency is 879932291.75 Hz\n", "The bandwidth efficiency in b/s/Hz is 1.354 b/s/Hz\n" ] } ], "source": [ " \n", "# page no 411\n", "# prob no 12_3\n", "#calculate the frequency shift, max, min frequency\n", "#given\n", "f=200.*10**3;\n", "fb=270.833 *10**3;\n", "data_rate=270.833 *10**3\n", "fc=880*10**6;\n", "bandwidth=200*10**3;\n", "#calculations and results\n", "freq_shift=0.5*fb;\n", "print 'a)The frequency shift is',freq_shift,'Hz'\n", "# The shift each way from the carrier frequency is half the freq_shift\n", "f_max=fc+0.25*fb;\n", "print 'b)The maximum frequency is',round(f_max,3),'Hz'\n", "f_min=fc-0.25*fb;\n", "print 'The minimum frequency is',round(f_min,3),'Hz'\n", "bandwidth_efficiency=data_rate/bandwidth;\n", "print 'The bandwidth efficiency in b/s/Hz is',round(bandwidth_efficiency,3),'b/s/Hz'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4 : pg 412" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The channel data rate is 48.6 kb/s\n" ] } ], "source": [ " \n", "# page no 412\n", "# prob no 12_4\n", "#calculate the channel data rate\n", "#given\n", "baud_rate=24.3;# in kilobaud\n", "#calculations\n", "# In this problem dibit system is used.\n", "#Therefore symbol_rate=baud_rate=0.5*bit_rate\n", "bit_rate=2*baud_rate;\n", "#results\n", "print 'The channel data rate is',bit_rate,'kb/s'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 5 : pg 413" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The no. of bits per symbol is 6.0\n" ] } ], "source": [ " \n", "# page no 413\n", "# prob no 12_5\n", "#calculate the no. of bits per symbol\n", "from math import log\n", "#given\n", "no_of_phase_angles=16;\n", "no_of_amplitudes=4;\n", "#calculations\n", "no_of_states_per_symbol=no_of_phase_angles*no_of_amplitudes;\n", "bit_per_symbol=log(no_of_states_per_symbol)/ log(2);\n", "#results\n", "print 'The no. of bits per symbol is',bit_per_symbol" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6 : pg 415" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Shannon limit 29901.68 b/s\n" ] } ], "source": [ " \n", "# page no 415\n", "# prob no 12_6\n", "#calculate the shannon limit\n", "from math import log\n", "#given\n", "B=3.*10**3;SNR_dB=30.;\n", "#calculations\n", "SNR_power=10**(30./10);\n", "C=B*log(1+SNR_power)/ log(2);\n", "print 'Shannon limit',round(C,2),'b/s'" ] } ], "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 }