{ "metadata": { "name": "", "signature": "sha256:37e281407bf18ea4cb97b4d94f518d678964a52abb4754faf8b1ff73d8221481" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "CHAPTER10:DIGITAL MODULATION AND DEMODULATION" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E01 : Pg 10.18" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.18\n", "# Example 10.1\n", "from math import sqrt,erfc\n", "# Given\n", "Rb=1.*10.**6.; # b/s\n", "A=5.*10.**3.; # V\n", "N0=0.5*10.**11.; # W/Hz\n", "\n", "Tb=1./Rb;\n", "Eb=(A*A*Tb)/2.;\n", "\n", "# (a) ASK\n", "# Pe=Q(x)\n", "# where\n", "xA=sqrt(Eb/N0);\n", "\n", "PeA=(1./2.)*erfc(xA/1.414);\n", "print'For ASK:',round(PeA,2)\n", "\n", "# (b) PSK\n", "# Pe=Q(x)\n", "# where\n", "xP=sqrt((2.*Eb)/N0);\n", "\n", "PeP=(1./2.)*erfc(xP/1.414);\n", "print'For PSK:',round(PeP,2)\n", "\n", "# (c) FSK\n", "# Pe=Q(x)\n", "# where\n", "xF=sqrt(Eb/N0);\n", "\n", "PeF=(1./2.)*erfc(xF/1.414);\n", "print'For FSK:',round(PeF,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For ASK: 0.5\n", "For PSK: 0.5\n", "For FSK: 0.5\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E02 : Pg 10.19" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.19\n", "# Example 10.2\n", "from math import sqrt,erfc\n", "# Given\n", "Rb=1.*10.**6.; # b/s\n", "\n", "# (a)\n", "Aa=1.*10.**3.; # V\n", "N0=1*10.**11.; # W/Hz\n", "\n", "Tb=1./Rb;\n", "Eba=(Aa*Aa*Tb)/2.;\n", "\n", "# Pe=Q(z)\n", "# where\n", "za=sqrt((2.*Eba)/N0);\n", "\n", "Peb=(1./2.)*erfc(za/1.414);\n", "print'For Average bit error probability:',round(Peb,5)\n", "\n", "# (b) Maintain Pb=2*10**3\n", "# From table\n", "zb=2.9;\n", "Ebb=((zb**2.)*N0)/2.;\n", "P=Ebb*Tb;\n", "Ab=sqrt((2.*P));\n", "print'Average Power:',round(Ab,2),'V'\n", "\n", "# (c)\n", "Ac=100.; # V\n", "Rbc=1.*10.**5.; # p/s\n", "N01=1.*10.**2.; # W/Hz\n", "Tbc=1./Rbc;\n", "Ebc=(Ac*Ac*Tbc);\n", "\n", "zc=sqrt(((2.*Ebc)/N01));\n", "\n", "Pec=(1./2.)*erfc(zc/1.414);\n", "# Pec=0.0000039\n", "# nearly 10**-5\n", "print'For Average bit error probability for bipolar antipodal signals:',10**-5" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For Average bit error probability: 0.5\n", "Average Power: 917.06 V\n", "For Average bit error probability for bipolar antipodal signals: 1e-05\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E06 : Pg 10.23" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.23\n", "# Example 10.6\n", "# Given\n", "import math\n", "p=0.1; # dB\n", "p1=10.**(-p/10.);\n", "p2=math.sqrt(p1);\n", "t=8.68;#math.acosd(p2);\n", "a=round(t);\n", "print'System cannot tolerate more than:',a,'degrees'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "System cannot tolerate more than: 9.0 degrees\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E11 : Pg 10.28" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.28\n", "# Example 10.11\n", "from math import sqrt,erfc\n", "# Given\n", "Rb=1.*10.**6.; # b/s\n", "T=1.*10.**5.;\n", "N0=2.*0.5*10.**7.; # W/Hz\n", "\n", "# From table for Q(z)=10**-5\n", "z=4.25;\n", "\n", "# As z=sqrt(A*A*T/2*N0)\n", "x=((z**2.)*2.*N0)/T;\n", "A=sqrt(x);\n", "print'Required value of A:',round(A,2)\n", "\n", "# (b) Bandwidth\n", "# B=1/(2*(T/2))\n", "# Therefore B=1/T\n", "B=(1./T);\n", "print'Bandwidth:',round(B,2),'Hz'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Required value of A: 60.1\n", "Bandwidth: 0.0 Hz\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E17 : Pg 10.33" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.33\n", "# Example 10.17\n", "from math import sqrt,erfc\n", "# Given\n", "A=0.2*10.**3.; # V\n", "T=2.*10.**6.; # s\n", "n=2.*1.*10.**15.; # W/Hz\n", "\n", "\n", "# Pe=Q(z)\n", "# where\n", "x=(A*A*T)/(4.*n);\n", "z=sqrt(x);\n", "Pe=(1./2.)*erfc(z/1.414);\n", "print'Error probability:',round(Pe,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Error probability: 0.5\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E18 : Pg 10.34" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.34\n", "# Example 10.18\n", "from math import sqrt,erfc\n", "# Given\n", "A=0.2*10.**3.; # V\n", "A1=A/1.414;\n", "\n", "T=2.*10.**6.; # s\n", "n=2.*1.*10.**15.; # W/Hz\n", "\n", "\n", "# Pe=Q(z)\n", "# where\n", "x=(A1*A1*T)/(n);\n", "z=sqrt(x);\n", "Pe=(1./2.)*erfc(z/1.414);\n", "print'Error probability:',round(Pe,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Error probability: 0.5\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E19 : Pg 10.35" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.35\n", "# Example 10.19\n", "from math import sqrt,erfc\n", "# Given\n", "d12sqr=8.;\n", "N0=2.*0.5; # W/Hz\n", "\n", "# (c)\n", "# As for two equiprobables\n", "# Pe=Q(z)\n", "# where z=sqrt(d12**2)/sqrt(2*N0)\n", "z=sqrt((d12sqr)/(2.*N0));\n", "Pe=(1./2.)*erfc(z/1.414);\n", "print'Probabilty error:',round(Pe,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Probabilty error: 0.02\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E20 : Pg 10.36" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.36\n", "# Example 10.20\n", "from math import sqrt,erfc\n", "# Given\n", "c=sqrt(2.);\n", "A=sqrt(5.);\n", "N0=1.; # W/Hz\n", "\n", "d12sqr=4.*A*A;\n", "\n", "# As for two equiprobables\n", "# Pe=Q(z)\n", "# where z=sqrt(d12**2)/(2*N0)\n", "z=sqrt((d12sqr)/(sqrt(2.*N0)));\n", "Pe=(1./2.)*erfc(z/1.414);\n", "print'Probabilty error:',round(Pe,4)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Probabilty error: 0.0001\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E24 : Pg 10.41" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.41\n", "# Example 10.24\n", "# (a) Number of constellation Points\n", "# Given\n", "Rs=2400.; # bps\n", "Rb=19.2*10.**3.; # bps\n", "\n", "# As Rs=Rb/log2M\n", "M=2.**(Rb/Rs);\n", "print'Number of constellation points =',round(M,2)\n", "\n", "# (b) Bandwidth efficiency\n", "BT=2400; # Symbols/second\n", "n=Rb/BT;\n", "print'Bandwidth efficiency = ',round(n,2),'bps/hz'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Number of constellation points = 256.0\n", "Bandwidth efficiency = 8.0 " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "bps/hz\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E25 : Pg 10.41" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.41\n", "# Example 10.25\n", "from math import sqrt,erfc\n", "# Given\n", "A1=0.5;\n", "A2=0.5;\n", "T=0.01; # sec\n", "N0=2.*0.0001; # W/Hz\n", "f=50.; # Hz\n", "\n", "# (a) Probability of bit error\n", "Es1=(A1**2.*T)/2.;\n", "Es2=(A2**2.*T)/2.;\n", "\n", "Eb=(Es1+Es2)/2.;\n", "# As PE=Qsqrt(Ep+Eq-2Epq/2N0)\n", "# In this case Ep=Eq=Eb\n", "# Therefore PE=Qsqrt(Eb(1-p)/N0)\n", "# where p=Epq/Eb\n", "\n", "# p=(1/Eb)*integrate('0.5*cos(2000*%pi*t)*0.5*cos(2020*%pi*t)','t',0,T);\n", "# We get\n", "p=0.94;\n", "q=1.-p;\n", "# As Pe=Q(z)\n", "# where z=sqrt(Eb/N0)\n", "z=sqrt((Eb*q)/N0);\n", "Pe=(1./2.)*erfc(z/1.414);\n", "print'Probabilty of bit error :',round(Pe,2)\n", "\n", "# (b)\n", "# Given\n", "fs=50.; # Hz\n", "# or fs=1/2T where T=0.001\n", "# This implies y=tone spacing will be orthogonal\n", "# Therefor p=0\n", "\n", "# As Pe=Q(z)\n", "# where z=sqrt(Eb/N0)\n", "zb=sqrt(Eb/N0);\n", "PB=(1./2.)*erfc(zb/1.414);\n", "print'Probabilty error for fs=50Hz :',round(PB,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Probabilty of bit error : 0.27\n", "Probabilty error for fs=50Hz : 0.01\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E27 : Pg 10.43" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Page Number: 10.43\n", "# Example 10.27\n", "\n", "# Given\n", "Rb=4.8*10.**3.; # b/s\n", "bw=3.2*10.**3.; # Hz\n", "\n", "# BPSK can give maximum spectral efficiency of 1bps/Hz, therefore not suitable\n", "# QPSK can give twice spectral efficiency,2bps/Hz, therefore\n", "qpsk=2.*bw;\n", "# PSK can give thrice spectral efficiency,3bps/Hz, therefore\n", "psk=3.*bw;\n", "\n", "# QPSK is most suitable\n", "Rs=Rb/2.;\n", "# Roll off Factor\n", "a=(bw/Rs)-1.;\n", "ap=a*100.;\n", "print'Roll off factor:',ap,'%'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Roll off factor: 33.3333333333 %\n" ] } ], "prompt_number": 11 } ], "metadata": {} } ] }