{ "metadata": { "name": "", "signature": "sha256:4f7509b378d9baa23589f40ce770175499b6cadfd03b87969971e1834bcae9ad" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 9: Modulation Schemes" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.1, Page 259" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "import scipy\n", "from scipy.optimize import fsolve\n", "\n", "#Variable declaration\n", "Pe=10**-6;#Probability of error\n", "e=2.71828; #Euler's Number\n", "\n", "#Calculations\n", "# For BPSK\n", "#Pe(=10**-6)=e**(-x)/(2*sqrt(%pi*x)); where x=Eb/No\n", "def f(x):\n", " y=2.71828**(-x)/(2*math.sqrt(math.pi*x))-10**-6\n", " return y\n", "x = fsolve(f,0.1);\n", "\n", "#Results\n", "print 'Eb/No For BPSK is %.2f dB'%(10*math.log10(x));\n", "print 'FSK requires 3 dB more in terms of Eb/N0 to give the same Pe as BPSK so it comes out to be %.2f dB'%(10*math.log10(x)+3);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Eb/No For BPSK is 10.54 dB\n", "FSK requires 3 dB more in terms of Eb/N0 to give the same Pe as BPSK so it comes out to be 13.54 dB\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.2, Page 259" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "Pe=10.**-6;#Probability of error\n", "No=10.**-10; # PSD in W/Hz\n", "R=100*10**3; #data rate in bps\n", "\n", "#Calculations\n", "#From Example 9.1, Eb/N0= 10.54dB (11.32) for Pe=10**-6 \n", "#Therefore\n", "Eb_No=11.32; #From Exa. 9.1\n", "# Eb/No = A**2/(2*No*R);\n", "A=math.sqrt(2*No*(Eb_No)*R);\n", "\n", "#Result\n", "print 'Amplitude of a carrier signal is %.3f mV'%(A*1000);\n", "#Incorrect answer in textbook" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Amplitude of a carrier signal is 15.047 mV\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.3, Page 267" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "B=['00','10','01','11','01','00','11','10','10','01','01','00'];#Given Bit stream\n", "\n", "#Calculations&Results\n", "print \"Phase transition table for pi/4-DQPSK Modulation is given as \"\n", "print \" By Referring Table 9.1 on page No 266 i.e\"\n", "print \"Symbol Phase transition\"\n", "print \"00 => 45\u00b0\"\n", "print \"01 => 135\u00b0\"\n", "print \"10 => -45\u00b0\"\n", "print \"11 => -135\u00b0\"\n", "print \"sym Dell phi(k) Phi(k)\"\n", "#BitStream='001001110100111010010100';\n", "\n", "phase=0; #Taking initial phase as zero\n", "for i in range(0,12):\n", " if(B[i]=='00'):\n", " phase=phase+45; \n", " print ' %s 45 %d'%(B[i],phase);\n", " \n", " if(B[i]=='01'):\n", " phase=phase+135;\n", " print ' %s 135 %d'%(B[i],phase);\n", " \n", " if(B[i]=='10'):\n", " phase=phase-45;\n", " print ' %s -45 %d'%(B[i],phase);\n", " \n", " if(B[i]=='11'):\n", " phase=phase-135;\n", " print ' %s -135 %d'%(B[i],phase);\n", " \n", "\n", "print 'final phase for the pi/4-DQPSK modulation method for given bitstream is %d degree'%phase" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Phase transition table for pi/4-DQPSK Modulation is given as \n", " By Referring Table 9.1 on page No 266 i.e\n", "Symbol Phase transition\n", "00 => 45\u00b0\n", "01 => 135\u00b0\n", "10 => -45\u00b0\n", "11 => -135\u00b0\n", "sym Dell phi(k) Phi(k)\n", " 00 45 45\n", " 10 -45 0\n", " 01 135 135\n", " 11 -135 0\n", " 01 135 135\n", " 00 45 180\n", " 11 -135 45\n", " 10 -45 0\n", " 10 -45 -45\n", " 01 135 90\n", " 01 135 225\n", " 00 45 270\n", "final phase for the pi/4-DQPSK modulation method for given bitstream is 270 degree\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.4, Page 270" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "CHBW=200; #Channel BW in KHz\n", "R=270.83; #Data rate in kbps\n", "Fc=900; #carrier frequency in MHz\n", "\n", "#Calculations\n", "FreqShift=0.5*R;\n", "#Transmitted Frequencies\n", "Fh=Fc*1000+0.25*R;#Max\n", "Fl=Fc*1000-0.25*R;#Min\n", "BWEff=R/CHBW;\n", "\n", "#Results\n", "print 'The frequency shift between binary 1 and binary 0 is %.3f kHz'%FreqShift;\n", "print 'Maximum and Minimum value of transmitted frequencies are %.4f mHz and %.4f mHz respectively'%(Fh/1000,Fl/1000);\n", "print 'Bandwidth efficiency is %.2f bps/Hz'%BWEff" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The frequency shift between binary 1 and binary 0 is 135.415 kHz\n", "Maximum and Minimum value of transmitted frequencies are 900.0677 mHz and 899.9323 mHz respectively\n", "Bandwidth efficiency is 1.35 bps/Hz\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.5, Page 271" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "R=270.; #data rate in kbps\n", "Eb_No=6.; # in dB\n", "GMSK=0.3; #Gaussian minimum shift keying\n", "\n", "#Calculations&Results\n", "Tb=1./R *10**3; #in microsec\n", "B=GMSK/Tb;\n", "print '3-dB BW for a gaussian low pass filter is %.f kHz'%(B*1000);\n", "PowerBW=1.41*R;\n", "DegradFac=0.89;\n", "Pe=math.erfc(math.sqrt(2*DegradFac*10**(0.1*Eb_No)));\n", "print 'Power bandwidth in the RF channel is %.1f kHz'%PowerBW\n", "print 'Bit error probability for GMSK is %.1e'%Pe; #Incorrect answer in textbook" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "3-dB BW for a gaussian low pass filter is 81 kHz\n", "Power bandwidth in the RF channel is 380.7 kHz\n", "Bit error probability for GMSK is 1.7e-04\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.6, Page 273" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "Rs=19200; #symbols per second\n", "states=64;\n", "\n", "#Calculations\n", "Bits_symbol=math.log(states,2);\n", "BitRate=Bits_symbol*Rs;\n", "\n", "#Result\n", "print 'Bit Rate of the modulator is %.1f kbps'%(BitRate/1000)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Bit Rate of the modulator is 115.2 kbps\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.7, Page 274" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "import scipy\n", "from scipy.optimize import fsolve\n", "\n", "#Variable declaration\n", "Rb=144; #data rate in kbps\n", "BW=36; #in MHz\n", "Pb=3*10**-5;#probability of bit error\n", "\n", "#Calculations\n", "Seff=Rb/BW; #spectral efficiency in bps/Hz\n", "M=2**(Rb/BW); #since the channel is band limited\n", "\n", "#since Q[sqrt(2*Eb_No)]=(1/2)*erfc[sqrt(Eb_No)] # refer page no 257 equ 9.35\n", "def f(x):\n", " y=(3./8)*math.erfc(math.sqrt((2./5)*x))-Pb #from eqn 9.66 and 9.35\n", " return y\n", " \n", "x = fsolve(f,0.1)\n", "\n", "#Result\n", "print 'For a rectangular constellation (refer Figure 9.12), with a Gaussian channel and matched \ufb01lter reception, the calculated Eb/No value is %.1f dB'%(10*math.log10(x));" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For a rectangular constellation (refer Figure 9.12), with a Gaussian channel and matched \ufb01lter reception, the calculated Eb/No value is 12.9 dB\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.8, Page 274" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "import scipy\n", "from scipy.optimize import fsolve\n", "\n", "#Variable declaration\n", "Pb=10**-8;#BER probability\n", "\n", "#Calculations&Results\n", "print \"For 16-PSK:\"\n", "# Pb=0.5*Q(0.552*sqrt(Eb_No));\n", "#since Q[sqrt(2*Eb_No)]=(1/2)*erfc[sqrt(Eb_No)] # refer page no 257 equ 9.35\n", "def f(x):\n", " y=0.25*math.erfc(math.sqrt(0.5*0.552**2*x))-Pb\n", " return y\n", "\n", "x = fsolve(f,0.1)\n", "\n", "print 'Using equation 9.50 we get Eb/No as %d dB (approx)'%round(10*math.log10(x));\n", "\n", "print \"For 16-QAM\"\n", "#Pb=0.75*Q(sqrt(0.8*Eb_No));\n", "def f(x1):\n", " y=(3./8)*math.erfc(math.sqrt(0.4*x1))-Pb\n", " return y\n", " \n", "x1 = fsolve(f,0.1)\n", "\n", "#since Q[sqrt(2*Eb_No)]=(1/2)*erfc[sqrt(Eb_No)] # refer page no 257 equ 9.35\n", "print 'Using equation 9.66 we get Eb/No as %d dB (approx)'%round(10*math.log10(x1));\n", "print 'Thus 16-QAM has an advantage of about %d dB compared to 16-PSK'%(10*math.log10(x)-10*math.log10(x1));" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For 16-PSK:\n", "Using equation 9.50 we get Eb/No as 20 dB (approx)\n", "For 16-QAM\n", "Using equation 9.66 we get Eb/No as 16 dB (approx)\n", "Thus 16-QAM has an advantage of about 4 dB compared to 16-PSK\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9.9, Page 277" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "M=8; #number of different signal elements\n", "Fc=250; #carrier frequency in kHz\n", "DelF=25; #kHz\n", "Pe=10**-6;#probability of error\n", "\n", "#Calculations\n", "TotalBW=2*M*DelF;\n", "nb=2*math.log(M,2)/(M+3);\n", "#Pe=7*Q(z) and z=approx(5.08)\n", "z=5.08;\n", "Eb_No=(z)**2/math.log(M,2);\n", "bits_sym=math.log(M,2);\n", "\n", "#Results\n", "print 'Total bandwidth required is %d kHz \\n '%TotalBW;\n", "print 'The bandwidth efficiency is %.4f \\n '%nb;\n", "print 'The required Eb/No is %.3f dB \\n '%(10*math.log10(Eb_No));\n", "print 'Carried bits per symbol are %d \\n '%bits_sym;" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Total bandwidth required is 400 kHz \n", " \n", "The bandwidth efficiency is 0.5455 \n", " \n", "The required Eb/No is 9.346 dB \n", " \n", "Carried bits per symbol are 3 \n", " \n" ] } ], "prompt_number": 10 } ], "metadata": {} } ] }