diff options
author | prashantsinalkar | 2020-04-14 10:19:27 +0530 |
---|---|---|
committer | prashantsinalkar | 2020-04-14 10:23:54 +0530 |
commit | 476705d693c7122d34f9b049fa79b935405c9b49 (patch) | |
tree | 2b1df110e24ff0174830d7f825f43ff1c134d1af /Wireless_Communications_and_Networking_by_V_Garg | |
parent | abb52650288b08a680335531742a7126ad0fb846 (diff) | |
download | all-scilab-tbc-books-ipynb-476705d693c7122d34f9b049fa79b935405c9b49.tar.gz all-scilab-tbc-books-ipynb-476705d693c7122d34f9b049fa79b935405c9b49.tar.bz2 all-scilab-tbc-books-ipynb-476705d693c7122d34f9b049fa79b935405c9b49.zip |
Initial commit
Diffstat (limited to 'Wireless_Communications_and_Networking_by_V_Garg')
16 files changed, 5024 insertions, 0 deletions
diff --git a/Wireless_Communications_and_Networking_by_V_Garg/10-Antennas_Diversity_and_Link_Analysis.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/10-Antennas_Diversity_and_Link_Analysis.ipynb new file mode 100644 index 0000000..da95815 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/10-Antennas_Diversity_and_Link_Analysis.ipynb @@ -0,0 +1,298 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10: Antennas Diversity and Link Analysis" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.1: To_find_received_signal_power_and_SNR_of_antenna.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 10.1\n", +"// To calculate the received signal power at the receiver antenna and the SNR of the received signal.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"D=10000; //in metres\n", +"TxEIRP=30; //Effective Isotropic Radiated Power(EIRP)dBW\n", +"lamda=0.2; //in metres\n", +"Pt=10; //Transmitted power in dBW\n", +"Gt=20; //transmitter gain in dBi\n", +"Gr=3; //receiver gain in dBi\n", +"Lo=6;//total system lossses in dB\n", +"Nf=5; //noise figure in dB\n", +"BW=1.25; //mHz\n", +"k=1.38*10^-23; //Boltzmann constant\n", +"T=290; //temperature in degree kelvin\n", +"\n", +"//solution\n", +"Lp=20*log10(lamda/(4*%pi*D)); //free space loss\n", +"Pr=Lp+Pt+Gt+Gr-Lo;// received power in dBW\n", +"\n", +"No=10*log10(k*T); //Noise density in dBW\n", +"NO=No+30; //factor of '30' to convert from dBW to dBm\n", +"Pn=Nf+10*log10(BW*10^6)+NO;// noise signal power in dBm\n", +"SNR=(Pr+30)-Pn;\n", +"printf('The received signal power is %d dBm\n ',round(Pr+30)); //factor of '30' to convert from dBW to dBm\n", +"printf('SNR is %d dB\n',SNR); " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.2: To_find_received_signal_power_and_SNR_of_antenna.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 10.2\n", +"// To calculate the received signal power at the receiver antenna and the SNR of the received signal.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"//As we have to use data from Eg 10.1, \n", +"D=10000; // in metres\n", +"TxEIRP=30; //Effective Isotropic Radiated Power(EIRP)dBW\n", +"lamda=0.2; //in metres\n", +"Pt=10; //trasmitted power in dBW\n", +"Gt=20; //transmitter gain in dBi\n", +"Gr=3; //receiver gain in dBi\n", +"Lo=6;//total system lossses in dB\n", +"Nf=5; //noise figure in dB\n", +"BW=1.25; //mHz\n", +"k=1.38*10^-23; //Boltzmann constant\n", +"T=290; //temperature in degree kelvin\n", +"//additional data given in this eg\n", +"hr=40; //height of receiver in metre\n", +"ht=2; //trasmittter antenna height in metres\n", +"\n", +"//solution\n", +"Lp=20*log10(hr*ht/D^2);\n", +"Pr=Lp+Pt+Gt+Gr-Lo;// received power in dBW\n", +"No=10*log10(k*T); //Noise density in dBW\n", +"NO=No+30; //factor of '30' to convert from dBW to dBm\n", +"Pn=Nf+10*log10(BW*10^6)+NO;// noise signal power in dBm\n", +"SNR=(Pr+30)-Pn;\n", +"printf('The received signal power is %d dBm\n ',round(Pr+30)); //factor of '30' to convert from dBW to dBm\n", +"printf('SNR is %d dB\n',SNR); " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.3: To_calculate_gain_of_antenna.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 10.3\n", +"// To calculate gain of antenna.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Pin=12; //Input power in watts\n", +"Ploss=3; //resistive losses in Watts\n", +"D=5; //Directivity\n", +"\n", +"//solution\n", +"Eff=(Pin-Ploss)/Pin;\n", +"G=Eff*D;\n", +"printf('Gain of the antenna is %.2f dB = %.2f \n',10*log10(G),G);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.4: To_determine_3dB_beam_width_of_an_antenna.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 10.4\n", +"// To calculate the 3-dB beam width of a linear element antenna.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"G=12; //Gain of antenna in dBi\n", +"\n", +"//solution\n", +"Theta=101.5/10^(G/10);\n", +"printf('The 3-dB beam width of a linear element antenna is %.1f degrees',Theta);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.5: To_calculate_various_parameters_of_helical_antenna.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 10.5\n", +"// To calculate the optimum diameter (DH), spacing (S) for the antenna and total length of the antenna,\n", +"// To calculate the antenna gain, \n", +"// To calculate the beam width of the antenna.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"N=12; //number of turns\n", +"fr=1.8; //frequency in GHz\n", +"\n", +"//solution\n", +"lamda=3*10^8/(fr*10^9);\n", +"DH=lamda/%pi;// diameter of helix in milli-meters\n", +"S=lamda/4;//turn spacing in millimetres\n", +"L=N*S;\n", +"G=15*N*S*(DH*%pi)^2/lamda^3;\n", +"Theta=52*lamda/(%pi*DH)*sqrt(lamda/(N*S));\n", +"printf('The optimim diameter is %d mm\n ',DH*1000);\n", +"printf('Spacing is %.1f mm\n ',S*1000);\n", +"printf('Total Length of antenna is %d mm\n ',L*1000);\n", +"printf('The antenna gain is %.1f dBi\n ',10*log10(G));\n", +"printf('The BeamWidth of antenna is %d degrees \n ',Theta);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.6: EX10_6.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 10.6\n", +"// To find probability that SNR will fall below 10dB(= 10).\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"E0=1000; //average SNR\n", +"Eg=10; //threshold value for SNR\n", +"M=3; //3-Branch Combiner\n", +"e=2.71828; //Euler's number\n", +"\n", +"//solution\n", +"x=Eg/E0;\n", +"P3=(1-e^(-x))^M; //Considering 3-branch selection combiner\n", +"printf('By considering 3-branch selection combiner technique, probability comes to be %d * 10^-6\n ',round(P3*10^6));\n", +"\n", +"disp('When diversity is not used, M =1');\n", +"P1=(1-e^(-x));//M=1;\n", +"printf(' BY not considering diversity technique, probability comes to be %d * 10^-2 \n',round(P1*10^2));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.7: EX10_7.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 10.7\n", +"// To determine the minimum delay difference to successfully resolve the multipath components and operate the Rake receiver\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"SR=3.84; //spreading rate in Mcps\n", +"\n", +"//solution\n", +"disp('In order to resolve multipath components, the chip duration should be equalto or greater than T(tau), where T is defined as ratio of delay distance to speed to electromagnetic wave');\n", +"ChipDur=1/(SR*10^6);\n", +"Speed=3*10^8;\n", +"Dd=ChipDur*Speed;\n", +"disp('');\n", +"printf('Minimum delay distance to successfully resolve the multipath components and operate the Rake receiver is %d m \n',Dd);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/11-Spread_Spectrum_and_CDMA_Systems_.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/11-Spread_Spectrum_and_CDMA_Systems_.ipynb new file mode 100644 index 0000000..3a994b9 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/11-Spread_Spectrum_and_CDMA_Systems_.ipynb @@ -0,0 +1,451 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11: Spread Spectrum and CDMA Systems " + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.1: To_calculate_processing_gain_and_improvemet_in_information_rate_achieved.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 11.1\n", +"// To calculate the processing gain and improvement in information rate.\n", +"\n", +"clc;\n", +"clear all;\n", +"\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", +"//solution\n", +"PG1=10*log10(CR1*10^3/9.6);//Processing Gain for CR1\n", +"R2=CR2*10^3/PG2;//information rate in Kbps for CR2\n", +"printf('The processing gain for clock rate 1.2288Mcps is %d dB\n ',PG1);\n", +"printf('Improvemrnt in information rate is %.2f Kbps\n',R2-R1);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.2: EX11_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 11.2\n", +"// To show that the transmitted signals to mobiles 1, 2, and 3 are recovered at the mobile receivers by despreading the resultant signal z(t).\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"//solution\n", +"disp('From figure 11.4, we note that transmitted data for mobile1 as [0 1 1 0 0 ], for mobile2 as [0 0 1 0 0 ] and for mobile3 as [0 1 0 0 1] ');\n", +"disp('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", +"disp(Rx);\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", +"//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= 1:5\n", +" \n", +"Demod1(i)=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)+c1(i,6)*Rx(i,6);\n", +"if(Demod1(i)<0)\n", +" B1(i)=1;\n", +"else\n", +" B1(i)=0;\n", +" end\n", +"end\n", +"//for mobile 2\n", +"for i= 1:5\n", +" \n", +"Demod2(i)=c2(i,1)*Rx(i,1)+c2(i,2)*Rx(i,2)+c2(i,3)*Rx(i,3)+c2(i,4)*Rx(i,4)+c2(i,5)*Rx(i,5)+c2(i,6)*Rx(i,6);\n", +"if(Demod2(i)<0)\n", +" B2(i)=1;\n", +"else\n", +" B2(i)=0;\n", +" end\n", +"end\n", +"//for mobile 3\n", +"for i= 1:5\n", +" \n", +"Demod3(i)=c3(i,1)*Rx(i,1)+c3(i,2)*Rx(i,2)+c3(i,3)*Rx(i,3)+c3(i,4)*Rx(i,4)+c3(i,5)*Rx(i,5)+c3(i,6)*Rx(i,6);\n", +"if(Demod3(i)<0)\n", +" B3(i)=1;\n", +"else\n", +" B3(i)=0;\n", +" end\n", +"end\n", +"disp('Value of integration at end of bit period for mobile1');\n", +"disp(Demod1');\n", +"disp('Value of integration at end of bit period for mobile2');\n", +"disp(Demod2');\n", +"disp('Value of integration at end of bit period for mobile3');\n", +"disp(Demod3');\n", +"disp('The recovered signal at mobile 1 is ');\n", +"disp(B1');\n", +"disp('The recovered signal at mobile 2 is ');\n", +"disp(B2');\n", +"disp('The recovered signal at mobile 3 is ');\n", +"disp(B3');\n", +"disp('In all cases, Recovered signal is negated value of transmitted signal')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.3: Minimum_number_of_PN_chips_required_for_each_frequency_symbol.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 11.3\n", +"// To find the minimum number of PN chips.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"BW=100; //in MHz\n", +"Fspac=10; //frequency spacing in kHz\n", +"\n", +"//solution\n", +"FreqTones=BW*10^3/Fspac;\n", +"Chips=log2(FreqTones);\n", +"printf('Minimum number of chips required are %d chips \n ',Chips);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.4: EX11_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 11.4\n", +"// To calculate-\n", +"//(a) data symbol transmitted per hop, and \n", +"//(b) the number of nonoverlapping hop frequencies.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"R=120; //transmission rate in kbps\n", +"Hop=2000; //per second\n", +"Spectrum=10; //in MHz\n", +"\n", +"//solution\n", +"//For 32-FSK\n", +"Bits_sym=log2(32);\n", +"SR=R/Bits_sym;\n", +"printf('Bits per symbol are %d \n ',Bits_sym);\n", +"printf('Hops per second are 2000 and Symbol rate is %d kbps\n ',SR);\n", +"disp('Since the symbol rate is higher than the hop rate, the system is a slow FHSS system.');\n", +"Sym_hop=SR*10^3/Hop;\n", +"Min_BW=Sym_hop*SR;\n", +"Nonoverlap_hop=Spectrum*10^3/Min_BW;\n", +"disp('');\n", +"printf(' Symbols transmitted per hop are %d \n ',Sym_hop);\n", +"printf('Number of non-Overlapping hop frequencies are %d \n ',round(Nonoverlap_hop));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.5: To_consider_various_parameters_of_FHSS_systems.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 11.5\n", +"// To Calculate: \n", +"//(a) minimum separation between frequency tones, \n", +"//(b) number of frequency tones produced by a frequency synthesizer,\n", +"//(c) processing gain, and \n", +"//(d) hopping bandwidth. \n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"R=200;//input data rate in bps\n", +"Fhop=200;//per second\n", +"k=1;//Multipication_Factor\n", +"\n", +"//solution\n", +"// We have 32-FSK modulation scheme\n", +"Bits_sym=log2(32);\n", +"Rs=Fhop/Bits_sym;\n", +"printf('There are 200 hops per second and Symbol rate is %d symbols per sec \n',Rs); \n", +"disp('The hop rate is higher than symbol rate, the system is a fast FHSS system.');\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", +"disp('');\n", +"printf(' Minimum separation between frequency tones should be %d Hz\n',Separation);\n", +"printf(' Number of different frequency tones produced by a frequency synthesizer are %d\n',M);\n", +"printf(' Processing Gain is %d\n ',Gp);\n", +"printf('Hopping bandwidth is %d kHz\n',Hop_BW/1000);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.6: To_show_how_mobile1_will_detect_its_information_using_a_two_path_rake_receiver.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 11.6\n", +"// To show how the signal is recovered at mobile by using two-rake receivers.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"//solution\n", +"disp('As we are given that actual bit values for mobile are [1 0 0 1 1] ');\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", +"\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", +"\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", +"//case-1:Z(t)*C1(t);\n", +"for i= 1:5\n", +" \n", +"Demod_1(i)=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)+c1(i,6)*Rx(i,6);\n", +"if(Demod_1(i)<0)\n", +" B1(i)=1;\n", +"else\n", +" B1(i)=0;\n", +" end\n", +"end\n", +"\n", +"//case-2:Z(t)*C1(t-2Tc);\n", +"for j=1:5\n", +"\n", +"Demod_2(j)=c2(j,3)*Rx(j,3)+c2(j,4)*Rx(j,4)+c2(j,5)*Rx(j,5)+c2(j,6)*Rx(j,6)+c2(j+1,1)*Rx(j+1,1)+c2(j+1,2)*Rx(j+1,2);\n", +"if(Demod_2(j)<0)\n", +" B2(j)=1;\n", +"else\n", +" B2(j)=0;\n", +" end\n", +" end\n", +" disp('case-1:z(t)*c1(t)');\n", +"disp('Value of integration at end of bit period for mobile(case-1)');\n", +"disp(Demod_1');\n", +"disp('The recovered signal at mobile(case-1) is ');\n", +"disp(B1');\n", +"disp('Actual bit values are');\n", +"disp(M1);\n", +"disp('Recovered and actual values are not matching');\n", +"disp('case-2:z(t)*c1(t-2Tc)');\n", +"disp('Value of integration at end of bit period for mobile(case-2)');\n", +"disp(Demod_2');\n", +"disp('The recovered signal at mobile(case-2) is ');\n", +"disp(B2');\n", +"disp('Actual bit values are');\n", +"disp(M1);\n", +"disp('Recovered and actual values are not matching');\n", +"//case3-Sum of path1 and path2\n", +"disp('case-3:Sum of path1 & path2 integrator');\n", +"disp('Sum of integrator outputs(rake receiver output)');\n", +"Demod_3=Demod_1+Demod_2;\n", +"disp(Demod_3');\n", +"for k=1:5\n", +"\n", +"if(Demod_3(k)<0)\n", +" B3(k)=1;\n", +"else\n", +" B3(k)=0;\n", +"end\n", +"end\n", +"disp('Detected bit value ');\n", +"disp(B3');\n", +"disp('Actual bit values are');\n", +"disp(M1);\n", +"disp('Recovered and actual values are matching');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.7: To_calculate_the_time_required_by_mobile_to_make_the_required_change.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 11.7\n", +"// To find power value to be set as a first approximation ans time required by mobile station to make changes as directed by base station.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Prm=-97;//the signal strength from the base stations in dBm\n", +"\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", +"//solution\n", +"Ptm=K-Prm;\n", +"printf('The mobile transmitter power be set as a first approximation of %d dBm \n ',Ptm);\n", +"Pwr_Redu=Ptm-P2;//power reduction\n", +"printf('Power reduction = %d dBm \n ',Pwr_Redu);\n", +"disp('Therefore, mobile requires 6 decrements each at 1.25 ms (1/800 sec) ');\n", +"Time=6*1.25;\n", +"printf(' Time required by mobile station to make changes as directed by base station is %.1f msec\n',Time);\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.8: To_determine_the_possible_pair_of_soft_slope_and_add_intercept_values.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 11.8\n", +"// To determine a possible pair of the SOFT-SLOPE and ADD-INTERCEPT values that will trigger the mobile station to send a PSMM to the base station and if the mobile station is IS-95 compliant, find the value of T-COMP that could trigger the mobile station to generate a PSMM.\n", +"\n", +"clc;\n", +"clear all;\n", +"\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", +"//solution\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*log10(10^(0.1*Pa1)+10^(0.1*Pa2)+10^(0.1*Pa3)+10^(0.1*Pa4)+10^(0.1*Pc5)); \n", +"disp('Max {14.22 *(SOFT-SLOPE)+ (ADD-INTERCEPT),-13 }<=5');\n", +"disp('Thus we have two equations as follows');\n", +"disp('14.22*SOFT-SLOPE+ADD-INTERCEPT>=-13 and');\n", +"disp('14.22*SOFT-SLOPE+ADD-INTERCEPT<=5');\n", +"disp(' Solving these equations, we get SOFT-SLOPE= 0.5 and ADD-INTERCEPT=-4');\n", +"disp('For an IS-95-compliant mobile station (Pcj-Pai)>=0.5*T-COMP');\n", +"disp('Since P1>P2>P3>P4, we replace P4');\n", +"T_COMP=(P5-P4)/0.5;\n", +"disp('');\n", +"printf('The value of T-COMP that could trigger the mobile station to generate a PSMM should be <= %d dB (<= %d) .\n ',T_COMP,round(10^(0.1*T_COMP)));\n", +"" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/12-Mobility_Management_in_Wireless_Networks.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/12-Mobility_Management_in_Wireless_Networks.ipynb new file mode 100644 index 0000000..4a7ce1d --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/12-Mobility_Management_in_Wireless_Networks.ipynb @@ -0,0 +1,98 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12: Mobility Management in Wireless Networks" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12.1: EX12_1.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 12.1\n", +"// To evaluate the impact of LUs on the radio resource and calculate the MSC/VLR transaction load using the fluid flow model.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"P=10000; //Mobile density(mobiles/km^2)\n", +"R=500*10^-3; //km\n", +"V=10; ..//Average moving velocity of a mobile in Kmph\n", +"Nc=10; //No of cells per LA\n", +"N_LA=5; //Number of LAs per MSC/VLR \n", +"\n", +"//Number of transactions and duration of each transaction to MSC/VLR per LU for different LU types are given in Table 12.1.(page no.374)\n", +"\n", +"// solution\n", +"// L=length (km) of the cell exposed perimeter in an LA\n", +"L=6*R*(1/3+1/(2*sqrt(Nc)-3)); //Km\n", +"// lamdaLU=number of transactions processed by MSC/VLR in an LA perimeter of the jth cell per hour\n", +"LamdaLu=V*P*L/%pi; //Lus per hour\n", +"\n", +"\n", +"// case(1)\n", +"disp('Case-1:In the first case, the jth cell located at the border of two LAs is related to the same MSC/VLR, only intra-VLR LUs are processed in the cell');\n", +"R1_LU=LamdaLu/3600*(1*600/1000); //resource occupancy from Table 12.1\n", +"disp('');\n", +"printf(' The resource occupancy in the jth cell due to MS LUs is %.1f Erlangs\n',R1_LU);\n", +"\n", +"disp('This requires 18 channels at 1% blocking (refer to the Erlang-B table, Appendix A) or 18/8 =2.25 traffic channel (about 1/4 of an RF channel, assuming there are 8 traffic channels per RF channel). ')\n", +" \n", +"//case(2)\n", +"disp('case-2:In this case the jth cell is located at the border of two LAs related to two different VLRs.In this case, only inter-VLR LUs will be processed in the cell. We assume 80% of LUs are with TMSI and 20% of LUs are with IMSI');\n", +"R2_LU=LamdaLu/3600*(0.8*3500/1000+0.2*4000/1000); //from Table 12.1\n", +"disp('');\n", +"printf(' The resource occupancy in the jth cell due to MS LUs is %.2f Erlangs \n',R2_LU);\n", +"disp('This requires 75 channels at 1% blocking (refer to the Erlang-B table, Appendix A) or 75/8=9.38 traffic channels (about 1.25 RF channels).');\n", +"\n", +"\n", +"disp('MSC/VLR transaction load');\n", +"\n", +"disp('We assume that one LA is in the center of the region and the remaining four LAs are on the border of the region.We also assume that, in the perimeter cells at the border LAs, only intra-VLR LUs are generated. For half of the perimeter cells at the border LAs, only inter-VLR LUs are generated.')\n", +"\n", +"Np=6*sqrt(Nc/3)-3;//Number of cells located on perimeter of an LA\n", +"disp('');\n", +"printf(' Number of cells where inter-VLR LUs occur will be: %d \n',round(0.5*Np*4));\n", +"disp('');\n", +"printf(' Number of cells where intra-VLR LUs occur will be: %d \n',4*Nc-16);\n", +"disp('');\n", +"TNLU=LamdaLu*(2*24+16*(0.8*14+0.2*16)); //from table 12.1\n", +"printf(' The MSC/VLR transaction load using the fluid flow model is %.2f * 10^6 transactions at peak hour \n',TNLU/10^6);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/13-Security_in_Wireless_Systems.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/13-Security_in_Wireless_Systems.ipynb new file mode 100644 index 0000000..05f988a --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/13-Security_in_Wireless_Systems.ipynb @@ -0,0 +1,108 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13: Security in Wireless Systems" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.1: To_generate_public_and_private_keys_for_RSA_algorithm.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 13.1\n", +"// To generate public and private keys for RSA algorithm.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"//Two prime numbers\n", +"p=5;\n", +"q=7;\n", +"\n", +"//solution\n", +"n=p*q;\n", +"z=(p-1)*(q-1);\n", +"e=input('Choose _e_such that 1<e<z and e and n are coprime= ');\n", +"d=input('Choose _d_ such that e*d-1 should be exactly divisible by z= ');\n", +"printf('Public keys is (%d, %d)\n',n,e);\n", +"printf('Private key is (%d, %d)\n',n,d);\n", +"\n", +"//Results\n", +"//Choose _e_such that 1<e<z and e and n are coprime= 5\n", +"//Choose _d_ such that e*d-1 should be exactly divisible by z= 29\n", +"//Public keys is (35, 5)\n", +"//Private key is (35, 29)\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.2: To_determine_the_secret_encrypting_key_K_using_DH_key_exchange_algorithm.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 13.2\n", +"// To determine secret encrypting key K using DH key exchange algorithm.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"p=23; //prime number that both parties agreed upon\n", +"g=5;// g is primitive mod p\n", +"a=6; //party A choosen number\n", +"b=15; //party B choosen number\n", +"\n", +"//solution\n", +"printf('Party A sends to party B as (g^a mod p) = %d \n',modulo(g^a,23));\n", +"printf(' Party B sends to party A as (g^b mod p) = %d \n',modulo(g^b,23));\n", +"printf(' Party A computes secret key as ((g^b modp)^a mod p) = %d \n',modulo(modulo(g^b,23)^a,p));\n", +"printf(' Party B computes secret key as ((g^a modp)^b mod p) = %d \n',modulo(modulo(g^a,23)^b,p));\n", +"disp('Thus both parties uses k=2 as secret key for encryption');" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/14-Mobile_Network_and_Transport_Layer.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/14-Mobile_Network_and_Transport_Layer.ipynb new file mode 100644 index 0000000..f1af126 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/14-Mobile_Network_and_Transport_Layer.ipynb @@ -0,0 +1,100 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14: Mobile Network and Transport Layer" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.1: To_determine_minimum_possible_latency_and_window_size_to_achieve_this_latency.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 14.1\n", +"// To determine the minimum possible latency amd the minimum window size that achieves this latency.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"O=800*1000; //Object size(Bytes)\n", +"S=536*8; //max Segment Size(in bits)\n", +"RTT=0.1; //Round trip-time in sec\n", +"R=1*10^6; //Transmission rate of the link from the server to the client in bps\n", +"\n", +"//solution\n", +"Lmin=2*RTT+(O/R); //latency(msec)\n", +"// For minimum latency (S/R) +RTT -(W*S/R) = 0;Therefore\n", +"W=1+(RTT)/(S/R);\n", +"printf('The minimum possible latency is %d sec \n',Lmin);\n", +"printf(' The minimum window size is %.1f segments \n',W);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14.2: EX14_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 14.2\n", +"// To determine the upper bound of the throughput and the throughput with retransmissions due to errors.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"RTT=0.1; //Round trip-time in sec\n", +"MSS=536*8; //Maximum segment size in bits\n", +"p=0.01;// packet loss probability for the path\n", +"RTO=5*RTT; //Retransmission time out(from eqn 14.2 on page 450)\n", +"\n", +"//solution\n", +"R=0.93*MSS/(RTT*sqrt(p));\n", +"RR=MSS/(RTT*sqrt(1.33*p)+RTO*p*(1+32*p^2)*min(1,3*sqrt(0.75*p)));\n", +"printf('The upper bound of the throughput is %.4f Mbps \n',R*10^-6);\n", +"printf(' The throughput with retransmission due to errors is %.4f Mbps \n',RR*10^-6);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/17-Planning_and_Design_of_a_Wireless_Network.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/17-Planning_and_Design_of_a_Wireless_Network.ipynb new file mode 100644 index 0000000..5db9344 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/17-Planning_and_Design_of_a_Wireless_Network.ipynb @@ -0,0 +1,703 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17: Planning and Design of a Wireless Network" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.10: To_find_the_number_of_users_supported_on_the_downlink_of_a_WCDMA_Network.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 17.10\n", +"//To calculate No of users that can be supported on the downlink of the WCDMA network.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Rc=3.84;//chip rate in Mcps\n", +"N=3;//Noise rise in dB\n", +"OF=0.8;//orthogonality factor\n", +"B=0.55;//Interference from other cells \n", +"Eb_N0=4;//in dB\n", +"Sec_Eff=0.85;//Sector efficiency\n", +"Pwr_Eff=0.80;//Power control efficiency\n", +"Y=1.2; //Retransmit rate\n", +"X=10; //10MB at 384Kbps\n", +"X1=2; //2MB at 144Kbps\n", +"X2=1; //1MB at 64Kbps\n", +"\n", +"//solution\n", +"//Assuming Voice activity=Vf=1\n", +"Vf=1;\n", +"AvgDR=Y*X*10^6*(1/3600)+Y*X1*10^6*(1/3600)+Y*X2*10^6*(1/3600);\n", +"CLoad=(N-1)/(N+1);\n", +"DLcap=(Rc*10^6*Pwr_Eff*Sec_Eff)/(((10^(Eb_N0/10))*(B+OF)*Vf));\n", +"Allowcap=CLoad*DLcap;\n", +"users=Allowcap/AvgDR;\n", +"printf('NO of users that can be supported on the downlink of the WCDMA network are %d \n ',round(users));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.11: find_the_average_throughput_for_various_cases.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.11\n", +"// To calculate average throughput and compare it with equal latency condition.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"P1=1/2;//relative frequency of packets for user class1 \n", +"P2=1/3;//relative frequency of packets for user class2\n", +"P3=1/6;//relative frequency of packets for user class3\n", +"R1=16; //data rate in kbps for P1\n", +"R2=64; //data rate in kbps for P2\n", +"R3=1024; //data rate in kbps for P3\n", +"S1=16;//number of slots assigned to the R1 user\n", +"S2=8;//number of slots assigned to the R2 user\n", +"S3=2;//number of slots assigned to the R3 user\n", +"\n", +"//solution\n", +"//Using Equation 17.20 from page no 616\n", +"Ravg=(P1*R1*S1+P2*R2*S2+P3*R3*S3)/(P1*S1+P2*S2+P3*S3);\n", +"// For equal latency, using Eq 17.18\n", +"Rav=1/(P1/R1+P2/R2+P3/R3);\n", +"// For Latency ratio=4, using Eq 17.19 from page no 616\n", +"PL=4;\n", +"C=(P1+P2+PL*P3)/(P1/R1+P2/R2+P3/R3);\n", +"printf('The average throughput for equal access condition is %.1f kbps \n ',Ravg);\n", +"printf('The average throughput by considering equal latency is %.1f kbps \n ',Rav);\n", +"printf('The average throughput by considering latency ratio as 4 is %.2f kkbps \n ',C)\n", +"disp('Ii is observed that equal access provides the highest average output')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.12: TO_find_the_allowable_throughput_of_a_reverse_link_of_a_CDMA_2000.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.12\n", +"// To calculate allowable throughput of reverse link in cdma 2000.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Ec_Nt=-23;//in dB\n", +"DRC=-1.5;//DRC gain with respect to pilot in dB\n", +"Tg=3.75; // Traffic channel gain with respect to pilot in dB\n", +"B=0.85;//Interference factor due to other cells \n", +"\n", +"//solution\n", +"Mmax=(1/(1+10^(DRC/10)+10^(Tg/10)))*(1/((10^(Ec_Nt/10)*(1+B))));\n", +"//The sector loading can be expressed as a fraction of the pole capacity Mmax. This is typically 70% of the pole capacity. \n", +"M_allow=int(0.7*Mmax);\n", +"//From table 17.2 we get Traffic channel rate as 9.6kbps since we are given traffic channel gain with respect to pilot as 3.75 dB\n", +"Ri=9.6; //in kbps(see table 17.2)\n", +"Tput=Ri*M_allow;\n", +"printf(' Allowable reverse link throughput is %d kbps \n ',round(Tput));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.13: To_estimate_average_SINR_of_a_HSDPA.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.13\n", +"// To calculate average SINR of HSDPA.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Ptmax=5.5;//Maximum transmit power of DSCH in watts\n", +"Pbs=18;// Total base station power in watts\n", +"alpha=0.2;//downlink orthogonality factor \n", +"G=0.363;// geometry factor\n", +"SF=16; //Spreading Factor for DSCH;fixed at value of 16\n", +"\n", +"//solution\n", +"// Using equation no 17.27 given on page no 623\n", +"SINR=SF*(Ptmax/(Pbs*(1-alpha+(1/G))));\n", +"// In dB\n", +"SINR_db=10*log10(SINR);\n", +"\n", +"printf('The average SINR of HSDPA is %.1f dB = %.4f \n ',SINR_db,SINR);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.14: To_find_bandwidth_of_a_Iub_interface.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.15\n", +"// To calculate bandwidth of Iub interface.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Users=350;//no of users supported\n", +"ExpectedTraf=1.8; // From section 17.7 (in Kbps)\n", +"BHTraf=1.785;//Busy hour traffic in kbps\n", +"BTS=180;\n", +"\n", +"//solution\n", +"IubBW=(ExpectedTraf*Users*BHTraf)/1000; // in Mbps\n", +"TotalBW=BTS*IubBW;\n", +"printf('Required total bandwidth of Iub Interface is %.2f Mbps \n ',TotalBW);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.15: To_find_the_required_RNCs.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.15\n", +"// To calculate No of RNC required.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"BTS=800;//No of BTS sites\n", +"Sec=3;//No of sectors per BTS\n", +"freq_sec=2;//No of frequencies used per sector\n", +"cellsRNC=1152;//Maximum capacity of cellRNC\n", +"btsRNC=384;//One RNC can support btsRNC(BTSs)\n", +"VE=25;//Voice service(mErl/subscriber)\n", +"BRV=16;// bitrate Voice\n", +"CS1=10;//CS data service 1(mErl/subscriber)\n", +"BRC1=32;//bit rate for CS1 in kbps\n", +"CS2=5;//CS data service 2(mErl/subscriber)\n", +"BRC2=64;////bit rate for CS2 in kbps\n", +"PSdata=0.2;//PS data service(kbps per subscriber)\n", +"PSoverhead=0.15;\n", +"SHO=0.4;//40%\n", +"Totalsub=350000;//Total subsribers\n", +"Maxcap=196;//Maximum Iub capacity of tpRNC (in Mbps)\n", +"FR1=0.9;FR2=0.9;FR3=0.9;//Filler rates\n", +"\n", +"//solution\n", +"RNCreqd=(BTS*Sec*freq_sec)/(cellsRNC*FR1);//from eqn 17.28\n", +"printf('using equation 17.28,Number of RNC required are %d \n ',round(RNCreqd));\n", +"RNC_reqd=BTS/(btsRNC*FR2);//from eqn 17.29\n", +"printf('using equation 17.29,Number of RNC required are %d \n ',round(RNC_reqd));\n", +"RNCrequired=((VE/1000*BRV+CS1/1000*BRC1+CS2/1000*BRC2+(PSdata/(1-PSoverhead)))*(1+SHO)*Totalsub)/(Maxcap*1000*FR3);//from eqn 17.30\n", +"printf('using equation 17.30,Number of RNC required are %d \n ',round(RNCrequired));\n", +"\n", +"printf(' We select first value which is %d RNCs \n ',round(RNCreqd));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.1: To_calculate_various_parameters_for_GSM_1800_network.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.1\n", +"//To calculate-\n", +"//(a) average busy-hour traffic per subscriber,\n", +"//(b) traffic capacity per cell,\n", +"//(c) required number of base stations per zone, and\n", +"//(d) the hexagonal cell radius for the zone. \n", +"\n", +" clc;\n", +" clear all;\n", +" \n", +" Susage=150;//subscriber usage per month in mins\n", +" days=24;//days per month\n", +" busyhrs=6;//in a day\n", +" BW=4.8*10^3; //in kHz\n", +" Freqreuse=4/12;//Frequency reuse plan\n", +" chwidth=200; //in kHz\n", +" subscriber=50000;//Present subscriber count\n", +" Sgrowth=0.05;//Growth rate per year\n", +" Area=500; //in km\n", +" BTScapacity=30; //in Erlangs\n", +" N=4; //Initial installation design years\n", +" \n", +" //solution\n", +" Erlangspersub=Susage/(days*busyhrs*60);\n", +" printf('Average busy-hour traffic per subscriber is %.4f Erlangs \n ',Erlangspersub);\n", +" RFcarriers=BW/chwidth;\n", +" RFcarrier_percell=RFcarriers/((Freqreuse^-1)*4); //freq reuse factor of 4\n", +"\n", +"//Assuming 2 control channels per cell\n", +"CC=2;//control channels\n", +"TC_percell=2*RFcarriers/3-CC;\n", +"//Referring Erlang-B table in Appendix A\n", +"disp('Referring Erlang-B table in Appendix A,Traffic capacity of a GSM cell at 2% GoS for 14 channels = 8.2 Erlangs ');\n", +"Tcapacity=8.2;// in Erlangs\n", +"disp('There are 3 cells per BTS');\n", +"BTS=3;\n", +"Traffic_perBTS=Tcapacity*BTS;\n", +"printf(' Traffic capacity per BTS is %.1f Erlangs ',Traffic_perBTS);\n", +"disp('Therefore, Traffic per BTS is less than BTS capacity(30 Erlangs)')\n", +"maxsubscriber=Traffic_perBTS/Erlangspersub;\n", +"initialsub=subscriber*(1+Sgrowth)^N;\n", +"BTS_perZone=initialsub/maxsubscriber;\n", +"printf(' The required number of base stations per zone are %d \n ',round(BTS_perZone));\n", +"cellRadius=(Area/(BTS_perZone*2.6))^0.5;\n", +"printf('The hexagonal cell radius is %.1f km \n ',cellRadius);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.2: To_estimate_the_data_and_voice_traffic_per_subscriber_and_per_cell.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.2 \n", +"// To calculate voice and data traffic per cell.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"usage=150; //subscriber usage per month in mins\n", +"days=24;//Days in a month\n", +"BHrs=6;//Busy hours per day\n", +"BW=4.8; //in MHz\n", +"RFch=200; //in kHz\n", +"Psubscribers=50000;//present subscriber count\n", +"growth=0.05;//subscriber growth per year\n", +"rollover=4;//network roll over period\n", +"NPCS=5;//Number of packet calls per session \n", +"NPP=25;//Number of packets within a packet call \n", +"Tr=120;//Reading time between packet calls(sec)\n", +"NBP=480*8;//Packet size(in bits)\n", +"Tint=0.01;//Time interval between two packets(sec)\n", +"Ttot=3000;//Total packet service holding time\n", +"BH_PS=0.15;//Busy hour packet sessions per subscriber\n", +"Penetration=0.25;\n", +"datarate=48; //in kbps\n", +"PTT=10;//Packet transmission time(sec)\n", +"BTS=40;//NO of BTS sites\n", +"\n", +"//solution\n", +"Bitstx_duringPTT=NPCS*NPP*NBP/1000; \n", +"PST=PTT+Tr*(NPCS-1)+Tint*(NPP-1);\n", +"PT_duringBH=BH_PS*Ttot/PST;\n", +"Bits_persub_persec=Bitstx_duringPTT*PT_duringBH/(60*60);\n", +"VoiceErlangs=usage/(days*BHrs*60);\n", +"Initial_subscribers=round(Psubscribers*(1+growth)^rollover);\n", +"Data_subscribers=Initial_subscribers*Penetration;\n", +"Totalvoice=Initial_subscribers*VoiceErlangs;\n", +"Voicetraffic_perBTS=Totalvoice/BTS;\n", +"printf('Voice Traffic per Cell(sector) is %.2f Erlangs \n ',Voicetraffic_perBTS/3);\n", +"Totaldata=Data_subscribers*Bits_persub_persec;\n", +"Datathroughput_perBTS=Totaldata/BTS;\n", +"printf('Data throughput per Cell(sector) is %.2f kbps \n ',Datathroughput_perBTS/3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.3: To_calculate_data_Erlangs_along_with_TS_utilization_and_capacity.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.3\n", +"//Using traffic data per cell for a GSM/GPRS network from Example 17.2\n", +"// To calculate-\n", +"// (a) data Erlangs,\n", +"// (b) time slot utilization, and\n", +"// (c) TS capacity.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Holdtime=120;//Average holding time during Busy Hours(in sec)\n", +"Tx=3;// No of transreceivers\n", +"TSsig=3;//No of TSs per cell for signaling\n", +"RLC=0.80;//Radio link control efficiency\n", +"Radioblocks=9000;//Total numbers of transmitted radio blocks\n", +"TSdata=3;//TSs allocated for data traffic per cell\n", +"Datarate=15.5; //From eg 17.2\n", +"Voicetraffic=8.82; //From eg.17.2\n", +"Duration=0.02;//Duration of block in sec\n", +"\n", +"//solution\n", +"DataEr=Radioblocks*Duration/Holdtime;\n", +"printf('Data Erlangs = %.1f \n ',DataEr);\n", +"TSuti=DataEr/TSsig;\n", +"printf('Time Slot(TS) utilization = %.1f \n ',TSuti);\n", +"Throughput=(Datarate/TSdata)*RLC;\n", +"TScap=Throughput/TSuti;\n", +"printf('TS capacity is %.2f kbps \n ',TScap);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.4: To_develop_downlink_and_uplink_cell_budget_and_calculate_cell_radius.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.4\n", +"//To calculate the cell radius.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Pt=36;//Base station transmitted power in dBm\n", +"Pms=24;//mobile station transmitted power in dBm\n", +"Nms=8;//mobile station noise figure in dB\n", +"Nbs=5;//Base station nise figure in dB\n", +"Ga=18;//Base station transmit and receive antenna gain in dBi\n", +"Gm=0;//Mobile antenna gain in dBi\n", +"SNR=12;// in dB\n", +"Lc_TX=5;//BS transmit antenna cable, connector, and filter losses in dB\n", +"Lc_RX=2;//BS receiver antenna cable, connector, and filter losses in dB\n", +"Bodyloss=3;// Body losses at mobile\n", +"fading=10.2;// in dB\n", +"ThermalNoise=-174;// in dBm/Hz\n", +"Gdiversity=5;//Antenna diversity gain at BS in dB\n", +"//Assuming standard value of RF channel as \n", +"RFch=200*10^3; //in Hz\n", +"\n", +"//solution\n", +"N=ThermalNoise+10*log10(RFch)+Nms;\n", +"Smin=N+SNR;\n", +"Smean=Smin+fading+Bodyloss;\n", +"Lp=Pt-Lc_TX+Ga-Smean;\n", +"N1=ThermalNoise+10*log10(RFch)+Nbs;\n", +"Smin=N1+SNR-Gdiversity;\n", +"Smean1=Smin+fading+Bodyloss;\n", +"Lp1=Pms-Smean1+Ga-Lc_RX;\n", +"disp('Using uplink path loss and Hata model to calculate cell radius');\n", +"R=10^((Lp1-133.2)/33.8);\n", +"printf(' Cell radius is %.1f km \n',R);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.5: To_calculate_Uplink_cell_load_factor_and_pole_capacity.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.5\n", +"// To calculate uplink cell load factor, number of voice users and poll capacity of the cell.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Ri=12.2*10^3;//Information rate in bps\n", +"Rc=3.84*10^6;//Chip rate in cps(chips per second)\n", +"Eb_Nt=4; //in dB\n", +"Imargin=2; //Interference margin(3 dB)\n", +"B=0.5;//Interference factor due to other cells\n", +"Vi=0.65;//Channel activity factor\n", +"\n", +"//solution\n", +"Eb_Ntreqd=10^(Eb_Nt/10);\n", +"LF_peruser=(1+B)*(1/(1+(Rc/Ri)*(1/Eb_Ntreqd)*(1/Vi))); //M(no of users=1) in Eq 17.13\n", +"printf('Cell load factor per voice user is %.5f \n ',LF_peruser);\n", +"CellLoading=(Imargin-1)/Imargin;\n", +"VoiceUsers=CellLoading/LF_peruser;\n", +"printf('No of Voice Users are %d per cell \n ',VoiceUsers);\n", +"//From EQ 17.6 assuming Power control efficiency=1\n", +"Polecap=Rc/(Ri*Vi*(1+B)*Eb_Ntreqd);\n", +"printf('Pole Capacity is %d \n',Polecap);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.6: To_calculate_uplink_throughput_for_WCDMA_data_service.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.6\n", +"// To calculate Uplink throughput for a WCDMA cell.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Eb_Nt=1; //in dB\n", +"cellLoading=0.5;//Required interference margin(3 dB)\n", +"B=0.5;//Interference factor due to other cells\n", +"Vi=1;//Channel activity factor\n", +"\n", +"//solution\n", +"Eb_Ntreqd=10^(Eb_Nt/10);\n", +"//Assuming standard value of chip rate as 3.84Mcps\n", +"Rc=3.84*10^6;//in cps(chips per second)\n", +"Throughput=(cellLoading*Rc)/(Eb_Ntreqd*(1+B));\n", +"printf('Uplink Throughput is %d kbps \n ',Throughput/1000);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.7: To_calculate_downlink_cell_load_factor_and_number_of_voice_users_per_cell.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.7\n", +"// To calculate downlink cell load-factor and number of voice users per cell for a WCDMA system.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Ri=12.2*10^3;//Information rate in bps\n", +"Rc=3.84*10^6;// Chip rate in chips per second\n", +"Eb_Nt=4; // in dB\n", +"Eb_Nt=10^(Eb_Nt/10);\n", +"B=0.5;//Average interference factor due to other cells\n", +"Zeta=0.6; // orthogonality factor\n", +"Imargin=2;//Interference margin(3 dB)\n", +"Vi=0.65 //assuming Channel activity factor as 0.65\n", +"\n", +"//solution\n", +"Loadfactor_peruser=(Zeta+B)*(1/((Rc/Ri)*(1/Eb_Nt)*(1/Vi)))\n", +"printf('Downlink cell load factor is %.4f \n ',Loadfactor_peruser);\n", +"cellLoading=(Imargin-1)/Imargin;\n", +"Voiceusers=cellLoading/Loadfactor_peruser;\n", +"printf('No of voice users per cell are %d \n ',Voiceusers);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.8: To_determine_minimum_signal_power_and_maximum_allowable_path_loss.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 17.8\n", +"// To calculate minimum signal power required and maximum allowable path loss.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"N0=-174;//Noise density in dBm/Hz\n", +"Bc=1.25;//Channel bandwidth in mHz\n", +"Rc=1.2288;//Chip rate in Mcps\n", +"Nf=6; //Receiver Noise figure in dB\n", +"Pt=27; //Effective radiated power from mobile in dBm\n", +"Lct=0.5; //Transmitter cable and connector loss in dBm\n", +"Lbody=1.5;//Body loss in dB\n", +"Lcr=2; //Receiver cable and connector loss in dB\n", +"Mint=0; //Interference margin in dB\n", +"Mfading=2;//fast fadinf margin in dB\n", +"Lpent=8;//Penetration loss in dB\n", +"Gm=0;//Transmitter antennna gain in dBi\n", +"Gb=12;//Receiver antenna gain in dBi\n", +"Fm=8;//Fade margin in dB\n", +"Eb_Nt=7;// in dB\n", +"\n", +"//solution\n", +"Nth=N0+Nf;\n", +"S_Nt=Eb_Nt+10*log10((Rc*10^6)/(Bc*10^6));\n", +"Smin=S_Nt+10*log10(Rc*10^6)+Nth;\n", +"Lpmax=(Pt-Smin)+(Gb+Gm)-(Lbody+Lct+Lcr+Fm+Lpent)-Mint-Mfading;\n", +"printf('Minimum signal power required is %.2f dBm \n ',Smin);\n", +"printf('Maximum allowable path loss is %.2f dB \n ',Lpmax);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17.9: To_develop_a_radio_link_budget_for_uplink_and_downlink.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 17.9\n", +"// To calculate Radio link budget for uplink and downlink\n", +"// Refering Table 17.1 on page no 613\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Rc=3.84;//Chip rate in Mcps\n", +"Ri=16;//Data rate in kbps\n", +"UL=0.5;//UL loading factor\n", +"DL=0.9;//DL loading factor\n", +"Eb_NtU=4;//in dB\n", +"Eb_NtD=6;// in dB\n", +"Gm=0;//Mobile antenna gain in dBi\n", +"Gb=18;//Base station gain in dBi\n", +"\n", +"//solution\n", +"disp('The Okumara-Hata model for an urban macro-cell with a base station antenna height of 25m, a mobile station height of 1.5m, and a carrier frequency of 1950MHz gives Lp =138.5+35.7*log10(R) where R is radius of hexagonal cell');\n", +"disp('From table 17.1, Lp(Allowable path loss) for uplink is 139.65 dB');\n", +"R=10^((139.65-138.5)/35.7);\n", +"printf(' Cell Radius is %.3f km \n ',R);\n", +"Area=round(2.6*R^2);\n", +"printf('Area covered by hexagonal cell is %d km^2 \n ',Area);\n", +"printf('Number of BTSs required to cover an area of 2400 Km^2 are %d \n ',2400/Area);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/19-Wireless_Personal_Area_Network_Bluetooth.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/19-Wireless_Personal_Area_Network_Bluetooth.ipynb new file mode 100644 index 0000000..9858ee8 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/19-Wireless_Personal_Area_Network_Bluetooth.ipynb @@ -0,0 +1,102 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 19: Wireless Personal Area Network Bluetooth" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19.1: To_find_hopping_rate_and_various_other_parameters_of_Bluetooth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 19.1\n", +"// To calculate the hopping rate of bluetooth, No of bits transmitted in one slot, efficiency of packet transmission, and No of times a packet is sent.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"SS=80; //Frame length of HV3 voice packet\n", +"R=64*10^3; //Data rate in bps\n", +"\n", +"//solution\n", +"TS=240; //No of bits carried in a slot\n", +"//From table 19.3:Bluetooth air interface details, we get Frequency hopping rate as 1600hopes/second\n", +"\n", +"//From table 19.5, we can note that for HV3, No of slots are 1 and carry in all(80(user voice sample)+160(parity bits))=240 bits in one slot packet\n", +"HR=1600; //hopes/second\n", +"Eff=SS/TS;\n", +"x=R/SS; //x is number of times a packet is sent\n", +"printf('Hopping rate is %d hopes/sec \n ',HR);\n", +"printf('No of bits transmitted in one slot are %d \n ',TS);\n", +"printf('Efficiency of packet transmission is %.4f \n ',Eff);\n", +"printf('Number of times a packet is sent is equal to %d \n ',x);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19.2: To_find_the_associated_data_rate_of_a_symmetric_1soot_DM1.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 19.2\n", +"// To find the associated data rate.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"R=136; // bits per slot\n", +"SR=800; // no of slots per second\n", +"\n", +"//solution\n", +"// A symmetric 1-slot DM1 link is setup between a master and a slave\n", +"AR=R*SR; //Data rate in bps\n", +"\n", +"printf('Associated data rate is %0.1f kbps \n ',AR/1000);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/2-Multiple_Access_Techniques.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/2-Multiple_Access_Techniques.ipynb new file mode 100644 index 0000000..94ffb01 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/2-Multiple_Access_Techniques.ipynb @@ -0,0 +1,477 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2: Multiple Access Techniques" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.10: To_find_the_designed_cell_capacity_for_the_switch_and_design_Erlangs.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa_2.10 \n", +"// TO find ABS/BH(average busy season per busy hour) calling rates, design cell capacity for the switch and design Erlangs.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Rlines=15000;//Residential lines\n", +"Blines=80000;//Business lines\n", +"PWElines=5000;//PBX, WATS, and Foreign Exchange (FX) lines\n", +"CR_R=2;//Call rates for Rlines\n", +"CR_B=3;// call rates for Blines\n", +"CR_PWE=10;//call rates for PWElines\n", +"HT_R=140;//average holding time for Rlines(sec)\n", +"HT_B=160;//average holding time for Blines(sec)\n", +"HT_PWE=200;//average holding time for PWE lines(sec)\n", +"Slines=100000;// no of lines carried by switch\n", +"HD_ABS=1.5;// HD/ABS for the switch\n", +"\n", +"//solution\n", +"percentR_lines=Rlines/Slines;\n", +"percentB_lines=Blines/Slines;\n", +"percentPWE_lines=PWElines/Slines;\n", +"CCSR=CR_R*HT_R/100;\n", +"CCSB=CR_B*HT_B/100;\n", +"CCSPWE=CR_PWE*HT_PWE/100;\n", +"\n", +"CR=CR_R*percentR_lines+CR_B*percentB_lines+CR_PWE*percentPWE_lines;\n", +"printf('The call rate is %.1f calls per line \n ',CR);\n", +"CCS=CCSR*percentR_lines+CCSB*percentB_lines+CCSPWE*percentPWE_lines;\n", +"AvgHTperline=CCS*100/CR;\n", +"ABS_BH_calls=CR*Slines;\n", +"ABS_BH_usage=CCS/36*Slines;\n", +"printf('Design cell capacity based on HD is %d calls \n',HD_ABS*ABS_BH_calls);\n", +"printf(' DESIGN Erlangs based on HD is %d \n',round(HD_ABS*ABS_BH_usage)); " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.11: To_find_number_of_service_channels_required_to_handle_the_load.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 2.11\n", +"// To find offered load A and number of service channels required to handle the load\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"maxcalls_hour=4000;//maximum call per hour\n", +"avgHT=160;//average holding time in sec\n", +"Gos=0.02;\n", +"\n", +"//solution\n", +"A=maxcalls_hour*avgHT/3600; //offered load\n", +"printf('Offered load A = %.2f Erlangs \n ',A);\n", +"//Refering Appendix A i.e Erlang B table \n", +"disp('For calculated Offered load and referring Erlang B table we get Service channels as 182 giving 168.3 Erlangs at 2% blocking');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.12: To_find_the_number_of_supported_mobile_subscribers.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 2.12\n", +"// To calculate number of mobile subscribers supported for the given system.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"channels=50;\n", +"blocking=0.02;\n", +"HT=120;//average holding time inm sec\n", +"BHcall=1.2;// in calls per hour\n", +"\n", +"//solution\n", +"//Refering Erlang B table in appendix A, For 50 channels at 2% blocking, the offered load=40.26 Erlangs.\n", +"A=40.26;\n", +"B=A*(1-0.02); //carried load\n", +"Avgtraffic_user=BHcall*HT/3600;\n", +"No_users=B/Avgtraffic_user;\n", +"printf('NO of mobile subscribers supported are %d \n',round(No_users));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.1: To_get_Gos_during_Busy_Hour.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 2.1\n", +"// TO get Gos during BH(Busy Hour).\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"LC=10; //Lost calls\n", +"CC=380; //Carried calls\n", +"\n", +"// soution\n", +"OC=LC+CC; //Total offered calls\n", +"//Gos=Blocking probability=(number of Lost calls/Total number of offered calls)\n", +"Gos=LC/OC;\n", +"printf('The Gos during busy hour is %f \n ', Gos);\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2: To_find_usage_in_CCS_and_Erlangs.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 2.2\n", +"// To find usage in call-seconds,CCS(centrum call seconds) and Erlangs).\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Ht=5; //Average holding time in seconds\n", +"PC=450; // Peg count for one hour period\n", +"OC=0; // Overflow count\n", +"\n", +"// solution\n", +"// usage(Erlangs)=(peg count- overflow count)*Average holding time(in hrs)\n", +"U=(PC-OC)*(5/3600); \n", +"printf('Usage = %.3f Erlangs = ',U);\n", +"\n", +"// IN CCS\n", +"Uccs=U*36; // usage in CCS\n", +"printf('%.1f CCS = ',Uccs);\n", +"\n", +"Ucs=Uccs *100; //usage in call-seconds\n", +"printf('%d call-seconds\n',Ucs);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.3: To_find_offered_load.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 2.3 \n", +"//TO find Offered Load.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"B=0.05; //Blocking(5%)\n", +"CL=3000; //Carried Load in CCS\n", +"\n", +"//Solution\n", +"//Offered Load=Carried Load/(1-Blocking);\n", +"OL=CL/(1-B); //Offered Load in CCS\n", +"printf('Offered load is %d CCS \n',round(OL));\n", +"printf(' Overflow is %d CCS \n',round(OL)-CL);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4: To_find_traffic_intensity.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 2.4 \n", +" //To find traffic intensity.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Ht=120; //Holding time in seconds\n", +"CR=2; //call rate per hour\n", +"\n", +"//solution\n", +"//Traffic Intensity(Erlangs) = call rate * Holding time(in hrs));\n", +"I=CR*Ht/3600; //Traffic Intensity\n", +"printf('Traffic Intensity is %.4f Erlangs = %.1f CCS \n',I,I*36);\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.5: To_find_traffic_intensity.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 2.5 \n", +"//To find traffic intensity in Erlangs and CCS.\n", +"//Refer-Table 2.1(page No 28): Traffic data used to estimate traffic intensity\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"time=90; //in minutes\n", +"calls=10; //no of calls in 90mins\n", +"\n", +"//solution\n", +"CR=calls/(time/60); //call arrival rate in calls/hour\n", +"tavg=(60+74+80+90+92+70+96+48+64+126)/10; //average call holding time in sec per call\n", +"I= CR*(tavg/3600); //traffic intensity in Erlangs\n", +"printf('Traffic Intensity is %.3f Erlangs = %.2f CCS \n ',I,I*36);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.6: EX2_6.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 2.6 \n", +"//To find traffic intensity in Erlangs and CCS during eight hour period and busy hour(4:00 PM to 5:00 PM).\n", +"//Refer-Table 2.2(page no 28): Traffic on customer line between 9:00PM and 5:00PM\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"time=8; //in hours\n", +"calls=11; //no of calls in 90mins period\n", +"\n", +"//solution\n", +"CR=calls/time; //call arrival rate in calls/hour\n", +"tavg=(3+10+7+10+5+5+1+5+15+34+5)/11; //average call holding time in mins per call\n", +"I= CR*(tavg/60); //traffic intensity in Erlangs\n", +"printf('Traffic Intensity during eight hour period is %.3f Erlangs = %.1f CCS \n',I,I*36);\n", +"\n", +"//For Busy Hour i.e between 4:00PM and 5:00PM\n", +"CRB=2; //call arrival rate during busy hour in calls/hour(from table 2.2)\n", +"tavgB=(34+5)/2; //average holding time during Busy Hour in mins/call (from table 2.2)\n", +"IB=CRB*(tavgB/60); //Traffic Intensity during Busy Hour\n", +"printf(' Traffic Intensity during busy hour is %.2f Erlangs = %.1f CCS',IB,IB*36);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.7: To_find_traffic_per_subscriber_per_BH_in_Erlangs.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 2.8\n", +"// To find traffic per user per BH in Erlangs.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"minutes=500; //No of minutes used per month per user\n", +"Twork=0.9; //Traffic During Work day\n", +"TBH=0.1; //Traffic during busy hour\n", +"Days=20; //No of workdays in a month\n", +"\n", +"//solution\n", +"//Avg BH usage per subscriber (in minutes) = minutes*Twork(TBH/Days);\n", +"Traffic=minutes*Twork*(TBH/Days);\n", +"printf('Traffic per user per BH is %.4f Erlangs \n',Traffic/60);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.8: To_find_average_number_of_BHCAs.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa:2.8 \n", +"// To find average busy hour call attempts(BHCA's).\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"minutes=500; //No of minutes used per month per user\n", +"Twork=0.9; //Traffic During Work day\n", +"TBH=0.1; //Traffic during busy hour\n", +"Days=20; //No of workdays in a month\n", +"MeanHT=100; //Mean holding time(in secs)\n", +"\n", +"//solution\n", +"//Avg BH usage per subscriber (in minutes) = minutes*Twork(TBH/Days);\n", +"//BHCAs=traffic (in Erlangs) *3600/(meanHT)\n", +"\n", +"Traffic=minutes*Twork*(TBH/Days);\n", +"BHCAs=(Traffic/60)*(3600/MeanHT);\n", +"\n", +"printf('Average Busy Hour call attempts are %.2f ', BHCAs);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.9: To_calculate_total_traffic_and_number_of_MSCs_required.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 2.9 \n", +"// To find total traffic in Erlangs and no of MScs required to handle it.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Tpopu=200000;//Total population\n", +"SP=0.25; //subscriber penetration\n", +"HT1=100; //holding time for Mobile to Land line and vicecersa\n", +"c1=3; //Avg calls/hr for Mobile to Land line and vicecersa\n", +"HT2=80; //For mobile to mobile\n", +"c2=4; //For mobile to mobile\n", +"TMSC=1800; //traffic one msc can hold\n", +"TrafDist=0.9 //Traffic distribution for Mobile to Land line and vicecersa\n", +"\n", +"//solution\n", +"aM_L=c1*HT1/3600; //Traffic Generated by Subscriber (M-L and L-M).\n", +"aM_M=c2*HT2/3600; //Traffic Generated by Subscriber (M-M).\n", +"WlessSub=SP*Tpopu; //total wireless subscribers\n", +"TotalTraffic=WlessSub*TrafDist*aM_L+WlessSub*(1-TrafDist)*aM_M;\n", +"MSCreqd=TotalTraffic/TMSC;\n", +"if(MSCreqd-int(MSCreqd)>0)//for rounding of to next integer ef 2.33 to 3\n", +" MSCreqd=MSCreqd+1;\n", +" end\n", +"printf('Total Traffic is %.1f Erlangs \n',TotalTraffic);\n", +"printf(' NO of MSCs Required are %d \n',int(MSCreqd));" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/21-Wireless_Local_Area_Network.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/21-Wireless_Local_Area_Network.ipynb new file mode 100644 index 0000000..65dc093 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/21-Wireless_Local_Area_Network.ipynb @@ -0,0 +1,427 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 21: Wireless Local Area Network" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.10: To_calculate_Rmax_for_IEEE_802_11_FH_and_DS_devices.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 21.10\n", +"// Repeat Problems 21.8 and 21.9, if the IEEE 802.11 FH device is replaced by the IEEE 802.11 DS device (Gp=11).\n", +"\n", +"clc\n", +"clear all;\n", +"\n", +"Gp=11;//processing gain(given)\n", +"//Defining variables from Exa 21.8 & 21.9\n", +"PBt=20; // transmitted power by the BT in dBm\n", +"PMs=40; // transmitted power of the IEEE 802.11 device in dBm\n", +"PAp=40; // transmitted power by the AP in dBm\n", +"d=10; // distance between AP and IEEE 802.11 device in m\n", +"Y=4; //path loss exponent\n", +"Pe=10^-5;//Error probability\n", +"\n", +"//solution\n", +"//Pe=0.5*e^(-0.5*Eb/No)\n", +"SIR=log(Pe/0.5)/(-0.5);\n", +"r1max=d*(SIR*PBt/(PAp*Gp))^(1/Y);// range of interference between Bluetooth and 802.11 device \n", +"printf(' Maximum coverage range for IEEE 802.11 DS is %.2f metres \n',r1max);\n", +"r2max=d*(SIR*PMs/(PBt*Gp))^(1/Y);\n", +"printf(' Maximum coverage range for IEEE 802.11 FH is %.2f metres \n',r2max);\n", +"disp(' Thus, the interference ranges are smaller for the IEEE 802.11 DS device compared to the IEEE 802.11 FH device.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.1: To_find_number_of_users_supported_by_WLAN_and_its_bandwidth_efficiency.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 21.1\n", +"// To find number of users that can be supported by the WLAN and the bandwidth efficiency.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Fl=902; //lower limit frequency MHz\n", +"Fh=928; //higher limit frequency in MHz\n", +"Rt=0.5; //symbol transmission rate in Mega symbols per sec\n", +"S=16; //No of symbols\n", +"BER=10^-5;//Bir error rate\n", +"SG=2.6;//sector gain\n", +"B=0.5; //Interference factor\n", +"a=0.9; //power control efficiency\n", +"\n", +"//solution\n", +"BW=Fh-Fl;\n", +"Rb=Rt*log2(S);\n", +"Gp=BW/Rb;\n", +"// BER = 10^-5= 0.5*erfc(sqrt(Eb_No))\n", +"deff('y=f(x)','y=0.5*erfc(sqrt(x))-10^-5')\n", +"[x,v,info]=fsolve(0.1,f);//x=Eb_No\n", +"M=Gp/x * 1/(1+B) * SG * a;\n", +"printf('Number of users that can be supported by the WLAN are %d \n',M);\n", +"eff=Rb*int(M)/BW;\n", +"printf(' The bandwidth efficiency is %.2f bps/Hz \n',eff);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.2: To_find_hopping_bandwidth_and_various_other_parameters_for_FH_MFSK_WLAN_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 21.2\n", +"// To find-\n", +"//a) the hopping bandwidth,\n", +"//b) What is the chip-rate,\n", +"//c) How many chips are there in each data symbol,\n", +"//d) What is the processing gain.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Stepsize=200; //in Hz\n", +"Chipsmin=20;//length of linear feedback shift register \n", +"Datarate=1.2*10^3; //bps\n", +"\n", +"//solution\n", +"No_of_tones=2^Chipsmin;\n", +"Bss=No_of_tones*Stepsize;\n", +"Chiprate=Datarate*Chipsmin;\n", +"Gp=Bss/Datarate;//processing gain\n", +"Symbolrate=Datarate/3; //8-ary FSK is used\n", +"Chips_symbol=Chiprate/Symbolrate;\n", +"printf('The Hopping Bandwidth is %.3f MHz\n',Bss/10^6);\n", +"printf(' The chiprate is %d kchip/sec\n',Chiprate/10^3);\n", +"printf(' Chips per symbol are %d \n',Chips_symbol);\n", +"printf(' The processing gain is %.1f\n',Gp);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.3: EX21_3.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 21.3\n", +"//To find-\n", +"// a) The bandwidth of a subchannel,\n", +"// b) modulation efficiency,\n", +"// c) user symbol rate,\n", +"// d) user data rate if the information bits are encoded with a rate of 3/4,\n", +"// e) time utilization efficiency of the system.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"InfoSc=48;//Information subcarriers\n", +"SyncSc=4;//synchronization subcarriers\n", +"ReservedSc=12;//Reserved subcarriers\n", +"Symrate=250; //ksps(kilosymbols per second)\n", +"BW=20; ///in MHz\n", +"Grdt=800; //Guard time in nsec\n", +"\n", +"//solution\n", +"TotalSc=InfoSc+SyncSc+ReservedSc;//Total subcarriers\n", +"BW_Sch=BW*10^6/TotalSc;//BW of subchannel\n", +"Mod_eff=Symrate*10^3/(BW_Sch);//Modulation efficiency\n", +"User_txrate=InfoSc*Symrate*10^3;\n", +"User_bitsymbol=4; //16-QPSK is used\n", +"disp('From table 21.7 For modulation scheme as 16-QAM and coding rate =3/4 then User data rate will be 36Mbps');\n", +"User_DR=36; //Mbps\n", +"Sym_Dur=1/(Symrate*10^3);\n", +"TimeUti=Sym_Dur/(Sym_Dur+(Grdt/10^9));\n", +"\n", +"printf(' The bandwidth of subchannel is %.1f kHz\n',BW_Sch/10^3);\n", +"printf(' Modulation efficiency is %.1f symbols/sec/Hz \n',Mod_eff);\n", +"printf(' User symbol rate is %d Msps \n',User_txrate/10^6);\n", +"printf(' Time Utilization efficiency is %.2f \n',TimeUti);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.4: To_find_coverage_of_the_AP.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 21.4\n", +"// To determine the coverage of AP.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Eb_No=10; //in dB\n", +"Noise=-120; //in dBm\n", +"Pt=20; //in mwatt\n", +"R=1; //Data rate in Mbps\n", +"CHBW=0.5; //BW in MHz\n", +"A=37.7; //path loss at the first meter in dB\n", +"Y=3.3; //path loss exponent\n", +"Lf=19; //function relating power loss with number of floors n (in dB)\n", +"Ls=10; // lognormally distributed random variable representing the shadow effect in dB \n", +"\n", +"//solution\n", +"S2Nreqd=Eb_No*R/CHBW;\n", +"Rx_sensi=Noise+S2Nreqd;\n", +"Lp=10*log10(20)-Rx_sensi;\n", +"//Lp=A+10Ylod(d)+Lf+Ls;therefore\n", +"d=10^((Lp-A-Lf-Ls)/(10*Y));\n", +"printf('The coverage of AP is %.1f metres \n',d);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.5: EX21_5.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 21.5\n", +"// To determine the coded symbol transmission rate per subcarrier and bit transmission rate per subcarrier for each of the two modes.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"R=3/4;//code rate of convolution encoder\n", +"M1=9; //payload transmission rate in Mbps for mode 1\n", +"M2=36; //payload transmission rate in Mbps for mode 2\n", +"\n", +"//solution\n", +"D1=M1*10^6/48;//user data rate in kbps for mode 1 \n", +"D2=M2*10^6/48;//user data rate in kbps for mode 2 \n", +"//Refering to Table 21.11\n", +"printf('Data transmission rate per carrier with 3/4 convolution encoder are %.1f Kbps and %d Kbps \n',D1/10^3,D2/10^3);\n", +"C1=D1/R;\n", +"C2=D2/R;\n", +"printf(' Carrier transmission rate with R=3/4 convolutional encoder are %d Kbps and %d Kbps\n',C1/10^3,C2/10^3);\n", +"printf(' Carrier symbol rate with R=3/4 convolutional encoder are %d ksps and %d Ksps \n',C1/10^3,C2/4/10^3); //Mode1 as BPSK and MOde2 as 16-QAM" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.6: To_find_user_data_rate_for_HIPERLAN_2.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 21.6\n", +"// To determine the user data rate for HIPERLAN/2.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"R=3/4; //code rate for convolution encoder\n", +"\n", +"//solution\n", +"//64-QAM modulation is used\n", +"Sc=250; //Carrier symbol rate(ksps) from Exa 21.5\n", +"Bits_sym=log2(64); //64-QAM is used\n", +"User_R=Bits_sym*Sc*10^3*R*48;\n", +"printf('The user data rate is %d Mbps \n',User_R/10^6);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.7: To_determine_the_collision_probability_of_a_FH_packet.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 21.7\n", +"// To determine the PER(Packet error rate) for FH(Frequency Hopping packet) and DS(Direct spread packet).\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"D=1000*8; //packet size in bits\n", +"R=2*10^6; //transmission rate in bps\n", +"L=3; //msec(Dwell time)\n", +"H=0.625; //msec(Duration of BT packet)\n", +"\n", +"//solution\n", +"Tw=10^3*D/R; //the packet duration of IEEE 802.11 in msec\n", +"H_L=1;\n", +"G=(H_L)*L-Tw-H;\n", +"Gm=abs(G);\n", +"PER_FH=1-((1-Gm/L)*(78/79)^(H_L)+Gm/L*(78/79)^((H_L)-G/Gm));\n", +"PER_DS=1-((1-Gm/L)*(57/79)^(H_L)+Gm/L*(57/79)^((H_L)-G/Gm));\n", +"printf('The PER for FH packet and PER for DS packet are %d percent & %.2f percent respectively',round(PER_FH*100),PER_DS*100);\n", +"disp('The collision probability with 802.11 DS is much higher than with 802.11 FH.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.8: To_calculate_min_SIR_and_using_this_SIR_and_other_data_calculate_Rmax.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 21.8\n", +"// To determine SIRmin and r_max.\n", +"\n", +"clc\n", +"clear all;\n", +"\n", +"d=10; // distance between AP and IEEE 802.11 device in metres\n", +"Y=4; //path loss exponent\n", +"PBt=20; //the transmitted power by the BT in dBm\n", +"PAp=40; //the transmitted power by the AP in dBm\n", +"Pe=10^-5;//acceptable error probability\n", +"\n", +"//solution\n", +"//Pe=0.5*e^(-0.5*Eb/No)\n", +" SIR=log(Pe/0.5)/(-0.5);// signal-to-interference ratio \n", +"rmax=d*(SIR*PBt/PAp)^(1/Y);// range of interference between Bluetooth and 802.11 device \n", +"printf('Minimum SIR is %.2f dB = %.1f \n',10*log10(SIR),SIR);\n", +"printf(' Maximum coverage range is %.2f metres \n',rmax);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.9: To_calculate_Rmax_for_given_interference_scenarios.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 21.9\n", +"// To calculate rmax for the interference scenarios (see Figure 21.21) using Smin from Example 21.8.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"SIRmin=21.6; //From eg 21.8 i.e(13.36 dB)\n", +"d=10; //distance between AP and IEEE 802.11 device in m\n", +"PMs=40; // transmitted power of the IEEE 802.11 device in dBm\n", +"PBt=20; //the transmitted power by the BT in dBm\n", +"Y=4 ; //path loss exponent\n", +"\n", +"//solution\n", +"rmax=d*(SIRmin*PMs/PBt)^(1/Y);\n", +"printf('Maximum coverage range is %.1f metres \n',rmax);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/24-Spreading_Codes_used_in_CDMA.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/24-Spreading_Codes_used_in_CDMA.ipynb new file mode 100644 index 0000000..30eb336 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/24-Spreading_Codes_used_in_CDMA.ipynb @@ -0,0 +1,158 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 24: Spreading Codes used in CDMA" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24.1: To_generate_m_sequence_and_demonstrate_its_properties.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa D.1\n", +"// Using the shift register shown in Figure D.3, generate an m-sequence and demonstrate its properties. \n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"//solution\n", +"//Referring Fig D.3\n", +"x=[0 0 1]; //Initial stage\n", +"output=x(3);\n", +"disp(' First m-sequence using 3-stage shift register.');\n", +"disp(' x1 x2 x3 output');\n", +"printf(' Initial %d %d %d %d \n ',x(1),x(2),x(3),output);\n", +"for i= 1:7\n", +" printf('Shift %d',i);\n", +" x(3)=x(2);\n", +" if(x(3)==1) //TO get values in range of [-1 1] for plot\n", +" dummy(i)=-1\n", +"else\n", +" dummy(i)=1;\n", +" end\n", +" x(2)=x(1);\n", +" if(output== 1& x(3)==1) //As new x(1)=prev stage x(3) ored prev stage x(2)\n", +" x(1)=0;\n", +" else\n", +" if(output== 0& x(3)==0)\n", +" x(1)=0;\n", +" else\n", +" x(1)=1;\n", +" end\n", +" end\n", +" \n", +" printf(' %d %d %d ',x(1),x(2),x(3));\n", +" output=x(3);\n", +" printf(' %d',output);\n", +" printf('\n ');\n", +"end\n", +"bar(dummy,0.2,'green');\n", +"xlabel('Time','FontSize',5);\n", +"title('7-chip first m-sequence for one T period','FontSize',5);\n", +"disp('The properties of m-sequence in Figure(0)are -');\n", +"disp('Number of -1s = 4 , Number of 1s = 3 ');\n", +"disp('Run length 1 = 2 , Run length 2 = 1');\n", +"disp('Run length = 1');\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24.2: To_generate_second_m_sequence.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa D.2\n", +"// what is the location of the modulo-2 adder for the second m-sequence? Generate the second m-sequence.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"//solution\n", +"disp('The location of modulo-2 adder for the second m-sequence is shown in Figure D.5(in the book)i.e Modulo-2 adder should be between first(x1) and second(x2) shift register.');\n", +"x=[0 0 1]; //Initial stage\n", +"output=x(3);\n", +"disp('Second m-sequence usinf 3-stage register');\n", +"disp(' x1 x2 x3 output');\n", +"printf(' Initial %d %d %d %d \n ',x(1),x(2),x(3),output);\n", +"for i= 1:7\n", +" printf('Shift %d',i);\n", +" x(3)=x(2);\n", +" if(x(3)==1) //TO get values in range of [-1 1] for plot\n", +" dummy(i)=-1\n", +"else\n", +" dummy(i)=1;\n", +" end\n", +" x(2)=x(1);\n", +" if(output== 1& x(2)==1) //As new x(1)=prev stage x(3) ored prev stage x(2)\n", +" x(1)=0;\n", +" else\n", +" if(output== 0& x(2)==0)\n", +" x(1)=0;\n", +" else\n", +" x(1)=1;\n", +" end\n", +" end\n", +" \n", +" printf(' %d %d %d ',x(1),x(2),x(3));\n", +" output=x(3);\n", +" printf(' %d',output);\n", +" printf('\n ');\n", +"end\n", +"figure(1);\n", +"bar(dummy,0.2,'green');\n", +"xlabel('Time','FontSize',5);\n", +"title('7-chip second m-sequence for one T period','FontSize',5);\n", +"disp('The properties of m-sequence in Figure(1)are -');\n", +"disp('Number of -1s = 4 , Number of 1s = 3 ');\n", +"disp('Run length 1 = 2 , Run length 2 = 1');\n", +"disp('Run length = 1');\n", +"" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/3-Radio_Propagation_and_Propagation_PathLoss_Models.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/3-Radio_Propagation_and_Propagation_PathLoss_Models.ipynb new file mode 100644 index 0000000..abb3478 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/3-Radio_Propagation_and_Propagation_PathLoss_Models.ipynb @@ -0,0 +1,446 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3: Radio Propagation and Propagation PathLoss Models" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.10: To_find_required_transmitter_power_in_watts.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 3.10\n", +"//To find required total transmit power in Watts.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Lp=140; // path losses in dB \n", +"k=1.38*10^-23; // Boltzmann’s constant (W/Kelvin-Hz)\n", +"k_db=10*log10(k);\n", +"f=900;//in MHz\n", +"Gt=8; //transmitting antenna gain(dB)\n", +"Gr=0; //receiver antenna gain(dB)\n", +"Ag=24;//gain of receiver amplifier in dB \n", +"Fmargin=8;//Fade margin(dB)\n", +"Nf=6;//Noise figure(dB)\n", +"L0=20; // other losses in dB\n", +"Lf=12; // antenna feed line loss in dB \n", +"T=24.6;//Temperature expressed in dB\n", +"R=39.8; // data rate in dB \n", +"M=8; //overall link margin(dB)\n", +"Eb_No=10;//dB\n", +"\n", +"//solution\n", +"//From equation (3.54)\n", +"pt_db=M-Gt-Gr-Ag+ Nf + T+ k_db+ Lp+ Lf+ L0 + Fmargin+ R+ Eb_No;\n", +"\n", +"Pt=10^(pt_db/10); //dB into normal number\n", +"printf('Total transmitted power is %d Watts \n',Pt); " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.1: To_find_free_space_and_reflected_surface_attenuations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 3.1\n", +"// To determine free space and reflected surface attenuations.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"hb=100; //in feets(height of BS antenna)\n", +"hm=5; // in feets(height of mobile antenna)\n", +"f=881.52;//in MHz\n", +"lamda=1.116; //in feet\n", +"d=5000; //in feet\n", +"Gb=10^0.8; //8dB(BS antenna gain)\n", +"Gm=10^0; // 0dB (Mobile antenna gain)\n", +"\n", +"//solution\n", +"free_atten=(4*%pi*d/lamda)^2*(Gb*Gm)^-1;\n", +"y=round(10*log10(free_atten));\n", +"printf('Free space attenuation is %d dB \n',y);\n", +"reflect_atten= (d^4/(hb*hm)^2)*(Gb*Gm)^-1;\n", +"x=round(10*log10(reflect_atten));\n", +"printf(' Reflecting surface attenuation is %d dB \n ',x);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.2: To_find_received_signal_power_and_SNR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 3.2\n", +"//To determine received signal power and SNR ratio.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"d=8000; //Distance between base station and mobile station\n", +"f=1.5*10^9;//in Hz \n", +"lamda=0.2; //in metres\n", +"Pt=10; //BS transmitted power in watts\n", +"Lo=8; //Total system losses in dB\n", +"Nf=5; //Mobile receiver noise figure in dB\n", +"T=290; //temperature in degree kelvin\n", +"BW=1.25*10^6; //in Hz\n", +"Gb=8; //in dB\n", +"Gm=0; //in dB\n", +"Hb=30; //in metres\n", +"Hm=3; //in metres\n", +"B=1.38*10^-23; //Boltzmann's constant\n", +"\n", +"//solution\n", +"Free_Lp=20*log10(Hm*Hb/d^2);\n", +"Pr=Free_Lp-Lo+Gm+Gb+Pt; //in dBW\n", +"Te=T*(3.162-1);\n", +"Pn=B*(Te+T)*BW;\n", +"printf('Received signal power is %d dBW \n',10*log10(Pn));\n", +"SNR=Pr-10*log10(Pn);\n", +"printf(' SNR ratio is %d dB \n',round(SNR));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.3: To_find_the_allowable_path_loss.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 3.3\n", +"//To determine received power and allowable Path loss.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"d=3*1000;//in metres\n", +"Y=4;// path loss exponent\n", +"Pt=4; //Transmitted power in watts\n", +"f=1800*10^6;//in Hz\n", +"Shadow=10.5; //in dB\n", +"d0=100;//in metres\n", +"P0=-32; //in dBm\n", +"\n", +"//solution\n", +"disp('Using equation 3.11 and including shadow effect we get')\n", +"Pr=P0+10*Y*log10(d0/d)+Shadow;\n", +"printf(' Received power is %.1f dBm \n',Pr);\n", +"path_loss=10*log10(Pt*1000)-Pr;\n", +"printf(' Allowable path loss is %.1f dB \n ',path_loss);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.4: To_find_the_distance_between_transmitter_and_receiver.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 3.4\n", +"//To determine distance between transmitter and receiver.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"shadow=10; //in dB\n", +"Lp=150; //in dB\n", +"\n", +"//solution\n", +"disp(' Using equation given in Problem i.e Lp=133.2+40*log(d) we get,');\n", +"d=10^((Lp-10-133.2)/40);\n", +"printf(' Separation between transmitter and receiver as %.2f km',d);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.5: To_determine_type_of_fading_and_symbol_distortion.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 3.5\n", +"// To calculate coherence time, coherence bandwidth, type of Symbol distortion and type of fading.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"v=60*0.44704; //.. mph to mps\n", +"fc=860*10^6;//in Hz\n", +"td=2*10^-6; //RMS delay spread in sec\n", +"c=3*10^8;// speed of light in m/sec\n", +"Rs=19200; //Coded symbol rate in bps\n", +"\n", +"//solution\n", +"lamda=c/fc;\n", +"fm=v/lamda; //Maximum doppler shift\n", +"tc=1/(2*%pi*fm);//Channel coherence time\n", +"printf('Channel coherence time is %.4f sec \n',tc);\n", +"ts=1/Rs; //symbol interval\n", +"printf(' Symbol interval is %d microsec \n',ts*10^6);\n", +"disp(' As the symbol interval is much smaller compared to the channel coherence time. So, Symbol distortion is minimal and fading is slow.');\n", +"disp('');\n", +"Bc=1/(2*%pi*td);\n", +"printf(' Coherence Bandwidth is %.2f kHz \n',Bc/1000)\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.6: To_determine_number_of_fades_per_second_and_maximum_velocity_of_mobile.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 3.6\n", +"// TO determine NO of fades per second, average fade duration and maximum velocity of mobile.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"p=1;// reflection coefficient of ground \n", +"c=3*10^8;// velocity of light in free space(m/sec)\n", +"e=2.71828;//Euler's number\n", +"fm=20; //in Hz\n", +"fc=900*10^6; //carrier frequency in Hz\n", +"\n", +"//solution\n", +"Nr=sqrt(2*%pi)*fm*p*e^-(p^2);\n", +"printf('NO of fades per second are %.2f \n',Nr);\n", +"Afd=e^-(p^2)/(p*fm*sqrt(2*%pi));\n", +"printf(' Average fade duration is %.4f sec \n ',Afd);\n", +"v=fm*c/fc;\n", +"printf('Maximum velocity of mobile is %.2f m/sec = %d Km/hour \n',v,v*18/5);\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.7: To_determine_L50_pathloss.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 3.7\n", +"// To calculate L50 path loss for a PCS system using Okumura and COST231 models.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"d=[1 2 3 4 5]; //in km\n", +"hb=30; //Height of BS antenna in metres\n", +"hm=2;// height of mobile antenna in matres\n", +"fc=900;//carrier frequency in MHz\n", +"W=15; //street width(m)\n", +"b=30; // distance between building along radio path (m) \n", +"phi=90; // incident angle relative to the street\n", +"hr=30; //in m\n", +"\n", +"//solution\n", +"dellhm=hr-hm;\n", +"//L50=Lf+Lrts+Lms\n", +"// By COST 231 model\n", +"Lf=32.4+20*log10(d)+20*log10(fc);\n", +"L0=4-0.114*(phi-55);\n", +"Lrts=-16.9-10*log10(W)+10*log10(fc)+20*log10(dellhm)+L0;\n", +"Lbsh=-18*log10(11);\n", +"ka=54-0.8*hb;\n", +"dellhb=hb-hr;\n", +"kd=18-15*dellhb/dellhm;\n", +"kf=4+0.7*(fc/925-1);\n", +"Lms=Lbsh+ka+kd*log10(d)+kf*log10(fc)-9*log10(b);\n", +"L50=[0 0 0 0 0];\n", +"L50=Lf+Lrts+Lms;\n", +"//Okumura/Hata model\n", +"ahm=(1.1*log10(fc)-0.7)*hm-(1.56*log10(fc)-0.8);\n", +"L_50=69.55+26.16*log10(fc)+(44.9-6.55*log10(hb))*log10(d)-13.82*log10(hb)-ahm;\n", +"xlabel('DISTANCE FROM TRANSMITTER IN KM');\n", +"ylabel('PATH LOSS in dB');\n", +"plot2d(d,[L50',L_50'],[1,2]); \n", +"legends(['Cost 231 Model';'Okumura/Hata Model'],[1,2 ],opt=2)\n", +"xgrid();\n", +"disp('L50 values by Cost 231 model');\n", +"printf('%.2f %.2f %.2f %.2f %.2f \n ',L50(1),L50(2),L50(3),L50(4),L50(5));\n", +"disp('L50 values bu Okumura/Hata model');\n", +"printf('%.2f %.2f %.2f %.2f %.2f \n ',L_50(1),L_50(2),L_50(3),L_50(4),L_50(5));\n", +"disp('The results from the plot of two models shows that the calculated path loss with the COST 231 model is higher than the value obtained by the Okumura/Hata model.');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.8: To_determine_coverage_radius_of_an_access_point.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 3.8\n", +"// TO find coverage radius of an access point.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"SNRmin=12;//in dB\n", +"n=3; //No of floors\n", +"Backgroundnoise=-115; //dBm\n", +"pt=100 //in dBm\n", +"\n", +"//solution\n", +"pt_db=10*log10(pt);\n", +"Sr=Backgroundnoise+SNRmin; //receiver sensitivity\n", +"Lpmax=pt_db-Sr;\n", +"//Refering table 3.4\n", +"Lp_d0=38; //ref path loss at the first meter(dB)\n", +"Lf=15+4*(n-1); //signal attenuation through n floors\n", +"y=3; //path loss exponent\n", +"X=10; //Shadowing effect(dB)\n", +"d=10^((Lpmax-Lp_d0-Lf-X)/30); //max allowable path loss\n", +"printf('Coverage radius of an access point = %d m \n',round(d));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.9: EX3_9.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Exa 3.9\n", +"// To calculate probability of exceeding signal beyond the receiver sensitivity.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"SSmean=-100; //signal strength(dBm)\n", +"Sr=-110; //receiver sensitivity(dBm)\n", +"sd=10; //standard deviation(dB)\n", +"\n", +"//solution\n", +"P_Smin=(0.5-0.5*erf((Sr-SSmean)/(sqrt(2)*sd)));\n", +"printf('probability of exceeding signal beyond the receiver sensitivity is %.2f \n',P_Smin);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/4-An_Overview_of_Digital_Communication_and_Transmission.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/4-An_Overview_of_Digital_Communication_and_Transmission.ipynb new file mode 100644 index 0000000..724939d --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/4-An_Overview_of_Digital_Communication_and_Transmission.ipynb @@ -0,0 +1,286 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: An Overview of Digital Communication and Transmission" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.1: To_determine_the_sampling_rates.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 4.1\n", +"// To calculate the sampling rate.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Fm=20; // in KHz\n", +"\n", +"//solution\n", +"disp(' An Engineering version of the Nyquist sampling rate : fs>=2.2*fm.');\n", +"printf('Therefore sampling rate of >= %d ksps should be used ',(2.2*Fm)); \n", +"disp('The sampling rate for a compact disc digital audio player = 44.1 ksps and for a studio quality audio player = 48 ksps are used.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2: To_determine_the_SNR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 4.2\n", +"// To calculate SNR for L=32, 64, 128, and 256.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Rt=1; //Resistance(ohm)\n", +"//L= Number of quantization values\n", +"L1=32;\n", +"L2=64;\n", +"L3=128;\n", +"L4=256;\n", +"\n", +"// solution\n", +"// L=2^R i.e R=log2(L);\n", +"R1=log2(L1);\n", +"R2=log2(L2);\n", +"R3=log2(L3);\n", +"R4=log2(L4);\n", +"\n", +"//P=A^2/2; //average power of signal\n", +"//sig^2=0.333*A^2*2^(-2*Rt); //Avg quantization noise power\n", +"//SNR=P/sig^2;\n", +"// SNR(dB)=1.8+ 6R;\n", +"\n", +"SNR1=1.8+6*R1;\n", +"SNR2=1.8+6*R2;\n", +"SNR3=1.8+6*R3;\n", +"SNR4=1.8+6*R4;\n", +"\n", +"printf('For L=32, SNR is %.1f dB\n ',SNR1);\n", +"printf('For L=64, SNR is %.1f dB\n ',SNR2);\n", +"printf('For L=128, SNR is %.1f dB\n ',SNR3);\n", +"printf('For L=256, SNR is %.1f dB\n ',SNR4);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.3: To_calculate_spacing_between_successive_pulses_of_multiplexed_signal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 4.3\n", +"// To calculate the spacing between successive pulses of the multiplexed signal.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Fs=8*10^3; //in Hz\n", +"Fm=3.4*10^3; // in Hz\n", +"VCH=24; //voice channels\n", +"SCH=1; //sunchronization channel\n", +"PDur=1; //extra pulse duration in microsec\n", +"\n", +"//solution\n", +"Ts=1/(Fs);\n", +"TimeCH=Ts/(VCH+SCH)*10^6; // in microsec\n", +"printf('Time between the pulses is %d microsec\n',(TimeCH-PDur));\n", +"//Now by using the engineering version of Nyquist rate sampling\n", +"NyquistRate=2.2*Fm;\n", +"Ts1_microsec=1/NyquistRate*10^6;\n", +"Tc=round(Ts1_microsec)/(VCH+SCH);\n", +"printf(' Time between the pulses by using engineering version of Nyquist rate sampling is %.2f microsec\n',(Tc-PDur));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4: EX4_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 4.4\n", +"// TO calculate:\n", +"// A)The minimum number of bits/sample or bits/PCM word that should be used.\n", +"// B)The minimum sampling rate, and what is the resulting transmission rate.\n", +"// C)The PCM pulse or symbol transmission rate.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Fm=3000; //highest modulating frequency in signal(Hz)\n", +"M=32; // number of pulse levels \n", +"b=5; //bits per symbol \n", +"p=0.01; //Quantization distortion\n", +"\n", +"//solution\n", +"//2^R = L >= 1/2P\n", +"// where R is the number of bits required to represent quantization levels L\n", +"R=log10(1/(2*p))/log10(2);\n", +"Fs=2*Fm; // Nyquist sampling criteria (samples per second)\n", +"fs=round(R)*Fs;\n", +"Rs=fs/b;\n", +"printf('The minimum number of bits/sample or bits/PCM word that should be used are %d',round(R));\n", +"printf('\n The minimum sampling rate is %d samples per second\n ',Fs);\n", +"printf('The resulting transmission rate is %d bps\n ',fs);\n", +"printf('The PCM pulse or symbol transmission rate is %d symbols/sec\n',Rs);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.5: To_determine_choice_of_modulation_scheme.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 4.5\n", +"// To determine choice of modulation scheme if no-error correction coding is used.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"S_No=53; //dB-Hz\n", +"R=9.6*10^3; //bps\n", +"BW=4.8*10^3; //Khz\n", +"Pb=10^-5; //BER<=10^-5;\n", +"\n", +"//solution\n", +"disp('Since the required data rate of 9.6 kbps is more than the available bandwidth of 4.8 kHz, the channel is bandwidth-limited.');\n", +"Eb_No=S_No-10*log10(R); //dB\n", +"// Try for 8-PSK modulation scheme\n", +"M=8;\n", +"Ps=log2(M)*Pb; //Max ps\n", +"Es_No=log2(M)*10^(0.1*Eb_No);\n", +"//Ps(8)=2*Q(sqrt(2*Es_No)*sin(%pi/8));\n", +"//2*Q(sqrt(2*Eb_No))=erfc(sqrt(Eb_No)); //Refer EQn C(7) from appendix C\n", +"\n", +"Ps8=erfc(sqrt(Es_No)*sin(%pi/8));\n", +"disp('');\n", +"printf(' Symbol error rate is given as %.5f \n ',Ps);\n", +"printf('The ratio of signal energy to noise is %.2f \n ',Es_No);\n", +"printf('Symbol error rate for 8-PSK is %.5f \n ',Ps8);\n", +"disp('As symbol error rate for 8-PSK modulation is lower than threshold value. so, We can use 8-PSK modulation.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6: To_find_choice_of_modulation_scheme_without_error_correcting_coding.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 4.6\n", +"// To determine design choice of modulation scheme without an error correction coding.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"SNR=48; //dB-Hz\n", +"BW=45*10^3; //in Hz\n", +"R=9.6*10^3; //bps\n", +"Pb=10^-5; //Bit error rate\n", +"e=2.71828; //Natural exponent e\n", +"\n", +"//solution\n", +"disp(' since the available bandwidth of 45 kHz is more than adequate to support the required data rate of 9.6 kbps.');\n", +"disp('So, the channel is not bandwidth limited ');\n", +"Eb_No=SNR-10*log10(R);\n", +"//We try the 16-FSK modulation scheme\n", +"M=16;\n", +"\n", +"Es_No=log2(M)*Eb_No;\n", +"Ps=(M-1)/2*e^(-Es_No/2);\n", +"//For orthogonal signalling\n", +"Ps16=(2^M-1)/(2^(M-1))*Pb;\n", +"disp('');\n", +"printf(' The maximum symbol error probability is %0.5f \n ',Ps16);\n", +"printf('The symbol error probability achieved by 16-PSK is %.9f \n ',Ps);\n", +"disp('As achieved symbol error probability is far less than maximum tolerable value');\n", +"disp('So, we can meet the given specifications for this power-limited channel with a 16-FSK modulation scheme without any error-correction coding')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/5-Fundamentals_of_Cellular_Communications.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/5-Fundamentals_of_Cellular_Communications.ipynb new file mode 100644 index 0000000..645c20f --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/5-Fundamentals_of_Cellular_Communications.ipynb @@ -0,0 +1,371 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5: Fundamentals of Cellular Communications" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.1: To_find_system_capacity.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 5.1\n", +"// To Calculate \n", +"// A) The system capacity if the cluster size, N (reuse factor), is 4 and \n", +"// B) The system capacity if the cluster size is 7.\n", +"// C) How many times would a cluster of size 4 have to be replicated to cover the entire cellular area? \n", +"// D) Does decreasing the reuse factor N increase the system capacity?\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"ToCH=960;// Total available channels\n", +"Cellarea=6; //in km^2\n", +"Covarea=2000;//in km^2\n", +"N1=4; // Cluster Size\n", +"N2=7; //Cluster Size\n", +"\n", +"//solution\n", +"Area1=N1*Cellarea;//for N=4\n", +"Area2=N2*Cellarea;//For N=7\n", +"No_of_clusters1=round(Covarea/Area1);\n", +"No_of_clusters2=round(Covarea/Area2);\n", +"No_of_CH1=ToCH/N1; // No of channels with cluster size 4\n", +"No_of_CH2=ToCH/N2; // No of channels with cluster size 7\n", +"SysCap1=No_of_clusters1*ToCH;\n", +"SysCap2=No_of_clusters2*ToCH;\n", +"printf(' System Capacity with cluster size 4 is %d channels \n ',SysCap1);\n", +"printf(' Number of clusters for covering total area with N equals 4 are %d \n ',No_of_clusters1);\n", +"printf(' System Capacity with cluster size 7 is %d channels \n',SysCap2);\n", +"disp(' It is evident when we decrease the value of N from 7 to 4, we increase the system capacity from 46080 to 79680 channels. Thus, decreasing the reuse factor (N) increases the system capacity.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2: To_find_reuse_factor_for_AMPS_and_GSM.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 5.2\n", +"// To calculate reuse factor for AMP and GSM systems.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"S_IAMP=18;// S/I ratio in dB\n", +"S_IGSM=12;// S/I ratio in dB\n", +"PPL=4; // propogation path loss coefficient\n", +"\n", +"//solution\n", +"// Using Equation 5.16 on page no 132, we get\n", +"N_AMP=(1/3)*((6*10^(0.1*S_IAMP))^(2/PPL));//reuse factor for AMPS\n", +" \n", +"N_GSM=(1/3)*((6*10^(0.1*S_IGSM))^(2/PPL));//reuse factor for GSM\n", +"\n", +"printf('Reuse Factor for AMP system is N = %f = approx %d \n',N_AMP,N_AMP+1);\n", +"printf(' Reuse Factor for GSM system is N = %f = approx %d \n',N_GSM,N_GSM+1);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.3: To_calculate_call_capacity_of_cell_and_Mean_S_by_I_for_N_as_4_and_7_and_12.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 5.3\n", +"// To calculate\n", +"// A) The number of calls per cell site per hour (i.e., call capacity of cell).\n", +"// B) Mean S/I ratio for cell reuse factor equal to 4, 7 and 12.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"VCH=395;//Total voice channels\n", +"CallHT=120;//average call holding time in sec\n", +"Blocking=0.02;// 2%\n", +"PPL=4; //propogation path loss coefficient\n", +"N1=4 //reuse factor\n", +"N2=7; //reuse factor\n", +"N3=12; //reuse factor\n", +"\n", +"//solution\n", +"No_of_VCH1=VCH/N1; //for reuse factor N1\n", +"No_of_VCH2=VCH/N2; //for reuse factor N2\n", +"No_of_VCH3=VCH/N3; //for reuse factor N3\n", +"printf('\nNO of voice channels for N=4 are %d',round(No_of_VCH1));\n", +"printf('\nNO of voice channels for N=7 are %d',round(No_of_VCH2));\n", +"printf('\nNO of voice channels for N=12 are %d\n',round(No_of_VCH3));\n", +"disp('Using the Erlang-B traffic table (see Appendix A) for 99 channels with 2% blocking, we find a traffic load of 87 Erlangs.');\n", +"TrafLoad1=87.004;\n", +"Carryload1=(1-Blocking)*TrafLoad1;\n", +"disp('Using the Erlang-B traffic table (see Appendix A) for 56 channels with 2% blocking, we find a traffic load of 45.88 Erlangs.');\n", +"TrafLoad2=45.877;\n", +"Carryload2=(1-Blocking)*TrafLoad2;\n", +"disp('Using the Erlang-B traffic table (see Appendix A) for 33 channels with 2% blocking, we find a traffic load of 24.6 Erlangs.');\n", +"TrafLoad3=24.629;\n", +"Carryload3=(1-Blocking)*TrafLoad3;\n", +"// To find cell capacity\n", +"Ncall1=Carryload1*3600/CallHT;//Calls per hour per cell \n", +"Ncall2=Carryload2*3600/CallHT;\n", +"Ncall3=Carryload3*3600/CallHT;\n", +"printf('\ncalls per hour per cell for N=4 are %d',round(Ncall1));\n", +"printf('\ncalls per hour per cell for N=7 are %d',round(Ncall2));\n", +"printf('\ncalls per hour per cell for N=12 are %d \n',Ncall3);\n", +"// To find S BY I\n", +"// N=(1/3)[6*(S/I)]^(2/PPL)\n", +"S_I1=10*(PPL/2)*(log10(N1)-log10(1/3)-(2/PPL)*log10(6));//Mean S/I (dB)\n", +"\n", +"S_I2=10*(PPL/2)*(log10(N2)-log10(1/3)-(2/PPL)*log10(6));\n", +"S_I3=10*(PPL/2)*(log10(N3)-log10(1/3)-(2/PPL)*log10(6));\n", +"\n", +"printf('\nMean S/I(dB) for N=4 is %.1f',S_I1);\n", +"printf('\nMean S/I(dB) for N=7 is %.1f',S_I2);\n", +"printf('\nMean S/I(dB) for N=12 is %.1f',S_I3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.4: To_calculate_the_number_of_calls_per_hour_per_cellsite.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 5.4\n", +"// To find the number of calls per hour per cell site.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"spectrum=12.5*10^6; //in Hz\n", +"CHBW=200*10^3;//in Hz\n", +"N=4;//reuse factor\n", +"Blocking=0.02; // 2%\n", +"callHT=120;//average call holding time in sec\n", +"PPL=4;//propogation path loss coefficient\n", +"CntrlCH=3; //No of control channels\n", +"Ts=8; // No of voice channels per RF channel\n", +"\n", +"//solution\n", +"No_ofVCH=((spectrum*Ts)/(CHBW*N))-CntrlCH;\n", +"printf('\n No of voice channels for N=4 are %d',No_ofVCH);\n", +"disp('');\n", +"disp('Using the Erlang-B traffic table for 122 channels with 2% blocking,we find a traffic load of 110 Erlangs. ');\n", +"TrafLoad=110;\n", +"CarryLoad=(1-Blocking)*TrafLoad;\n", +"Ncall=CarryLoad*3600/callHT;\n", +"printf('\n Calls per hour per cell for N=4 are %d calls/hour/cell \n ',round(Ncall));\n", +"S_I=10*(PPL/2)*(log10(N)-log10(1/3)-(2/PPL)*log10(6));\n", +"printf('\n Mean S/I(dB) for N=4 is %.1f dB \n ',S_I);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5: To_calculate_calls_per_hour_per_cellsite_and_mean_S_by_I_and_spectral_efficiency.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 5.5\n", +"// To Calculate: \n", +"// a) The calls per hour per cell site \n", +"// b) The mean S/I ratio \n", +"// c) The spectral efficiency in Erlang/km2/MHz \n", +"// for Reuse ratio =4,7,12 and for omnidirectional, 120 degree and 60 degree antenna systems.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"VCH=395;//Total allocated voice channels\n", +"CHBW=30; // in kHz\n", +"Spectrum=12.5; // in MHz\n", +"CallHT=120; //Average call holding time in sec\n", +"Blocking=0.02; // 2%\n", +"PL=40; //slope of path loss in dBperdecade\n", +"\n", +"//solution\n", +"disp('We consider only the first tier interferers and neglect the effects of cochannel interference from the second and other higher tiers.');\n", +"//FOR 120degree sectorization\n", +"//N=4\n", +"VCH11=(VCH/(4*3));\n", +"OffLoad11=24.629; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site11=3*OffLoad11;\n", +"CarLoad11=(1-Blocking)*Load_site11;\n", +"Calls_hr_site11=CarLoad11*3600/CallHT;\n", +"R11=sqrt(CarLoad11/0.52);\n", +"Seff11=CarLoad11/(2.6*Spectrum*R11^2);\n", +"S_I11=PL*log10(sqrt(3*4))-10*log10(2);\n", +"//N=7\n", +"VCH12=(VCH/(3*7));\n", +"OffLoad12=12.341; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site12=3*OffLoad12;\n", +"CarLoad12=(1-Blocking)*Load_site12;\n", +"Calls_hr_site12=CarLoad12*3600/CallHT;\n", +"R12=sqrt(CarLoad12/0.52);\n", +"Seff12=CarLoad12/(2.6*Spectrum*R12^2);\n", +"S_I12=PL*log10(sqrt(3*7))-10*log10(2);\n", +"//N=12\n", +"VCH13=VCH/(3*12);\n", +"OffLoad13=5.842; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site13=3*OffLoad13;\n", +"CarLoad13=(1-Blocking)*Load_site13;\n", +"Calls_hr_site13=CarLoad13*3600/CallHT;\n", +"R13=sqrt(CarLoad13/0.52);\n", +"Seff13=CarLoad13/(2.6*Spectrum*R13^2);\n", +"S_I13=PL*log10(sqrt(3*12))-10*log10(2);\n", +"//For omnidirectional \n", +"//N=4\n", +"VCH21=VCH/(4);\n", +"OffLoad21=87.004; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site21=OffLoad21;\n", +"CarLoad21=(1-Blocking)*Load_site21;\n", +"Calls_hr_site21=CarLoad21*3600/CallHT;\n", +"R21=sqrt(CarLoad21/0.52);\n", +"Seff21=CarLoad21/(2.6*Spectrum*R21^2);\n", +"S_I21=PL*log10(sqrt(3*4))-10*log10(6);\n", +"//N=7\n", +"VCH22=VCH/(7);\n", +"OffLoad22=46.817; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site22=OffLoad22;\n", +"CarLoad22=(1-Blocking)*Load_site22;\n", +"Calls_hr_site22=CarLoad22*3600/CallHT;\n", +"R22=sqrt(CarLoad22/0.52);\n", +"Seff22=CarLoad22/(2.6*Spectrum*R22^2);\n", +"S_I22=PL*log10(sqrt(3*7))-10*log10(6);\n", +"//N=12\n", +"VCH23=VCH/(12);\n", +"OffLoad23=24.629; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site23=OffLoad23;\n", +"CarLoad23=(1-Blocking)*Load_site23;\n", +"Calls_hr_site23=CarLoad23*3600/CallHT;\n", +"R23=sqrt(CarLoad23/0.52);\n", +"Seff23=CarLoad23/(2.6*Spectrum*R23^2);\n", +"S_I23=PL*log10(sqrt(3*12))-10*log10(6);\n", +"// For 60degree Sectorization\n", +"//N=3\n", +"VCH31=VCH/(6*3);\n", +"OffLoad31=14.902; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site31=6*OffLoad31;\n", +"CarLoad31=(1-Blocking)*Load_site31;\n", +"Calls_hr_site31=CarLoad31*3600/CallHT;\n", +"R31=sqrt(CarLoad31/0.52);\n", +"Seff31=CarLoad31/(2.6*Spectrum*R31^2);\n", +"S_I31=PL*log10(sqrt(3*3))-10*log10(1);\n", +"//N=4\n", +"VCH32=VCH/(6*4);\n", +"OffLoad32=10.656; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site32=6*OffLoad32;\n", +"CarLoad32=(1-Blocking)*Load_site32;\n", +"Calls_hr_site32=CarLoad32*3600/CallHT;\n", +"R32=sqrt(CarLoad32/0.52);\n", +"Seff32=CarLoad32/(2.6*Spectrum*R32^2);\n", +"S_I32=PL*log10(sqrt(3*4))-10*log10(1);\n", +"//N=7\n", +"VCH33=VCH/(6*7);\n", +"OffLoad33=5.084; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site33=6*OffLoad33;\n", +"CarLoad33=(1-Blocking)*Load_site33;\n", +"Calls_hr_site33=CarLoad33*3600/CallHT;\n", +"R33=sqrt(CarLoad33/0.52);\n", +"Seff33=CarLoad33/(2.6*Spectrum*R33^2);\n", +"S_I33=PL*log10(sqrt(3*7))-10*log10(1);\n", +"//N=12\n", +"VCH34=VCH/(6*12);\n", +"OffLoad34=2.227; // Offered traffic load per sector from Erlang-B table(Appendix A)\n", +"Load_site34=6*OffLoad34;\n", +"CarLoad34=(1-Blocking)*Load_site34;\n", +"Calls_hr_site34=CarLoad34*3600/CallHT;\n", +"R34=sqrt(CarLoad34/0.52);\n", +"Seff34=CarLoad34/(2.6*Spectrum*R34^2);\n", +"S_I34=PL*log10(sqrt(3*12))-10*log10(1);\n", +"\n", +"printf('For Omnidirectional Calls_per_hour_per_cellsite Mean S_I ratio SpecrtalEfficiency\n')\n", +"printf('For N=4 %d %.1f %.3f\n',Calls_hr_site21,S_I21,Seff21);\n", +"printf('For N=7 %d %.1f %.3f\n',Calls_hr_site22,S_I22,Seff22);\n", +"printf('For N=12 %d %.1f %.3f\n',Calls_hr_site23,S_I23,Seff23);\n", +"\n", +"printf('For 120deg sector Calls_per_hour_per_cellsite Mean S_I ratio SpecrtalEfficiency\n')\n", +"printf('For N=4 %d %.1f %.3f\n',Calls_hr_site11,S_I11,Seff11);\n", +"printf('For N=7 %d %.1f %.3f\n',Calls_hr_site12,S_I12,Seff12);\n", +"printf('For N=12 %d %.1f %.3f\n',Calls_hr_site13,S_I13,Seff13);\n", +"\n", +"printf('For 60 deg Sector Calls_per_hour_per_cellsite Mean S_I ratio SpecrtalEfficiency\n')\n", +"printf('For N=3 %d %.1f %.3f\n',Calls_hr_site31,S_I31,Seff31);\n", +"printf('For N=4 %d %.1f %.3f\n',Calls_hr_site32,S_I32,Seff32);\n", +"printf('For N=7 %d %.1f %.3f\n',Calls_hr_site33,S_I33,Seff33);\n", +"printf('For N=12 %d %.1f %.3f\n',Calls_hr_site34,S_I34,Seff34);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/6-Multiple_Access_Techniques.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/6-Multiple_Access_Techniques.ipynb new file mode 100644 index 0000000..5d9dc3d --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/6-Multiple_Access_Techniques.ipynb @@ -0,0 +1,425 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6: Multiple Access Techniques" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.10: To_find_data_link_protocol_efficiency_with_different_protocols.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.10\n", +"// To calculate the data link protocol efficiency with \n", +"//(1) Stop and Wait protocol — full duplex,\n", +"//(2) SRP with window size W=8, and \n", +"//(3) Go-Back-N protocol with window size W=8.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Tprop=4; //maximum propogation delay in sec\n", +"R=10; // data rate in Mbps\n", +"PackLen=400; //data packet length in bits\n", +"ACK=20; //length of ACK packet in bits\n", +"Tproc=1; //processing time(sec)\n", +"p=0.01;//probability that a data packet or its ACK can be corrupted during transmission\n", +"\n", +"//solution\n", +"Tp=PackLen/R; //packet transmission time in microsec\n", +"Ta=ACK/R; // transmission time for an ACK in microsec\n", +"T=Tp+2*Tprop+2*Tproc+Ta;// total time for transmission time \n", +"// Stop and wait ARQ\n", +"Eff0=(1-p)*Tp/((1-p)*T+p*Tp);\n", +"//SRP with window size W=8\n", +"W=8;\n", +"Eff1=(2+p*(W-1))/(2+p*(3*W-1));\n", +"//Go-Back-N protocol with window size W=8\n", +"Eff2=1/(1+W*(p/(1-p)));\n", +"printf('The data link protocol efficiency with Stop and Wait protocol, SRP and GBN are \n %.3f, %.3f abd %.3f respectively\n',Eff0,Eff1,Eff2);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.1: To_calculate_spectral_efficiency_of_modulation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.1\n", +"// To calculate spectral efficiency.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Area=8; //in km^2\n", +"Cover=4000;// in km^2\n", +"CallBH=1.2; //Avg calls during BH\n", +"HT=100; // Avg holding time in sec\n", +"Block=0.02; //Blocking=2%\n", +"N=4;//Frequency reuse factor\n", +"Spectrum=12.5;// in MHz\n", +"CHBW=200;// in kHz\n", +"User_CH=8;//No of users per RF channel\n", +"\n", +"//solution\n", +"RFCH=Spectrum*1000/CHBW;\n", +"TCH=int(RFCH)*User_CH;\n", +"SigCH=3;//No of signalling channels per cell\n", +"TCH_cell=TCH/N-SigCH;\n", +"Cells=Cover/Area;\n", +"OffLoad=108.4; // in Erlangs\n", +"printf('Using Erlang-B Tables, Total traffic offered by %d channels at 0.02 blocking = %.1f Erlangs/cell \n ',TCH_cell,OffLoad*(1-Block));\n", +"CarLoad=OffLoad*(1-Block);\n", +"Calls_hr_cell=CarLoad*3600/HT;\n", +"MaxUser_hr_cell=Calls_hr_cell/CallBH;\n", +"Seff=CarLoad*Cells/(Spectrum*Cover);\n", +"printf('Spectral Efficiency is %.2f Erlangs/MHz/km^2\n',Seff);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2: To_find_multiple_access_spectral_efficiency_for_FDMA.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.2\n", +"// To calculate spectral efficiency of FDMA.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"TCH=395; // Traffic Channels\n", +"SysBW=12.5; //in MHz\n", +"CHspace=30; // in kHz\n", +"\n", +"//solution\n", +"Eff=TCH*CHspace/(SysBW*1000);\n", +"printf('Multiple access spectral efficiency of FDMA System is %.3f\n ',Eff);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.3: To_find_multiple_access_spectral_efficiency_of_the_TDMA_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.3\n", +"// To calculate spectral efficiency of TDMA.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Tf=40; //Frame duration in msec\n", +"Mt=6; // Frames per slot\n", +"Bu=30; //bandwidth(KHz) of an individual user during his or her time slot\n", +"Nu=395;// number of users sharing the same time slot in the system, but having access to different frequency sub-bands\n", +"Bw=12.5; // in MHz\n", +"DR=16.2;//Data rate in kbps\n", +"FDur=40; // Frame duration in msec\n", +"slots=6; //No of slots per time frame\n", +"IndiRate=16.2; //Individual data rate in kbps\n", +"Srate=13; //Speech rate in kbps\n", +"\n", +"//solution\n", +"TimeSlot=(Srate/IndiRate)*(FDur/slots);\n", +"Seff=TimeSlot*slots*Bu*Nu/(FDur*Bw*1000);\n", +"printf('Multiple access spectral efficiency of TDMA is %.2f\n ',Seff);\n", +"printf('The overhead portion of the frame is %d percent \n ',round((1-Seff)*100));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.4: To_calculate_the_capacity_and_spectral_efficiency_of_TDMA_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.4\n", +"// To calculate capacity and spectral efficiency of a TDMA system.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"nb=0.9; //BW efficiency factor\n", +"u=2; // Bit Efficiency with QPSK\n", +"Vf=1; // Voice activity factor\n", +"BW=12.5; //in MHz\n", +"IR=16.2; // in kbps\n", +"N=19; //frequency reuse factor\n", +"\n", +"//solution\n", +"Nu=nb*u*BW*1000/(Vf*IR*N);// number of channels (mobile users) per cell\n", +"Seff=int(Nu)*IR/(BW*1000);\n", +"printf('Capacity of system is %d mobile users per cell\n ',Nu);\n", +"printf('Spectral efficiency of TDMA system is %.3f bit/sec/Hz\n',Seff);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.5: To_calculate_the_frame_efficiency_and_the_number_of_channels_per_frame.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.6\n", +"// To calculate frame efficiency and the number of channels per frame.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Nr=2;// number of reference bursts per frame\n", +"Nt=24; // number of traffic bursts (slots) per frame(120msec)\n", +"FL=120; //Frame length in msec\n", +"Br=148; // number of overhead bits per reference burst\n", +"Bp=34; // number of overhead bits per preamble per slot \n", +"Bg=8.25;//number of equivalent bits in each guard time interval \n", +"Tf=120; // frame duration in msec\n", +"Rrf=270.83333333; // bit rate of the RF channel in kbps\n", +"R=22.8; //bit rate of each channel in kbps\n", +"\n", +"//solution\n", +"B0=Nr*(8*Br)+Nt*(8*Bp)+(Nt+Nr)*(8*Bg);//The number of overhead bits per frame\n", +"Bt=FL*10^-3*Rrf*10^3;//The total number of bits per frame \n", +"Eff=(1-B0/Bt)*100;\n", +"CH_Frame=(Eff/100)*Rrf/R;//No of channels/frame\n", +"printf('The frame efficiency is %.2f percent\n ',Eff);\n", +"printf('Number of channels/frame are %d\n',round(CH_Frame));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6: To_calculate_capacity_and_spectral_efficiency_of_the_DSCDMA_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.6\n", +"// To calculate capacity and spectral efficiency of the DS-CDMA system.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"nb=0.9;//bandwidth efficiency\n", +"nf=0.45;//frequency reuse efficiency \n", +"Cd=0.8; //capacity degradation factor \n", +"Vf=0.4;//voice activity factor \n", +"Eb_I0=7; // desired energy-to-interference ratio in dB\n", +"L=1;// efficiency of sector-antenna in cell \n", +"BW=12.5;//One way system BW in MHz\n", +"R=16.2;//Information rate in kbps\n", +"\n", +"//solution\n", +"Eb_I=10^(Eb_I0*0.1);//To convert from dB to a normal value\n", +"Nu=(nf*nb*Cd*L/Vf)*(BW*1000/(Eb_I*R));//Capacity of system\n", +"Seff=round(Nu)*R/(12.5*10^3);\n", +"printf('Capacity of system is %d mobile users per cell\n ',round(Nu));\n", +"printf('Spectral efficiency of TDMA system is %.3f bits/sec/Hz\n',Seff);\n", +"\n", +"disp('In these calculations, an omnidirectional antenna is assumed. If a three sector antenna (i.e., G=3) is used at a cell site with lamda(efficiency of sector-antenna in a cell)= 2.6, the capacity will be increased to 325 mobile users per cell, and spectral efficiency will be 0.421 bits/sec/Hz.')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.7: Compare_DS_CDMA_and_TDMA_omnidirectional_cell.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.7\n", +"// Using the data given in Exa 6.4 and 6.6, compare the capacity of the DS-CDMA and TDMA omnidirectional cell.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"//Given Data from Exa 6.4 and Exa 6.6\n", +"Cd=0.8; //capacity degradation factor\n", +"R=16.2;//Data rate in kbps\n", +"Eb_I0=7; //in dB\n", +"Eb_I=10^(Eb_I0*0.1);//To convert from dB to a normal value\n", +"Vf=0.4;//voice activity factor \n", +"u=2; // Bit Efficiency\n", +"IR=16.2; // in kbps\n", +"N=19; //frequency reuse factor\n", +"nf=0.45;//frequency reuse efficiency \n", +"\n", +"//solution\n", +"Ncdma_by_Ntdma=Cd*N*nf*IR/(Eb_I*Vf*u*R);\n", +"printf('The ratio of capacity of DS-CDMA to TDMA is %.3f\n',Ncdma_by_Ntdma);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.8: To_calculate_minimum_number_of_PN_chips_per_frequency_word.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.8\n", +"// To calculate the minimum number of PN chips that are required for each frequency word.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Bss=600; //Hopping bandwidth in MHz\n", +"stepsize=400; // in Hz\n", +"\n", +"//solution\n", +"No_of_Tones=Bss*10^6/stepsize;\n", +"Min_chips_required=log2(No_of_Tones);\n", +"printf('Minimum number of chips required are %d chips \n ',Min_chips_required);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.9: To_find_normalized_throughput_for_different_CSMA_protocols.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 6.9\n", +"// To calculate the normalized throughput with: \n", +"//(a) an unslotted nonpersistent,\n", +"//(b) a slotted persistent, and\n", +"//(c) a slotted 1-persistent CSMA protocol.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"e=2.71828; //Euler's number\n", +"Tprop=0.4; //Max propogation delay in sec\n", +"R=10; //data rate in Mbps\n", +"PackLen=400; //packet length in bits\n", +"\n", +"//solution\n", +"Tp=PackLen/R; //packet transmission time in microsec\n", +"a=Tprop/Tp;\n", +"G=Tp*10^-6*R*10^6/PackLen;//normalized offered traffic load \n", +"//Slotted nonpersistent\n", +"S0=a*G*e^(-a*G)/(1-e^(-a*G)+a);//normalized throughput \n", +"//Unslotted nonpersistent\n", +"S1=G*e^(-a*G)/(1+(2*a)+e^(-a*G));//normalized throughput \n", +"//Slotted 1-persistent\n", +"S2=G*e^(-G*(1+a))*(1+a-e^(-a*G))/((1+a)*(1-e^(-a*G))+a*e^(-G*(1+a)));//normalized throughput \n", +"printf('The Normalized throughput with an unslotted non persistent, a slotted persistent and a slotted 1-persistent CSMA protocol are \n %.3f,%.3f and %.3f respectively \n',S0,S1,S2);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/8-Speech_Coding_and_Channel_Coding.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/8-Speech_Coding_and_Channel_Coding.ipynb new file mode 100644 index 0000000..7ec7fa0 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/8-Speech_Coding_and_Channel_Coding.ipynb @@ -0,0 +1,169 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8: Speech Coding and Channel Coding" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.1: To_calculate_the_gain_in_the_link_budget_in_dB.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 8.1\n", +"// To calculate coverage gain in dB.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Pdiff=-3; //in dB\n", +"AMR1=12.2; //in kbps\n", +"AMR2=7.95; //in kbps\n", +"AMR3=4.75; //in kbps\n", +"\n", +"//solution\n", +"//CG(dB)=10log{(DPDCH(kbps)+DPCCH)/(DPDCH(AMR bit rate (kbps))+ DPCCH)}\n", +"CG1=10*log10((AMR1+AMR1*10^(Pdiff/10))/(AMR2+AMR1*10^(Pdiff/10)));\n", +"CG2=10*log10((AMR1+AMR1*10^(Pdiff/10))/(AMR3+AMR1*10^(Pdiff/10)));\n", +"printf('By reducing the AMR bit rate from 12.2 to 7.95 kbps coverage gain becomes %.2f dB \n ',CG1);\n", +"printf('By reducing the AMR bit rate from 7.95 to 4.75 kbps coverage gain becomes %.2f dB \n ',CG2);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.2: To_calculate_output_of_convolution_encoder.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 8.2\n", +"// To calculate the output of the encoder.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"K=4; //constraint length\n", +"r=1/2; //code rate(n/k)\n", +"x=poly(0,'x');//Defining x as a ploynomial variable\n", +"G1=1+x^2+x^3;\n", +"G2=1+x+x^2+x^3;\n", +"in=[1 0 1 1 1];//input(first bit first)\n", +"\n", +"//solution\n", +"//with reference to Fig 8.9 on page no 239\n", +"g1=[1 0 1 1]; //converting from G1 polynomial to bit form\n", +"g2=[1 1 1 1];////converting from G2 polynomial to bit form\n", +"x1=round(convol(g1,in));\n", +"x2=round(convol(g2,in));\n", +"V1=modulo(x1,2);\n", +"V2=modulo(x2,2);\n", +"disp('Multiplexing the V1 and V2 to get required output sequence as ');\n", +" a=5;\n", +"for i= 1:5\n", +" printf('%d%d',V2(a),V1(a));\n", +" a=a-1;\n", +" \n", +"end\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.3: To_demonstrate_operations_of_converting_burst_errors_into_bit_errors.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 8.3\n", +"// To demostrate 4X4 Bit interleaving/de-interleving.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"BitStream= [0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1];//Last bit to first bit\n", +"\n", +"//solution\n", +"disp('Interleaving is performed by storing the data in a table containing rows and columns at the transmitter. The data is written in rows and transmitted in a vertical direction (according to columns). At the receiver, the data is written and read in the opposite manner. ')\n", +"\n", +"// Interleaver\n", +" Input1=[1 0 0 0 //Writing data row wise\n", +" 1 0 0 0\n", +" 1 1 1 0\n", +" 0 0 0 0];\n", +"disp('GIven Bit stream is')\n", +"disp(BitStream);\n", +"disp('Input to interleaver is')\n", +"disp(Input1);\n", +"\n", +"Output1=[0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1]; // Reading data column wise\n", +"disp('Output of interleaver is');\n", +"disp(Output1);\n", +"//De-interleaver\n", +" Input2=[1 1 1 0 //Writing o/p data row wise\n", +" 0 0 1 0 \n", +" 0 0 1 0\n", +" 0 0 0 0];\n", +" // Let From 6th to 9th bits have Burst Error \n", +" disp('Input to de-interleaver is');\n", +" disp(Input2);\n", +" //Output of deinterleaver\n", +" \n", +"Output2= [0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1]; \n", +"disp('Output of de-interleaver is')\n", +"disp(Output2);\n", +"disp( 'Bits with Burst error were from 6th to 9th. But in output of de-interleaver, they relocated to positions 3rd, 6th, 10th and 14th.');" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Wireless_Communications_and_Networking_by_V_Garg/9-Modulation_Schemes.ipynb b/Wireless_Communications_and_Networking_by_V_Garg/9-Modulation_Schemes.ipynb new file mode 100644 index 0000000..10a613a --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V_Garg/9-Modulation_Schemes.ipynb @@ -0,0 +1,405 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9: Modulation Schemes" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1: To_find_Eb_by_No_in_dB.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 9.1\n", +"// To calculate Eb/No in dB for BPSK and Coherent FSK.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Pe=10^-6;//Probability of error\n", +"e=2.71828; //Euler's Number\n", +"\n", +"//solution\n", +"// For BPSK\n", +"//Pe(=10^-6)=e^(-x)/(2*sqrt(%pi*x)); where x=Eb/No\n", +"\n", +"deff('y=f(x)','y=2.71828^(-x)/(2*sqrt(%pi*x))-10^-6');\n", +"[x,v,info]=fsolve(0.1,f);\n", +"\n", +"printf('Eb/No For BPSK is %.2f dB\n ',10*log10(x));\n", +"printf('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*log10(x)+3);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.2: To_calculate_amplitude_A_of_the_carrier_signal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 9.2\n", +"// To calculate amplitude A of a carrier signal.\n", +"\n", +"clc;\n", +"clear all;\n", +"\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", +"//solution\n", +"disp('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=sqrt(2*No*(Eb_No)*R);\n", +"printf(' Amplitude of a carrier signal is %.3f mV',A*1000);\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.3: To_calculate_final_phase_for_given_bitstream_for_given_modulation_method.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 9.3\n", +"// To calculate final phase for the pi/4-DQPSK modulation method.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"B=['00','10','01','11','01','00','11','10','10','01','01','00'];//Given Bit stream\n", +"\n", +"//solution\n", +"disp('Phase transition table for pi/4-DQPSK Modulation is given as ')\n", +"disp(' By Referring Table 9.1 on page No 266 i.e');\n", +"disp('Symbol Phase transition')\n", +"disp('00 => 45°');\n", +"disp('01 => 135°'); \n", +"disp('10 => -45°');\n", +"disp('11 => -135°');\n", +"disp('');\n", +"disp('sym Dell phi(k) Phi(k)')\n", +"//BitStream='001001110100111010010100';\n", +"\n", +"phase=0; //Taking initial phase as zero\n", +"for i=1:12\n", +"\n", +" \n", +" if(B(i)=='00')\n", +" phase=phase+45; \n", +" printf(' %s 45 %d \n',B(i),phase);\n", +" end\n", +"\n", +" if(B(i)=='01')\n", +" phase=phase+135;\n", +" printf(' %s 135 %d \n',B(i),phase);\n", +" end\n", +" if(B(i)=='10')\n", +" phase=phase-45;\n", +" printf(' %s -45 %d \n',B(i),phase);\n", +" end\n", +" if(B(i)=='11')\n", +" phase=phase-135;\n", +" printf(' %s -135 %d \n',B(i),phase);\n", +" \n", +"end\n", +"end\n", +"disp('');\n", +"printf('final phase for the pi/4-DQPSK modulation method for given bitstream is %d degree\n',phase);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4: EX9_4.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 9.4\n", +"// To calculate\n", +"//(a) the frequency shift between binary 1 and binary 0,\n", +"//(b) the transmitted frequencies if the carrier frequency is 900 MHz, and \n", +"//(c) the bandwidth efficiency in bps/Hz.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"CHBW=200; //Channel BW in KHz\n", +"R=270.83; //Data rate in kbps\n", +"Fc=900; //carrier frequency in MHz\n", +"\n", +"//solution\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", +"printf('The frequency shift between binary 1 and binary 0 is %.3f kHz\n ',FreqShift);\n", +"printf('Maximum and Minimum value of transmitted frequencies are %.4f mHz and %.4f mHz respectively\n ',Fh/1000,Fl/1000);\n", +"printf('Bandwidth efficiency is %.2f bps/Hz',BWEff);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.5: To_calculate_bit_error_probability_for_GMSK.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 9.5\n", +"// To calculate-\n", +"// a) 3-dB bandwidth for a Gaussian low-pass filter,\n", +"// b) 99.99% power bandwidth in the RF channel, and\n", +"// c) bit error probability for GMSK.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"R=270; //data rate in kbps\n", +"Eb_No=6; // in dB\n", +"GMSK=0.3; //Gaussian minimum shift keying\n", +"\n", +"//solution\n", +"Tb=1/R *10^3; //in microsec\n", +"B=GMSK/Tb;\n", +"printf('3-dB BW for a gaussian low pass filter is %.3f kHz\n',B*1000);\n", +"disp('The 3-dB bandwidth is 81.08 kHz. to determine the 99.99% power bandwidth, we use Table 9.3 to find that 1.41*Rb is the required value and degradation factor(beta)= 0.89');\n", +"PowerBW=1.41*R;\n", +"DegradFac=0.89;\n", +"Pe=erfc(sqrt(2*DegradFac*10^(0.1*Eb_No)));\n", +"printf(' Power bandwidth in the RF channel is %.1f kHz\n ',PowerBW);\n", +"printf('Bit error probability for GMSK is %f * 10^-5\n',Pe*10^5);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.6: To_calculate_bit_rate_of_modulator.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 9.6\n", +"// To calculate bit rate.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Rs=19200; //symbols per second\n", +"states=64;\n", +"\n", +"//solution\n", +"Bits_symbol=log2(states);\n", +"BitRate=Bits_symbol*Rs;\n", +"printf('Bit Rate of the modulator is %.1f kbps',BitRate/1000 );" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.7: To_determine_the_modulation_scheme_to_be_used_along_with_required_Eb_by_No.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 9.7\n", +"// To determine modulation scheme to be used and Eb/No.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Rb=144; //data rate in kbps\n", +"BW=36; //in MHz\n", +"Pb=3*10^-5;//probability of bit error\n", +"\n", +"//solution\n", +"Seff=Rb/BW; //spectral efficiency in bps/Hz\n", +"\n", +" M=2^(Rb/BW); //since the channel is band limited\n", +" disp('16-QAM (refer Equation 9.66) should be used as it is more efficient than 16-PSK (refer Equation 9.50)');\n", +"disp('');\n", +"\n", +"//since Q[sqrt(2*Eb_No)]=(1/2)*erfc[sqrt(Eb_No)] // refer page no 257 equ 9.35\n", +"deff('y=f(x)','y=(3/8)*erfc(sqrt((2/5)*x))-Pb'); //from eqn 9.66 and 9.35\n", +"\n", +"[x,v,info]=fsolve(0.1,f); //x=Eb_No\n", +"\n", +"printf('For a rectangular constellation (refer Figure 9.12), with a Gaussian channel and matched filter reception, the calculated Eb/No value is %.1f dB\n ',10*log10(x));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.8: Compare_the_performance_of_16PSK_with_16QAM.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 9.8\n", +"// To compare the performance of 16-PSK with 16-QAM.\n", +"\n", +"clc;\n", +"clear all;\n", +"\n", +"Pb=10^-8;//BER probability\n", +"\n", +"//solution\n", +"disp('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", +"deff('y=f(x)','y=0.25*erfc(sqrt(0.5*0.552^2*x))-Pb');\n", +"[x,v,info]=fsolve(0.1,f); //x=Eb_No\n", +"\n", +"printf('Using equation 9.50 we get Eb/No as %d dB (approx) \n ',round(10*log10(x)));\n", +"disp('For 16-QAM');\n", +"//Pb=0.75*Q(sqrt(0.8*Eb_No));\n", +"deff('y=f1(x1)','y=(3/8)*erfc(sqrt(0.4*x1))-Pb'); //x=Eb_No\n", +"//since Q[sqrt(2*Eb_No)]=(1/2)*erfc[sqrt(Eb_No)] // refer page no 257 equ 9.35\n", +"[x1,v1,info1]=fsolve(0.1,f1); //x=Eb_No\n", +"printf('Using equation 9.66 we get Eb/No as %d dB (approx)\n ',round(10*log10(x1)));\n", +"disp('');\n", +"printf('Thus 16-QAM has an advantage of about %d dB compared to 16-PSK \n ',10*log10(x)-10*log10(x1));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.9: EX9_9.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Exa 9.9\n", +"// To calculate-\n", +"// a) The total bandwidth required,\n", +"// b) The bandwidth efficiency,\n", +"// c) The Eb/No required, and\n", +"// d) No of carried bits per symbol.\n", +"\n", +"clc;\n", +"clear all;\n", +"\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", +"//solution\n", +"TotalBW=2*M*DelF;\n", +"nb=2*log2(M)/(M+3);\n", +"//Pe=7*Q(z) and z=approx(5.08)\n", +"z=5.08;\n", +"Eb_No=(z)^2/log2(M);\n", +"bits_sym=log2(M);\n", +"printf('Total bandwidth required is %d kHz \n ',TotalBW);\n", +"printf('The bandwidth efficiency is %.4f \n ',nb);\n", +"printf('The required Eb/No is %.3f dB \n ',10*log10(Eb_No));\n", +"printf('Carried bits per symbol are %d \n ',bits_sym);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |