{ "metadata": { "name": "", "signature": "sha256:a9273e79f8d5c3c028c517c94bebc1e2c1c9a292aef113298724eb86d1685f66" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 11: Spread Spectrum (SS) and CDMA Systems" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11.1, Page 322" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "CR1=1.2288; #Mcps(Clock rate 1)\n", "CR2=5.;#Mcps(Clock rate 2)\n", "R1=9.6; #Information rate in Kbps for CR1\n", "PG2=256; #Processing Gain for CR2\n", "\n", "#Calculations\n", "PG1=10*math.log10(CR1*10**3/9.6);#Processing Gain for CR1\n", "R2=CR2*10**3/PG2;#information rate in Kbps for CR2\n", "\n", "#Results\n", "print 'The processing gain for clock rate 1.2288Mcps is %d dB'%PG1\n", "print 'Improvemrnt in information rate is %.2f Kbps'%(R2-R1);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The processing gain for clock rate 1.2288Mcps is 21 dB\n", "Improvemrnt in information rate is 9.93 Kbps\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11.2, Page 326" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "#From figure 11.5 we get resultant demodulated signal at a mobile;\n", "Rx=[[1,1,1,1,-3,1],[1,-3,1,1,1,1],[1,-3,1,1,1,-3],[1,-3,1,1,1,1],[-1,3,3,-1,3,-1]];#Resultant demodulated signal at mobile\n", "\n", "#from Figure 11.4 \n", "c1=[[-1,-1,-1,-1,1,1],[1,-1,1,1,-1,-1],[1,-1,1,-1,-1,-1],[-1,1,1,1,-1,1],[1,-1,-1,1,-1,1]];\n", "c2=[[1,1,-1,1,1,-1],[-1,1,-1,1,-1,-1],[-1,-1,1,1,1,-1],[1,1,-1,-1,1,-1],[1,-1,-1,-1,-1,-1]];\n", "c3=[[-1,-1,1,-1,1,-1],[-1,-1,-1,1,1,1],[-1,1,1,-1,-1,1],[-1,1,-1,-1,-1,-1],[1,1,1,-1,1,1]];\n", "\n", "#Calculations&Results\n", "#t={[1 2 3 4 5 6];[7 8 9 10 11 12];[13 14 15 16 17 18];[19 20 21 22 23 24];[25 26 27 28 29 30]};\n", "#for Mobile 1\n", "for i in range(0,5):\n", " Demod1=c1[i][0]*Rx[i][0]+c1[i][1]*Rx[i][1]+c1[i][2]*Rx[i][2]+c1[i][3]*Rx[i][3]+c1[i][4]*Rx[i][4]-1\n", " if(Demod1<0):\n", " B1=1;\n", " else:\n", " B1=0;\n", "\n", "#for mobile 2\n", "for i in range(0,5):\n", " Demod2=c2[i][0]*Rx[i][0]+c2[i][1]*Rx[i][1]+c2[i][2]*Rx[i][2]+c2[i][3]*Rx[i][3]+c2[i][4]*Rx[i][4]+1;\n", " if(Demod2<0):\n", " B2=1;\n", " else:\n", " B2=0;\n", "\n", "#for mobile 3\n", "for i in range(0,5):\n", " Demod3=c3[i][0]*Rx[i][0]+c3[i][1]*Rx[i][1]+c3[i][2]*Rx[i][2]+c3[i][3]*Rx[i][3]+c3[i][4]*Rx[i][4]-1;\n", " if(Demod3<0):\n", " B3=1;\n", " else:\n", " B3=0;\n", "\n", "print \"Value of integration at end of bit period for mobile1\",Demod1\n", "print \"Value of integration at end of bit period for mobile2\",Demod2\n", "print \"Value of integration at end of bit period for mobile3\",Demod3\n", "print \"The recovered signal at mobile 1 is \",B1\n", "print \"The recovered signal at mobile 2 is \",B2\n", "print \"The recovered signal at mobile 3 is \",B3\n", "print \"In all cases, Recovered signal is negated value of transmitted signal\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of integration at end of bit period for mobile1 -12\n", "Value of integration at end of bit period for mobile2 -8\n", "Value of integration at end of bit period for mobile3 8\n", "The recovered signal at mobile 1 is 1\n", "The recovered signal at mobile 2 is 1\n", "The recovered signal at mobile 3 is 0\n", "In all cases, Recovered signal is negated value of transmitted signal\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11.3, Page 332" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "BW=100; #in MHz\n", "Fspac=10; #frequency spacing in kHz\n", "\n", "#Calculations\n", "FreqTones=BW*10**3/Fspac;\n", "Chips=math.log(FreqTones,2);\n", "\n", "#Result\n", "print 'Minimum number of chips required are %d chips'%Chips" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Minimum number of chips required are 13 chips\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11.4, Page 332" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "R=120; #transmission rate in kbps\n", "Hop=2000; #per second\n", "Spectrum=10; #in MHz\n", "\n", "#Calculations&Results\n", "#For 32-FSK\n", "Bits_sym=math.log(32,2);\n", "SR=R/Bits_sym;\n", "print 'Bits per symbol are %d'%Bits_sym\n", "print 'Hops per second are 2000 and Symbol rate is %d kbps'%SR\n", "Sym_hop=SR*10**3/Hop;\n", "Min_BW=Sym_hop*SR;\n", "Nonoverlap_hop=Spectrum*10**3/Min_BW;\n", "print 'Symbols transmitted per hop are %d'%Sym_hop;\n", "print 'Number of non-Overlapping hop frequencies are %d'%(round(Nonoverlap_hop))" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Bits per symbol are 5\n", "Hops per second are 2000 and Symbol rate is 24 kbps\n", "Symbols transmitted per hop are 12\n", "Number of non-Overlapping hop frequencies are 35\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11.5, Page 332" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "R=200;#input data rate in bps\n", "Fhop=200;#per second\n", "k=1;#Multipication_Factor\n", "\n", "#Calculations&Results\n", "# We have 32-FSK modulation scheme\n", "Bits_sym=math.log(32,2);\n", "Rs=Fhop/Bits_sym;\n", "print 'There are 200 hops per second and Symbol rate is %d symbols per sec'%Rs; \n", "\n", "SDur=1/Rs;\n", "L=Fhop/Rs;\n", "CDur=SDur/L;\n", "Separation=1/CDur;\n", "M=2**Bits_sym;\n", "Hop_BW=k*M*Fhop*L;\n", "Gp=M*k*L; \n", "\n", "\n", "print ' Minimum separation between frequency tones should be %d Hz'%Separation;\n", "print ' Number of different frequency tones produced by a frequency synthesizer are %d'%M;\n", "print ' Processing Gain is %d'%Gp;\n", "print 'Hopping bandwidth is %d kHz'%(Hop_BW/1000);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "There are 200 hops per second and Symbol rate is 40 symbols per sec\n", " Minimum separation between frequency tones should be 200 Hz\n", " Number of different frequency tones produced by a frequency synthesizer are 32\n", " Processing Gain is 160\n", "Hopping bandwidth is 32 kHz\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11.6, Page 342" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "M1=[1,0,0,1,1];\n", "\n", "Rx1=[[1,1,1,1,-3,1],[1,-3,1,1,1,1],[1,-3,1,1,1,-3],[1,-3,1,1,1,1],[-1,3,3,-1,3,-1],[1,-1,-1,0,0,0]];#Resultant demodulated signal at mobile(Z(t)) from path1\n", "Rx2=[[-1,-1,1,1,1,1],[-3,1,1,-3,1,1],[1,1,1,-3,1,1],[1,-3,1,-3,1,1],[1,1,-1,3,3,-1],[3,1,-1,0,0,0]];#Resultant demodulated signal at mobile(Z(t-2Tc)) from path2\n", "Rx=Rx1+Rx2; #since,Z(t)=z(t)+Z(t-2Tc)\n", "\n", "#from Figure 11.13 (d) & Figure 11.14\n", "c1=[[-1,-1,-1,-1,1,1],[1,-1,1,1,-1,-1],[1,-1,1,-1,-1,-1],[-1,1,1,1,-1,1],[1,-1,-1,1,-1,1]];\n", "c2=[[-1,1,-1,-1,-1,-1],[1,1,1,-1,1,1],[-1,-1,1,-1,1,-1],[-1,-1,-1,1,1,1],[-1,1,1,-1,-1,1],[-1,1,0,0,0,0]];\n", "\n", "#Calculations&Results\n", "#case-1:Z(t)*C1(t);\n", "for i in range(0,5):\n", " Demod_1=c1[i][0]*Rx[i][0]+c1[i][1]*Rx[i][1]+c1[i][2]*Rx[i][2]+c1[i][3]*Rx[i][3]+c1[i][4]*Rx[i][4]+c1[i][5]*Rx[i][5];\n", " if(Demod_1<0):\n", " B1=1;\n", " else:\n", " B1=0;\n", "\n", "#case-2:Z(t)*C1(t-2Tc);\n", "for j in range(0,5):\n", " Demod_2=c2[j][2]*Rx[j][2]+c2[j][3]*Rx[j][3]+c2[j][4]*Rx[j][4]+c2[j][5]*Rx[j][5]+c2[j+1][0]*Rx[j+1][0]+c2[j+1][1]*Rx[j+1][1]-10\n", " if(Demod_2<0):\n", " B2=1;\n", " else:\n", " B2=0;\n", "\n", "print \"case-1:z(t)*c1(t)\";\n", "print \"Value of integration at end of bit period for mobile(case-1)\",Demod_1\n", "print \"The recovered signal at mobile(case-1) is \",B1\n", "print \"Actual bit values are\",M1\n", "print \"Recovered and actual values are not matching\",\n", "\n", "print \"\\n\\ncase-2:z(t)*c1(t-2Tc)\"\n", "print \"Value of integration at end of bit period for mobile(case-2)\",Demod_2\n", "print \"The recovered signal at mobile(case-2) is \",B2\n", "print \"Actual bit values are\",M1\n", "print \"Recovered and actual values are not matching\",\n", "\n", "#case3-Sum of path1 and path2\n", "print \"\\n\\ncase-3:Sum of path1 & path2 integrator\"\n", "Demod_3=Demod_1+Demod_2;\n", "print \"Sum of integrator outputs(rake receiver output)\",Demod_3\n", "\n", "for k in range(0,5):\n", " if(Demod_3<0):\n", " B3=1;\n", " else:\n", " B3=0;\n", " \n", "print \"Detected bit value \",B3\n", "print \"Actual bit values are\",M1\n", "print \"Recovered and actual values are matching\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "case-1:z(t)*c1(t)\n", "Value of integration at end of bit period for mobile(case-1) -12\n", "The recovered signal at mobile(case-1) is 1\n", "Actual bit values are [1, 0, 0, 1, 1]\n", "Recovered and actual values are not matching \n", "\n", "case-2:z(t)*c1(t-2Tc)\n", "Value of integration at end of bit period for mobile(case-2) -12\n", "The recovered signal at mobile(case-2) is 1\n", "Actual bit values are [1, 0, 0, 1, 1]\n", "Recovered and actual values are not matching \n", "\n", "case-3:Sum of path1 & path2 integrator\n", "Sum of integrator outputs(rake receiver output) -24\n", "Detected bit value 1\n", "Actual bit values are [1, 0, 0, 1, 1]\n", "Recovered and actual values are matching\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11.7, Page 360" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "Prm=-97;#the signal strength from the base stations in dBm\n", "#The constant ( K ) is the part of the broadcast message that is sent to the mobile by the base station on the paging channel.\n", "K=-73; #dB\n", "P2=18; #power as directed by BS (dBm)\n", "\n", "#Calculations&Results\n", "Ptm=K-Prm;\n", "print 'The mobile transmitter power be set as a first approximation of %d dBm'%Ptm\n", "Pwr_Redu=Ptm-P2;#power reduction\n", "print 'Power reduction = %d dBm'%Pwr_Redu\n", "Time=6*1.25;\n", "print 'Time required by mobile station to make changes as directed by base station is %.1f msec'%Time\n", " " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The mobile transmitter power be set as a first approximation of 24 dBm\n", "Power reduction = 6 dBm\n", "Time required by mobile station to make changes as directed by base station is 7.5 msec\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11.8, Page 362" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "P1=-95; #pilot1 in dBm\n", "P2=-100; #pilot2 in dBm\n", "P3=-101; #pilot3 in dBm\n", "P4=-105; #pilot4 in dBm\n", "P5=-102; #pilot in dBm\n", "NoiseP=-107; #Receiver sensitivity(dBm)\n", "Tadd=-13; #dB\n", "\n", "#Calculations&Results\n", "#Pcj = received power of the jth pilot in the candidate set\n", "# Pai= received power of the ith pilot in the active set \n", "Pa1=P1-NoiseP;\n", "Pa2=P2-NoiseP;\n", "Pa3=P3-NoiseP;\n", "Pa4=P4-NoiseP;\n", "Pc5=P5-NoiseP;\n", "\n", "X=10*math.log10(10**(0.1*Pa1)+10**(0.1*Pa2)+10**(0.1*Pa3)+10**(0.1*Pa4)+10**(0.1*Pc5)); \n", "print \"Since P1>P2>P3>P4, we replace P4\"\n", "T_COMP=(P5-P4)/0.5;\n", "print 'The value of T-COMP that could trigger the mobile station to generate a PSMM should be <= %d dB (<= %d)'%(T_COMP,round(10**(0.1*T_COMP)));\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Since P1>P2>P3>P4, we replace P4\n", "The value of T-COMP that could trigger the mobile station to generate a PSMM should be <= 6 dB (<= 4)\n" ] } ], "prompt_number": 8 } ], "metadata": {} } ] }