0% found this document useful (0 votes)
320 views124 pages

Wireless Communications and Networking - V. Garg

This document provides a summary of Scilab codes written as a companion to the textbook "Wireless Communications and Networking" by V. Garg. The codes cover topics from the textbook including multiple access techniques, radio propagation, digital communications, cellular communications, modulation schemes, antennas, spread spectrum systems, and wireless networking. A total of 88 Scilab codes are listed with short descriptions indicating the chapter and example or concept they relate to from the textbook.

Uploaded by

kanny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
320 views124 pages

Wireless Communications and Networking - V. Garg

This document provides a summary of Scilab codes written as a companion to the textbook "Wireless Communications and Networking" by V. Garg. The codes cover topics from the textbook including multiple access techniques, radio propagation, digital communications, cellular communications, modulation schemes, antennas, spread spectrum systems, and wireless networking. A total of 88 Scilab codes are listed with short descriptions indicating the chapter and example or concept they relate to from the textbook.

Uploaded by

kanny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 124

Scilab Textbook Companion for

Wireless Communications and Networking


by V. Garg1

Created by
Vishal Changlani
Electronics and telecommunication engineering
Electronics Engineering
VESIT
College Teacher
None
Cross-Checked by
Spandana

July 31, 2019

1 Funded by a grant from the National Mission on Education through ICT,


http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilab
codes written in it can be downloaded from the ”Textbook Companion Project”
section at the website http://scilab.in
Book Description

Title: Wireless Communications and Networking

Author: V. Garg

Publisher: Morgan Kaufmann, San Francisco.

Edition: 2

Year: 2007

ISBN: 978-0-12-373580-5

1
Scilab numbering policy used in this document and the relation to the
above book.

Exa Example (Solved example)

Eqn Equation (Particular equation of the above book)

AP Appendix to Example(Scilab Code that is an Appednix to a particular


Example of the above book)

For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means
a scilab code whose theory is explained in Section 2.3 of the book.

2
Contents

List of Scilab Codes 4

2 Multiple Access Techniques 5

3 Radio Propagation and Propagation PathLoss Models 15

4 An Overview of Digital Communication and Transmission 24

5 Fundamentals of Cellular Communications 31

6 Multiple Access Techniques 41

8 Speech Coding and Channel Coding 50

9 Modulation Schemes 54

10 Antennas Diversity and Link Analysis 63

11 Spread Spectrum and CDMA Systems 70

12 Mobility Management in Wireless Networks 81

13 Security in Wireless Systems 84

14 Mobile Network and Transport Layer 86

3
17 Planning and Design of a Wireless Network 88

19 Wireless Personal Area Network Bluetooth 104

21 Wireless Local Area Network 106

24 Spreading Codes used in CDMA 115

4
List of Scilab Codes

Exa 2.1 To get Gos during Busy Hour . . . . . . . . 5


Exa 2.2 To find usage in CCS and Erlangs . . . . . . 5
Exa 2.3 To find offered load . . . . . . . . . . . . . . 6
Exa 2.4 To find traffic intensity . . . . . . . . . . . . 7
Exa 2.5 To find traffic intensity . . . . . . . . . . . . 7
Exa 2.6 To find traffic intensity in Erlangs and CCS
during eight hour period and busy hour . . 8
Exa 2.7 To find traffic per subscriber per BH in Erlangs 9
Exa 2.8 To find average number of BHCAs . . . . . 9
Exa 2.9 To calculate total traffic and number of MSCs
required . . . . . . . . . . . . . . . . . . . . 10
Exa 2.10 To find the designed cell capacity for the switch
and design Erlangs . . . . . . . . . . . . . . 11
Exa 2.11 To find number of service channels required
to handle the load . . . . . . . . . . . . . . 13
Exa 2.12 To find the number of supported mobile sub-
scribers . . . . . . . . . . . . . . . . . . . . 13
Exa 3.1 To find free space and reflected surface atten-
uations . . . . . . . . . . . . . . . . . . . . . 15
Exa 3.2 To find received signal power and SNR . . . 16
Exa 3.3 To find the allowable path loss . . . . . . . . 17
Exa 3.4 To find the distance between transmitter and
receiver . . . . . . . . . . . . . . . . . . . . 17
Exa 3.5 To determine type of fading and symbol dis-
tortion . . . . . . . . . . . . . . . . . . . . . 18
Exa 3.6 To determine number of fades per second and
maximum velocity of mobile . . . . . . . . . 19
Exa 3.7 To determine L50 pathloss . . . . . . . . . 20

5
Exa 3.8 To determine coverage radius of an access point 21
Exa 3.9 To calculate probability of exceeding signal
strength beyond receiver sensitivity . . . . . 22
Exa 3.10 To find required transmitter power in watts 23
Exa 4.1 To determine the sampling rates . . . . . . . 24
Exa 4.2 To determine the SNR . . . . . . . . . . . . 25
Exa 4.3 To calculate spacing between successive pulses
of multiplexed signal . . . . . . . . . . . . . 26
Exa 4.4 To calculate bits per PCM word sampling rate
resultant and symbol transmission rate . . . 27
Exa 4.5 To determine choice of modulation scheme . 28
Exa 4.6 To find choice of modulation scheme without
error correcting coding . . . . . . . . . . . . 29
Exa 5.1 To find system capacity . . . . . . . . . . . 31
Exa 5.2 To find reuse factor for AMPS and GSM . . 32
Exa 5.3 To calculate call capacity of cell and Mean S
by I for N as 4 and 7 and 12 . . . . . . . . . 33
Exa 5.4 To calculate the number of calls per hour per
cellsite . . . . . . . . . . . . . . . . . . . . . 35
Exa 5.5 To calculate calls per hour per cellsite and
mean S by I and spectral efficiency . . . . . 36
Exa 6.1 To calculate spectral efficiency of modulation 41
Exa 6.2 To find multiple access spectral efficiency for
FDMA . . . . . . . . . . . . . . . . . . . . . 42
Exa 6.3 To find multiple access spectral efficiency of
the TDMA system . . . . . . . . . . . . . . 42
Exa 6.4 To calculate the capacity and spectral effi-
ciency of TDMA system . . . . . . . . . . . 43
Exa 6.5 To calculate the frame efficiency and the num-
ber of channels per frame . . . . . . . . . . 44
Exa 6.6 To calculate capacity and spectral efficiency
of the DSCDMA system . . . . . . . . . . . 45
Exa 6.7 Compare DS CDMA and TDMA omnidirec-
tional cell . . . . . . . . . . . . . . . . . . . 46
Exa 6.8 To calculate minimum number of PN chips
per frequency word . . . . . . . . . . . . . . 47
Exa 6.9 To find normalized throughput for different
CSMA protocols . . . . . . . . . . . . . . . 47

6
Exa 6.10 To find data link protocol efficiency with dif-
ferent protocols . . . . . . . . . . . . . . . . 48
Exa 8.1 To calculate the gain in the link budget in dB 50
Exa 8.2 To calculate output of convolution encoder . 51
Exa 8.3 To demonstrate operations of converting burst
errors into bit errors . . . . . . . . . . . . . 52
Exa 9.1 To find Eb by No in dB . . . . . . . . . . . 54
Exa 9.2 To calculate amplitude A of the carrier signal 55
Exa 9.3 To calculate final phase for given bitstream
for given modulation method . . . . . . . . 55
Exa 9.4 To calculate frequency shift along with trans-
mitted frequencies and bandwidth efficiency 57
Exa 9.5 To calculate bit error probability for GMSK 58
Exa 9.6 To calculate bit rate of modulator . . . . . . 59
Exa 9.7 To determine the modulation scheme to be
used along with required Eb by No . . . . . 59
Exa 9.8 Compare the performance of 16PSK with 16QAM 60
Exa 9.9 To find total bandwitdth and its efficiency
along with required Eb by No and carried bits
per symbol . . . . . . . . . . . . . . . . . . 61
Exa 10.1 To find received signal power and SNR of an-
tenna . . . . . . . . . . . . . . . . . . . . . 63
Exa 10.2 To find received signal power and SNR of an-
tenna . . . . . . . . . . . . . . . . . . . . . 64
Exa 10.3 To calculate gain of antenna . . . . . . . . . 65
Exa 10.4 To determine 3dB beam width of an antenna 66
Exa 10.5 To calculate various parameters of helical an-
tenna . . . . . . . . . . . . . . . . . . . . . 66
Exa 10.6 To find probability that SNR will drop be-
low 10dB and compare result with a case of
without diversity . . . . . . . . . . . . . . . 67
Exa 10.7 To calculate minimum delay difference to suc-
cessfully resolve multipath components . . . 68
Exa 11.1 To calculate processing gain and improvemet
in information rate achieved . . . . . . . . . 70
Exa 11.2 Show that the transmitted signals to mobiles
1 2 and 3 are recovered at the mobile receivers
by despreading the resultant signal z . . . . 71

7
Exa 11.3 Minimum number of PN chips required for
each frequency symbol . . . . . . . . . . . . 73
Exa 11.4 To calculate data symbol transmitted per hop
and number of non overlapping hop frequencies 73
Exa 11.5 To consider various parameters of FHSS sys-
tems . . . . . . . . . . . . . . . . . . . . . . 74
Exa 11.6 To show how mobile1 will detect its informa-
tion using a two path rake receiver . . . . . 75
Exa 11.7 To calculate the time required by mobile to
make the required change . . . . . . . . . . 78
Exa 11.8 To determine the possible pair of soft slope
and add intercept values . . . . . . . . . . . 79
Exa 12.1 To evaluate the impact of LUs on the radio
resource and calculate MSC or VLR transac-
tion load . . . . . . . . . . . . . . . . . . . . 81
Exa 13.1 To generate public and private keys for RSA
algorithm . . . . . . . . . . . . . . . . . . . 84
Exa 13.2 To determine the secret encrypting key K us-
ing DH key exchange algorithm . . . . . . . 85
Exa 14.1 To determine minimum possible latency and
window size to achieve this latency . . . . . 86
Exa 14.2 To calculate upper bound of the throughput
for TP connection and throughput with re-
transmission due to errors . . . . . . . . . . 87
Exa 17.1 To calculate various parameters for GSM 1800
network . . . . . . . . . . . . . . . . . . . . 88
Exa 17.2 To estimate the data and voice traffic per sub-
scriber and per cell . . . . . . . . . . . . . . 89
Exa 17.3 To calculate data Erlangs along with TS uti-
lization and capacity . . . . . . . . . . . . . 91
Exa 17.4 To develop downlink and uplink cell budget
and calculate cell radius . . . . . . . . . . . 92
Exa 17.5 To calculate Uplink cell load factor and pole
capacity . . . . . . . . . . . . . . . . . . . . 93
Exa 17.6 To calculate uplink throughput for WCDMA
data service . . . . . . . . . . . . . . . . . . 94
Exa 17.7 To calculate downlink cell load factor and num-
ber of voice users per cell . . . . . . . . . . 94

8
Exa 17.8 To determine minimum signal power and max-
imum allowable path loss . . . . . . . . . . . 95
Exa 17.9 To develop a radio link budget for uplink and
downlink . . . . . . . . . . . . . . . . . . . . 96
Exa 17.10 To find the number of users supported on the
downlink of a WCDMA Network . . . . . . 97
Exa 17.11 find the average throughput for various cases 98
Exa 17.12 TO find the allowable throughput of a reverse
link of a CDMA 2000 . . . . . . . . . . . . . 100
Exa 17.13 To estimate average SINR of a HSDPA . . . 100
Exa 17.14 To find bandwidth of a Iub interface . . . . 101
Exa 17.15 To find the required RNCs . . . . . . . . . . 102
Exa 19.1 To find hopping rate and various other pa-
rameters of Bluetooth . . . . . . . . . . . . 104
Exa 19.2 To find the associated data rate of a symmet-
ric 1soot DM1 . . . . . . . . . . . . . . . . . 105
Exa 21.1 To find number of users supported by WLAN
and its bandwidth efficiency . . . . . . . . . 106
Exa 21.2 To find hopping bandwidth and various other
parameters for FH MFSK WLAN system . 107
Exa 21.3 To find bandwidth of a subchannel and vari-
ous other parameters of a OFDM WLAN sys-
tem . . . . . . . . . . . . . . . . . . . . . . 108
Exa 21.4 To find coverage of the AP . . . . . . . . . . 109
Exa 21.5 To calculate coded symbol and bit transmis-
sion rate per subscriber of the two modes . . 110
Exa 21.6 To find user data rate for HIPERLAN 2 . . 111
Exa 21.7 To determine the collision probability of a FH
packet . . . . . . . . . . . . . . . . . . . . . 111
Exa 21.8 To calculate min SIR and using this SIR and
other data calculate Rmax . . . . . . . . . . 112
Exa 21.9 To calculate Rmax for given interference sce-
narios . . . . . . . . . . . . . . . . . . . . . 113
Exa 21.10 To calculate Rmax for IEEE 802 11 FH and
DS devices . . . . . . . . . . . . . . . . . . . 114
Exa 24.1 To generate m sequence and demonstrate its
properties . . . . . . . . . . . . . . . . . . . 115
Exa 24.2 To generate second m sequence . . . . . . . 116

9
Chapter 2

Multiple Access Techniques

Scilab code Exa 2.1 To get Gos during Busy Hour

1 // Exa 2 . 1
2 // TO g e t Gos d u r i n g BH( Busy Hour ) .
3
4 clc ;
5 clear all ;
6
7 LC =10; // L o s t c a l l s
8 CC =380; // C a r r i e d c a l l s
9
10 // s o u t i o n
11 OC = LC + CC ; // T o t a l o f f e r e d c a l l s
12 // Gos=B l o c k i n g p r o b a b i l i t y =(number o f L o s t c a l l s /
T o t a l number o f o f f e r e d c a l l s )
13 Gos = LC / OC ;
14 printf ( ’ The Gos d u r i n g busy h o u r i s %f \n ’ , Gos ) ;

Scilab code Exa 2.2 To find usage in CCS and Erlangs

10
1 // Exa 2 . 2
2 // To f i n d u s a g e i n c a l l −s e c o n d s , CCS( centrum c a l l
s e c o n d s ) and E r l a n g s ) .
3
4 clc ;
5 clear all ;
6
7 Ht =5; // A v e r a g e h o l d i n g t i m e i n s e c o n d s
8 PC =450; // Peg c o u n t f o r one h o u r p e r i o d
9 OC =0; // O v e r f l o w c o u n t
10
11 // s o l u t i o n
12 // u s a g e ( E r l a n g s ) =( peg count − o v e r f l o w c o u n t ) ∗
Average h o l d i n g time ( i n hrs )
13 U =( PC - OC ) *(5/3600) ;
14 printf ( ’ Usage = %. 3 f E r l a n g s = ’ ,U ) ;
15
16 // IN CCS
17 Uccs = U *36; // u s a g e i n CCS
18 printf ( ’%. 1 f CCS = ’ , Uccs ) ;
19
20 Ucs = Uccs *100; // u s a g e i n c a l l −s e c o n d s
21 printf ( ’%d c a l l −s e c o n d s \n ’ , Ucs ) ;

Scilab code Exa 2.3 To find offered load

1 // Exa 2 . 3
2 //TO f i n d O f f e r e d Load .
3
4 clc ;
5 clear all ;
6
7 B =0.05; // B l o c k i n g ( 5%)
8 CL =3000; // C a r r i e d Load i n CCS
9

11
10 // S o l u t i o n
11 // O f f e r e d Load=C a r r i e d Load /(1 − B l o c k i n g ) ;
12 OL = CL /(1 - B ) ; // O f f e r e d Load i n CCS
13 printf ( ’ O f f e r e d l o a d i s %d CCS \n ’ , round ( OL ) ) ;
14 printf ( ’ O v e r f l o w i s %d CCS \n ’ , round ( OL ) - CL ) ;

Scilab code Exa 2.4 To find traffic intensity

1 // Exa 2 . 4
2 //To f i n d t r a f f i c intensity .
3
4 clc ;
5 clear all ;
6
7 Ht =120; // H o l d i n g time in seconds
8 CR =2; // c a l l r a t e per hour
9
10 // s o l u t i o n
11 // T r a f f i c I n t e n s i t y ( Erlangs ) = c a l l rate ∗ Holding
time ( in hrs ) ) ;
12 I = CR * Ht /3600; // T r a f f i c I n t e n s i t y
13 printf ( ’ T r a f f i c I n t e n s i t y i s %. 4 f E r l a n g s = %. 1 f CCS
\n ’ ,I , I *36) ;

Scilab code Exa 2.5 To find traffic intensity

1 // Exa 2 . 5
2 //To f i n d t r a f f i c i n t e n s i t y i n E r l a n g s and CCS .
3 // R e f e r −T a b l e 2 . 1 ( p a g e No 2 8 ) : T r a f f i c d a t a u s e d t o
estimate t r a f f i c intensity
4
5 clc ;
6 clear all ;

12
7
8 time =90; // i n m i n u t e s
9 calls =10; // no o f c a l l s i n 90 mins
10
11 // s o l u t i o n
12 CR = calls /( time /60) ; // c a l l a r r i v a l rate in c a l l s /
hour
13 tavg =(60+74+80+90+92+70+96+48+64+126) /10; //
average c a l l holding time in s e c per c a l l
14 I = CR *( tavg /3600) ; // t r a f f i c i n t e n s i t y i n
Erlangs
15 printf ( ’ T r a f f i c I n t e n s i t y i s %. 3 f E r l a n g s = %. 2 f CCS
\n ’ ,I , I *36) ;

Scilab code Exa 2.6 To find traffic intensity in Erlangs and CCS during eight hour

1 // Exa 2 . 6
2 //To f i n d t r a f f i c i n t e n s i t y i n E r l a n g s and CCS
d u r i n g e i g h t h o u r p e r i o d and busy h o u r ( 4 : 0 0 PM t o
5 : 0 0 PM) .
3 // R e f e r −T a b l e 2 . 2 ( p a g e no 2 8 ) : T r a f f i c on c u s t o m e r
l i n e b e t w e e n 9 : 0 0PM and 5 : 0 0PM
4
5 clc ;
6 clear all ;
7
8 time =8; // i n h o u r s
9 calls =11; // no o f c a l l s i n 90 mins p e r i o d
10
11 // s o l u t i o n
12 CR = calls / time ; // c a l l a r r i v a l r a t e i n c a l l s / h o u r
13 tavg =(3+10+7+10+5+5+1+5+15+34+5) /11; // a v e r a g e
c a l l h o l d i n g t i m e i n mins p e r c a l l
14 I = CR *( tavg /60) ; // t r a f f i c i n t e n s i t y i n E r l a n g s
15 printf ( ’ T r a f f i c I n t e n s i t y d u r i n g e i g h t h o u r p e r i o d

13
i s %. 3 f E r l a n g s = %. 1 f CCS \n ’ ,I , I *36) ;
16
17 // For Busy Hour i . e b e t w e e n 4 : 0 0PM and 5 : 0 0PM
18 CRB =2; // c a l l a r r i v a l r a t e d u r i n g busy h o u r i n
c a l l s / h o u r ( from t a b l e 2 . 2 )
19 tavgB =(34+5) /2; // a v e r a g e h o l d i n g t i m e d u r i n g Busy
Hour i n mins / c a l l ( from t a b l e 2 . 2 )
20 IB = CRB *( tavgB /60) ; // T r a f f i c I n t e n s i t y d u r i n g Busy
Hour
21 printf ( ’ T r a f f i c I n t e n s i t y d u r i n g busy h o u r i s %. 2 f
E r l a n g s = %. 1 f CCS ’ ,IB , IB *36) ;

Scilab code Exa 2.7 To find traffic per subscriber per BH in Erlangs

1 // Exa 2 . 8
2 // To f i n d t r a f f i c p e r u s e r p e r BH i n E r l a n g s .
3
4 clc ;
5 clear all ;
6
7 minutes =500; //No o f m i n u t e s u s e d p e r month p e r u s e r
8 Twork =0.9; // T r a f f i c D u r i n g Work day
9 TBH =0.1; // T r a f f i c d u r i n g busy h o u r
10 Days =20; //No o f w o r k d a y s i n a month
11
12 // s o l u t i o n
13 // Avg BH u s a g e p e r s u b s c r i b e r ( i n m i n u t e s ) = m i n u t e s
∗ Twork (TBH/ Days ) ;
14 Traffic = minutes * Twork *( TBH / Days ) ;
15 printf ( ’ T r a f f i c p e r u s e r p e r BH i s %. 4 f E r l a n g s \n ’ ,
Traffic /60) ;

Scilab code Exa 2.8 To find average number of BHCAs

14
1 // Exa : 2 . 8
2 // To f i n d a v e r a g e busy h o u r c a l l a t t e m p t s (BHCA’ s ) .
3
4 clc ;
5 clear all ;
6
7 minutes =500; //No o f m i n u t e s u s e d p e r month p e r u s e r
8 Twork =0.9; // T r a f f i c D u r i n g Work day
9 TBH =0.1; // T r a f f i c d u r i n g busy h o u r
10 Days =20; //No o f w o r k d a y s i n a month
11 MeanHT =100; // Mean h o l d i n g t i m e ( i n s e c s )
12
13 // s o l u t i o n
14 // Avg BH u s a g e p e r s u b s c r i b e r ( i n m i n u t e s ) = m i n u t e s
∗ Twork (TBH/ Days ) ;
15 //BHCAs= t r a f c ( i n E r l a n g s ) ∗ 3 6 0 0 / ( meanHT )
16
17 Traffic = minutes * Twork *( TBH / Days ) ;
18 BHCAs =( Traffic /60) *(3600/ MeanHT ) ;
19
20 printf ( ’ A v e r a g e Busy Hour c a l l a t t e m p t s a r e %. 2 f ’,
BHCAs ) ;

Scilab code Exa 2.9 To calculate total traffic and number of MSCs required

1 // Exa 2 . 9
2 // To f i n d t o t a l t r a f f i c i n E r l a n g s and no o f MScs
r e q u i r e d to handle i t .
3
4 clc ;
5 clear all ;
6
7 Tpopu =200000; // T o t a l p o p u l a t i o n
8 SP =0.25; // s u b s c r i b e r p e n e t r a t i o n
9 HT1 =100; // h o l d i n g t i m e f o r M o b i l e t o Land l i n e and

15
vicecersa
10 c1 =3; // Avg c a l l s / h r f o r M o b i l e t o Land l i n e and
vicecersa
11 HT2 =80; // For m o b i l e t o m o b i l e
12 c2 =4; // For m o b i l e t o m o b i l e
13 TMSC =1800; // t r a f f i c one msc can h o l d
14 TrafDist =0.9 // T r a f f i c d i s t r i b u t i o n f o r M o b i l e t o
Land l i n e and v i c e c e r s a
15
16 // s o l u t i o n
17 aM_L = c1 * HT1 /3600; // T r a f f i c G e n e r a t e d by S u b s c r i b e r
(M−L and L−M) .
18 aM_M = c2 * HT2 /3600; // T r a f f i c G e n e r a t e d by S u b s c r i b e r
(M−M) .
19 WlessSub = SP * Tpopu ; // t o t a l w i r e l e s s s u b s c r i b e r s
20 TotalTraffic = WlessSub * TrafDist * aM_L + WlessSub *(1 -
TrafDist ) * aM_M ;
21 MSCreqd = TotalTraffic / TMSC ;
22 if ( MSCreqd - int ( MSCreqd ) >0) // f o r r o u n d i n g o f t o n e x t
i n t e g e r e f 2.33 to 3
23 MSCreqd = MSCreqd +1;
24 end
25 printf ( ’ T o t a l T r a f f i c i s %. 1 f E r l a n g s \n ’ ,
TotalTraffic ) ;
26 printf ( ’ NO o f MSCs R e q u i r e d a r e %d \n ’ , int ( MSCreqd )
);

Scilab code Exa 2.10 To find the designed cell capacity for the switch and design

1 // Exa 2 . 1 0
2 // TO f i n d ABS/BH( a v e r a g e busy s e a s o n p e r busy h o u r )
c a l l i n g rates , design c e l l capacity f o r the
s w i t c h and d e s i g n E r l a n g s .
3
4 clc ;

16
5 clear all ;
6
7 Rlines =15000; // R e s i d e n t i a l l i n e s
8 Blines =80000; // B u s i n e s s l i n e s
9 PWElines =5000; //PBX, WATS, and F o r e i g n Exchange (FX)
lines
10 CR_R =2; // C a l l r a t e s f o r R l i n e s
11 CR_B =3; // c a l l r a t e s f o r B l i n e s
12 CR_PWE =10; // c a l l r a t e s f o r PWElines
13 HT_R =140; // a v e r a g e h o l d i n g t i m e f o r R l i n e s ( s e c )
14 HT_B =160; // a v e r a g e h o l d i n g t i m e f o r B l i n e s ( s e c )
15 HT_PWE =200; // a v e r a g e h o l d i n g t i m e f o r PWE l i n e s ( s e c )
16 Slines =100000; // no o f l i n e s c a r r i e d by s w i t c h
17 HD_ABS =1.5; // HD/ABS f o r t h e s w i t c h
18
19 // s o l u t i o n
20 percentR_lines = Rlines / Slines ;
21 percentB_lines = Blines / Slines ;
22 percentPWE_lines = PWElines / Slines ;
23 CCSR = CR_R * HT_R /100;
24 CCSB = CR_B * HT_B /100;
25 CCSPWE = CR_PWE * HT_PWE /100;
26
27 CR = CR_R * percentR_lines + CR_B * percentB_lines + CR_PWE *
percentPWE_lines ;
28 printf ( ’ The c a l l r a t e i s %. 1 f c a l l s p e r l i n e \n ’ , CR
);
29 CCS = CCSR * percentR_lines + CCSB * percentB_lines + CCSPWE *
percentPWE_lines ;
30 AvgHTperline = CCS *100/ CR ;
31 ABS_BH_calls = CR * Slines ;
32 ABS_BH_usage = CCS /36* Slines ;
33 printf ( ’ D e s i g n c e l l c a p a c i t y b a s e d on HD i s %d c a l l s
\n ’ , HD_ABS * ABS_BH_calls ) ;
34 printf ( ’ DESIGN E r l a n g s b a s e d on HD i s %d \n ’ , round (
HD_ABS * ABS_BH_usage ) ) ;

17
Scilab code Exa 2.11 To find number of service channels required to handle the loa

1 // Exa 2 . 1 1
2 // To f i n d o f f e r e d l o a d A and number o f s e r v i c e
channels r e q u i r e d to handle the load
3
4 clc ;
5 clear all ;
6
7 maxcalls_hour =4000; //maximum c a l l p e r h o u r
8 avgHT =160; // a v e r a g e h o l d i n g t i m e i n s e c
9 Gos =0.02;
10
11 // s o l u t i o n
12 A = maxcalls_hour * avgHT /3600; // o f f e r e d l o a d
13 printf ( ’ O f f e r e d l o a d A = %. 2 f E r l a n g s \n ’ ,A ) ;
14 // R e f e r i n g Appendix A i . e E r l a n g B t a b l e
15 disp ( ” For c a l c u l a t e d O f f e r e d l o a d and r e f e r r i n g
E r l a n g B t a b l e we g e t S e r v i c e c h a n n e l s a s 182
g i v i n g 1 6 8 . 3 E r l a n g s a t 2% b l o c k i n g ” ) ;

Scilab code Exa 2.12 To find the number of supported mobile subscribers

1 // Exa 2 . 1 2
2 // To c a l c u l a t e number o f m o b i l e s u b s c r i b e r s
supported f o r the given system .
3
4 clc ;
5 clear all ;
6
7 channels =50;
8 blocking =0.02;

18
9 HT =120; // a v e r a g e h o l d i n g t i m e inm s e c
10 BHcall =1.2; // i n c a l l s per hour
11
12 // s o l u t i o n
13 // R e f e r i n g E r l a n g B t a b l e i n a p p e n d i x A, For 50
c h a n n e l s a t 2% b l o c k i n g , t h e o f f e r e d l o a d = 4 0 . 2 6
Erlangs .
14 A =40.26;
15 B = A *(1 -0.02) ; // c a r r i e d l o a d
16 Avgtraffic_user = BHcall * HT /3600;
17 No_users = B / Avgtraffic_user ;
18 printf ( ’NO o f m o b i l e s u b s c r i b e r s s u p p o r t e d a r e %d \n
’ , round ( No_users ) ) ;

19
Chapter 3

Radio Propagation and


Propagation PathLoss Models

Scilab code Exa 3.1 To find free space and reflected surface attenuations

1 // Exa 3 . 1
2 // To d e t e r m i n e f r e e s p a c e and r e f l e c t e d s u r f a c e
attenuations .
3
4 clc ;
5 clear all ;
6
7 hb =100; // i n f e e t s ( h e i g h t o f BS a n t e n n a )
8 hm =5; // i n f e e t s ( h e i g h t o f m o b i l e a n t e n n a )
9 f =881.52; // i n MHz
10 lamda =1.116; // i n f e e t
11 d =5000; // i n f e e t
12 Gb =10^0.8; // 8dB ( BS a n t e n n a g a i n )
13 Gm =10^0; // 0dB ( M o b i l e a n t e n n a g a i n )
14
15 // s o l u t i o n
16 free_atten =(4* %pi * d / lamda ) ^2*( Gb * Gm ) ^ -1;
17 y = round (10* log10 ( free_atten ) ) ;
18 printf ( ’ F r e e s p a c e a t t e n u a t i o n i s %d dB \n ’ ,y ) ;

20
19 reflect_atten = ( d ^4/( hb * hm ) ^2) *( Gb * Gm ) ^ -1;
20 x = round (10* log10 ( reflect_atten ) ) ;
21 printf ( ’ R e f l e c t i n g s u r f a c e a t t e n u a t i o n i s %d dB \n
’ ,x ) ;

Scilab code Exa 3.2 To find received signal power and SNR

1 // Exa 3 . 2
2 //To d e t e r m i n e r e c e i v e d s i g n a l power and SNR r a t i o .
3
4 clc ;
5 clear all ;
6
7 d =8000; // D i s t a n c e b e t w e e n b a s e s t a t i o n and m o b i l e
station
8 f =1.5*10^9; // i n Hz
9 lamda =0.2; // i n m e t r e s
10 Pt =10; //BS t r a n s m i t t e d power i n w a t t s
11 Lo =8; // T o t a l s y s t e m l o s s e s i n dB
12 Nf =5; // M o b i l e r e c e i v e r n o i s e f i g u r e i n dB
13 T =290; // t e m p e r a t u r e i n d e g r e e k e l v i n
14 BW =1.25*10^6; // i n Hz
15 Gb =8; // i n dB
16 Gm =0; // i n dB
17 Hb =30; // i n m e t r e s
18 Hm =3; // i n m e t r e s
19 B =1.38*10^ -23; // Boltzmann ’ s c o n s t a n t
20
21 // s o l u t i o n
22 Free_Lp =20* log10 ( Hm * Hb / d ^2) ;
23 Pr = Free_Lp - Lo + Gm + Gb + Pt ; // i n dBW
24 Te = T *(3.162 -1) ;
25 Pn = B *( Te + T ) * BW ;
26 printf ( ’ R e c e i v e d s i g n a l power i s %d dBW \n ’ ,10* log10
( Pn ) ) ;

21
27 SNR = Pr -10* log10 ( Pn ) ;
28 printf ( ’ SNR r a t i o i s %d dB \n ’ , round ( SNR ) ) ;

Scilab code Exa 3.3 To find the allowable path loss

1 // Exa 3 . 3
2 //To d e t e r m i n e r e c e i v e d power and a l l o w a b l e Path
loss .
3
4 clc ;
5 clear all ;
6
7 d =3*1000; // i n m e t r e s
8 Y =4; // p a t h l o s s e x p o n e n t
9 Pt =4; // T r a n s m i t t e d power i n w a t t s
10 f =1800*10^6; // i n Hz
11 Shadow =10.5; // i n dB
12 d0 =100; // i n m e t r e s
13 P0 = -32; // i n dBm
14
15 // s o l u t i o n
16 disp ( ” U s i n g e q u a t i o n 3 . 1 1 and i n c l u d i n g shadow
e f f e c t we g e t ” )
17 Pr = P0 +10* Y * log10 ( d0 / d ) + Shadow ;
18 printf ( ’ R e c e i v e d power i s %. 1 f dBm \n ’ , Pr ) ;
19 path_loss =10* log10 ( Pt *1000) - Pr ;
20 printf ( ’ A l l o w a b l e p a t h l o s s i s %. 1 f dB \n ’ ,
path_loss ) ;

Scilab code Exa 3.4 To find the distance between transmitter and receiver

1 // Exa 3 . 4

22
2 //To d e t e r m i n e d i s t a n c e b e t w e e n t r a n s m i t t e r and
receiver .
3
4 clc ;
5 clear all ;
6
7 shadow =10; // i n dB
8 Lp =150; // i n dB
9
10 // s o l u t i o n
11 disp ( ” U s i n g e q u a t i o n g i v e n i n Problem i . e Lp
=133.2+40∗ l o g ( d ) we g e t , ” ) ;
12 d =10^(( Lp -10 -133.2) /40) ;
13 printf ( ” S e p a r a t i o n b e t w e e n t r a n s m i t t e r and
r e c e i v e r a s %. 2 f km ’ , d ) ;

Scilab code Exa 3.5 To determine type of fading and symbol distortion

1 // Exa 3 . 5
2 // To c a l c u l a t e c o h e r e n c e time , c o h e r e n c e bandwidth ,
t y p e o f Symbol d i s t o r t i o n and t y p e o f f a d i n g .
3
4 clc ;
5 clear all ;
6
7 v =60*0.44704; // . . mph t o mps
8 fc =860*10^6; // i n Hz
9 td =2*10^ -6; //RMS d e l a y s p r e a d i n s e c
10 c =3*10^8; // s p e e d o f l i g h t i n m/ s e c
11 Rs =19200; // Coded symbol r a t e i n bps
12
13 // s o l u t i o n
14 lamda = c / fc ;
15 fm = v / lamda ; //Maximum d o p p l e r s h i f t
16 tc =1/(2* %pi * fm ) ; // Channel c o h e r e n c e t i m e

23
17 printf ( ’ Channel c o h e r e n c e t i m e i s %. 4 f s e c \n ’ , tc ) ;
18 ts =1/ Rs ; // symbol i n t e r v a l
19 printf ( ’ Symbol i n t e r v a l i s %d m i c r o s e c \n ’ , ts *10^6)
;
20 disp ( ” As t h e symbol i n t e r v a l i s much s m a l l e r
compared t o t h e c h a n n e l c o h e r e n c e t i m e . So ,
Symbol d i s t o r t i o n i s m i n i m a l and f a d i n g i s s l o w . ”
);
21 disp ( ” ” ) ;
22 Bc =1/(2* %pi * td ) ;
23 printf ( ’ C o h e r e n c e Bandwidth i s %. 2 f kHz \n ’ , Bc
/1000)

Scilab code Exa 3.6 To determine number of fades per second and maximum velocity o

1 // Exa 3 . 6
2 // TO d e t e r m i n e NO o f f a d e s p e r s e c o n d , a v e r a g e f a d e
d u r a t i o n and maximum v e l o c i t y o f m o b i l e .
3
4 clc ;
5 clear all ;
6
7 p =1; // r e ection c o e f cient o f g r o u n d
8 c =3*10^8; // v e l o c i t y o f l i g h t i n f r e e s p a c e (m/ s e c )
9 e =2.71828; // E u l e r ’ s number
10 fm =20; // i n Hz
11 fc =900*10^6; // c a r r i e r f r e q u e n c y i n Hz
12
13 // s o l u t i o n
14 Nr = sqrt (2* %pi ) * fm * p * e ^ -( p ^2) ;
15 printf ( ’NO o f f a d e s p e r s e c o n d a r e %. 2 f \n ’ , Nr ) ;
16 Afd = e ^ -( p ^2) /( p * fm * sqrt (2* %pi ) ) ;
17 printf ( ’ A v e r a g e f a d e d u r a t i o n i s %. 4 f s e c \n ’ , Afd )
;
18 v = fm * c / fc ;

24
19 printf ( ’ Maximum v e l o c i t y o f m o b i l e i s %. 2 f m/ s e c =
%d Km/ h o u r \n ’ ,v , v *18/5) ;

Scilab code Exa 3.7 To determine L50 pathloss

1 // Exa 3 . 7
2 // To c a l c u l a t e L50 p a t h l o s s f o r a PCS s y s t e m u s i n g
Okumura and COST231 m o d e l s .
3
4 clc ;
5 clear all ;
6
7 d =[1 2 3 4 5]; // i n km
8 hb =30; // H e i g h t o f BS a n t e n n a i n m e t r e s
9 hm =2; // h e i g h t o f m o b i l e a n t e n n a i n m a t r e s
10 fc =900; // c a r r i e r f r e q u e n c y i n MHz
11 W =15; // s t r e e t w i d t h (m)
12 b =30; // d i s t a n c e b e t w e e n b u i l d i n g a l o n g r a d i o p a t h
(m)
13 phi =90; // i n c i d e n t a n g l e r e l a t i v e t o t h e s t r e e t
14 hr =30; // i n m
15
16 // s o l u t i o n
17 dellhm = hr - hm ;
18 // L50=L f+L r t s+Lms
19 // By COST 231 model
20 Lf =32.4+20* log10 ( d ) +20* log10 ( fc ) ;
21 L0 =4 -0.114*( phi -55) ;
22 Lrts = -16.9 -10* log10 ( W ) +10* log10 ( fc ) +20* log10 ( dellhm )
+ L0 ;
23 Lbsh = -18* log10 (11) ;
24 ka =54 -0.8* hb ;
25 dellhb = hb - hr ;
26 kd =18 -15* dellhb / dellhm ;
27 kf =4+0.7*( fc /925 -1) ;

25
28 Lms = Lbsh + ka + kd * log10 ( d ) + kf * log10 ( fc ) -9* log10 ( b ) ;
29 L50 =[0 0 0 0 0];
30 L50 = Lf + Lrts + Lms ;
31 // Okumura/ Hata model
32 ahm =(1.1* log10 ( fc ) -0.7) * hm -(1.56* log10 ( fc ) -0.8) ;
33 L_50 =69.55+26.16* log10 ( fc ) +(44.9 -6.55* log10 ( hb ) ) *
log10 ( d ) -13.82* log10 ( hb ) - ahm ;
34 xlabel ( ”DISTANCE FROM TRANSMITTER IN KM” ) ;
35 ylabel ( ”PATH LOSS i n dB” ) ;
36 plot2d (d ,[ L50 ’ , L_50 ’] ,[1 ,2]) ;
37 legends ([ ’ C o s t 231 Model ’ ; ’ Okumura/ Hata Model ’ ] ,[1 ,2
] , opt =2)
38 xgrid () ;
39 disp ( ” L50 v a l u e s by C o s t 231 model ” ) ;
40 printf ( ’%. 2 f %. 2 f %. 2 f %. 2 f %. 2 f \n ’ , L50 (1) , L50
(2) , L50 (3) , L50 (4) , L50 (5) ) ;
41 disp ( ” L50 v a l u e s bu Okumura/ Hata model ” ) ;
42 printf ( ’%. 2 f %. 2 f %. 2 f %. 2 f %. 2 f \n ’ , L_50 (1) ,
L_50 (2) , L_50 (3) , L_50 (4) , L_50 (5) ) ;
43 disp ( ” The r e s u l t s from t h e p l o t o f two m o d e l s shows
t h a t t h e c a l c u l a t e d p a t h l o s s w i t h t h e COST 231
model i s h i g h e r t h a n t h e v a l u e o b t a i n e d by t h e
Okumura/ Hata model . ” ) ;

Scilab code Exa 3.8 To determine coverage radius of an access point

1 // Exa 3 . 8
2 // TO f i n d c o v e r a g e r a d i u s o f an a c c e s s point .
3
4 clc ;
5 clear all ;
6
7 SNRmin =12; // i n dB
8 n =3; //No o f f l o o r s
9 Backgroundnoise = -115; //dBm

26
10 pt =100 // i n dBm
11
12 // s o l u t i o n
13 pt_db =10* log10 ( pt ) ;
14 Sr = Backgroundnoise + SNRmin ; // r e c e i v e r s e n s i t i v i t y
15 Lpmax = pt_db - Sr ;
16 // R e f e r i n g t a b l e 3 . 4
17 Lp_d0 =38; // r e f p a t h l o s s a t t h e f i r s t m e t e r ( dB )
18 Lf =15+4*( n -1) ; // s i g n a l a t t e n u a t i o n t h r o u g h n f l o o r s
19 y =3; // p a t h l o s s e x p o n e n t
20 X =10; // Shadowing e f f e c t ( dB )
21 d =10^(( Lpmax - Lp_d0 - Lf - X ) /30) ; //max a l l o w a b l e p a t h
loss
22 printf ( ’ C o v e r a g e r a d i u s o f an a c c e s s p o i n t = %d m \n
’ , round ( d ) ) ;

Scilab code Exa 3.9 To calculate probability of exceeding signal strength beyond r

1 // Exa 3 . 9
2 // To c a l c u l a t e p r o b a b i l i t y o f e x c e e d i n g s i g n a l
beyond t h e r e c e i v e r s e n s i t i v i t y .
3
4 clc ;
5 clear all ;
6
7 SSmean = -100; // s i g n a l s t r e n g t h (dBm)
8 Sr = -110; // r e c e i v e r s e n s i t i v i t y (dBm)
9 sd =10; // s t a n d a r d d e v i a t i o n ( dB )
10
11 // s o l u t i o n
12 P_Smin =(0.5 -0.5* erf (( Sr - SSmean ) /( sqrt (2) * sd ) ) ) ;
13 printf ( ’ p r o b a b i l i t y o f e x c e e d i n g s i g n a l beyond t h e
receiver sensitivity i s %. 2 f \n ’ , P_Smin ) ;

27
Scilab code Exa 3.10 To find required transmitter power in watts

1 // Exa 3 . 1 0
2 //To f i n d r e q u i r e d t o t a l t r a n s m i t power i n Watts .
3
4 clc ;
5 clear all ;
6
7 Lp =140; // p a t h l o s s e s i n dB
8 k =1.38*10^ -23; // B o l t z m a n n s c o n s t a n t (W/ K e l v i n −
Hz )
9 k_db =10* log10 ( k ) ;
10 f =900; // i n MHz
11 Gt =8; // t r a n s m i t t i n g a n t e n n a g a i n ( dB )
12 Gr =0; // r e c e i v e r a n t e n n a g a i n ( dB )
13 Ag =24; // g a i n o f r e c e i v e r a m p l i er i n dB
14 Fmargin =8; // Fade m a r g i n ( dB )
15 Nf =6; // N o i s e f i g u r e ( dB )
16 L0 =20; // o t h e r l o s s e s i n dB
17 Lf =12; // a n t e n n a f e e d l i n e l o s s i n dB
18 T =24.6; // T e m p e r a t u r e e x p r e s s e d i n dB
19 R =39.8; // d a t a r a t e i n dB
20 M =8; // o v e r a l l l i n k m a r g i n ( dB )
21 Eb_No =10; //dB
22
23 // s o l u t i o n
24 // From e q u a t i o n (3.54)
25 pt_db =M - Gt - Gr - Ag + Nf + T + k_db + Lp + Lf + L0 + Fmargin
+ R + Eb_No ;
26
27 Pt =10^( pt_db /10) ; //dB i n t o n o r m a l number
28 printf ( ’ T o t a l t r a n s m i t t e d power i s %d Watts \n ’ , Pt ) ;

28
Chapter 4

An Overview of Digital
Communication and
Transmission

Scilab code Exa 4.1 To determine the sampling rates

1 // Exa 4 . 1
2 // To c a l c u l a t e t h e s a m p l i n g r a t e .
3
4 clc ;
5 clear all ;
6
7 Fm =20; // i n KHz
8
9 // s o l u t i o n
10 disp ( ” An E n g i n e e r i n g v e r s i o n o f t h e N y q u i s t
s a m p l i n g r a t e : f s >=2.2∗ fm . ” ) ;
11 printf ( ’ T h e r e f o r e s a m p l i n g r a t e o f >= %d k s p s s h o u l d
be u s e d ’ ,(2.2* Fm ) ) ;
12 disp ( ” The s a m p l i n g r a t e f o r a compact d i s c d i g i t a l
a u d i o p l a y e r = 4 4 . 1 k s p s and f o r a s t u d i o q u a l i t y
a u d i o p l a y e r = 48 k s p s a r e u s e d . ” )

29
Scilab code Exa 4.2 To determine the SNR

1 // Exa 4 . 2
2 // To c a l c u l a t e SNR f o r L=32 , 6 4 , 1 2 8 , and 2 5 6 .
3
4 clc ;
5 clear all ;
6
7 Rt =1; // R e s i s t a n c e ( ohm )
8 //L= Number o f q u a n t i z a t i o n v a l u e s
9 L1 =32;
10 L2 =64;
11 L3 =128;
12 L4 =256;
13
14 // s o l u t i o n
15 // L=2ˆR i . e R=l o g 2 ( L ) ;
16 R1 = log2 ( L1 ) ;
17 R2 = log2 ( L2 ) ;
18 R3 = log2 ( L3 ) ;
19 R4 = log2 ( L4 ) ;
20
21 //P=Aˆ 2 / 2 ; // a v e r a g e power o f s i g n a l
22 // s i g ˆ 2 = 0 . 3 3 3 ∗Aˆ2∗2ˆ( −2∗ Rt ) ; // Avg q u a n t i z a t i o n
n o i s e power
23 //SNR=P/ s i g ˆ 2 ;
24 // SNR( dB ) =1.8+ 6R ;
25
26 SNR1 =1.8+6* R1 ;
27 SNR2 =1.8+6* R2 ;
28 SNR3 =1.8+6* R3 ;
29 SNR4 =1.8+6* R4 ;
30
31 printf ( ’ For L=32 , SNR i s %. 1 f dB\n ’ , SNR1 ) ;

30
32 printf ( ’ For L=64 , SNR i s %. 1 f dB\n ’ , SNR2 ) ;
33 printf ( ’ For L=128 , SNR i s %. 1 f dB\n ’ , SNR3 ) ;
34 printf ( ’ For L=256 , SNR i s %. 1 f dB\n ’ , SNR4 ) ;

Scilab code Exa 4.3 To calculate spacing between successive pulses of multiplexed

1 // Exa 4 . 3
2 // To c a l c u l a t e t h e s p a c i n g b e t w e e n s u c c e s s i v e
p u l s e s of the multiplexed s i g n a l .
3
4 clc ;
5 clear all ;
6
7 Fs =8*10^3; // i n Hz
8 Fm =3.4*10^3; // i n Hz
9 VCH =24; // v o i c e c h a n n e l s
10 SCH =1; // s u n c h r o n i z a t i o n c h a n n e l
11 PDur =1; // e x t r a p u l s e d u r a t i o n i n m i c r o s e c
12
13 // s o l u t i o n
14 Ts =1/( Fs ) ;
15 TimeCH = Ts /( VCH + SCH ) *10^6; // i n m i c r o s e c
16 printf ( ’ Time b e t w e e n t h e p u l s e s i s %d m i c r o s e c \n ’ ,(
TimeCH - PDur ) ) ;
17 //Now by u s i n g t h e e n g i n e e r i n g v e r s i o n o f N y q u i s t
rate sampling
18 NyquistRate =2.2* Fm ;
19 Ts1_microsec =1/ NyquistRate *10^6;
20 Tc = round ( Ts1_microsec ) /( VCH + SCH ) ;
21 printf ( ” Time b e t w e e n t h e p u l s e s by u s i n g
e n g i n e e r i n g v e r s i o n of Nyquist rate sampling is
%. 2 f m i c r o s e c \n ” ,( Tc - PDur ) ) ;

31
Scilab code Exa 4.4 To calculate bits per PCM word sampling rate resultant and sym

1 // Exa 4 . 4
2 // TO c a l c u l a t e :
3 // A) The minimum number o f b i t s / s a m p l e o r b i t s /PCM
word t h a t s h o u l d be u s e d .
4 // B) The minimum s a m p l i n g r a t e , and what i s t h e
resulting transmission rate .
5 // C) The PCM p u l s e o r symbol t r a n s m i s s i o n r a t e .
6
7 clc ;
8 clear all ;
9
10 Fm =3000; // h i g h e s t m o d u l a t i n g f r e q u e n c y i n s i g n a l ( Hz
)
11 M =32; // number o f p u l s e l e v e l s
12 b =5; // b i t s p e r symbol
13 p =0.01; // Q u a n t i z a t i o n d i s t o r t i o n
14
15 // s o l u t i o n
16 // 2ˆR = L >= 1/2P
17 // where R i s t h e number o f b i t s r e q u i r e d t o
represent quantization levels L
18 R = log10 (1/(2* p ) ) / log10 (2) ;
19 Fs =2* Fm ; // N y q u i s t s a m p l i n g c r i t e r i a ( s a m p l e s p e r
second )
20 fs = round ( R ) * Fs ;
21 Rs = fs / b ;
22 printf ( ’ The minimum number o f b i t s / s a m p l e o r b i t s /
PCM word t h a t s h o u l d be u s e d a r e %d ’ , round ( R ) ) ;
23 printf ( ’ \n The minimum s a m p l i n g r a t e i s %d s a m p l e s
p e r s e c o n d \n ’ , Fs ) ;
24 printf ( ’ The r e s u l t i n g t r a n s m i s s i o n r a t e i s %d bps \n
’ , fs ) ;
25 printf ( ’ The PCM p u l s e o r symbol t r a n s m i s s i o n r a t e i s
%d s y m b o l s / s e c \n ’ , Rs ) ;

32
Scilab code Exa 4.5 To determine choice of modulation scheme

1 // Exa 4 . 5
2 // To d e t e r m i n e c h o i c e o f m o d u l a t i o n scheme i f no−
e r r o r c o r r e c t i o n coding i s used .
3
4 clc ;
5 clear all ;
6
7 S_No =53; //dB−Hz
8 R =9.6*10^3; // bps
9 BW =4.8*10^3; // Khz
10 Pb =10^ -5; //BER<=10ˆ−5;
11
12 // s o l u t i o n
13 disp ( ” S i n c e t h e r e q u i r e d d a t a r a t e o f 9 . 6 kbps i s
more t h a n t h e a v a i l a b l e bandwidth o f 4 . 8 kHz , t h e
c h a n n e l i s bandwidth−l i m i t e d . ” ) ;
14 Eb_No = S_No -10* log10 ( R ) ; //dB
15 // Try f o r 8−PSK m o d u l a t i o n scheme
16 M =8;
17 Ps = log2 ( M ) * Pb ; //Max p s
18 Es_No = log2 ( M ) *10^(0.1* Eb_No ) ;
19 // Ps ( 8 ) =2∗Q( s q r t ( 2 ∗ Es No ) ∗ s i n ( %pi / 8 ) ) ;
20 // 2∗Q( s q r t ( 2 ∗ Eb No ) )= e r f c ( s q r t ( Eb No ) ) ; // R e f e r EQn
C ( 7 ) from a p p e n d i x C
21
22 Ps8 = erfc ( sqrt ( Es_No ) * sin ( %pi /8) ) ;
23 disp ( ” ” ) ;
24 printf ( ’ Symbol e r r o r r a t e i s g i v e n a s %. 5 f \n ’ , Ps )
;
25 printf ( ’ The r a t i o o f s i g n a l e n e r g y t o n o i s e i s %. 2 f
\n ’ , Es_No ) ;
26 printf ( ’ Symbol e r r o r r a t e f o r 8−PSK i s %. 5 f \n ’ ,

33
Ps8 ) ;
27 disp ( ” As symbol e r r o r r a t e f o r 8−PSK m o d u l a t i o n i s
l o w e r t h a n t h r e s h o l d v a l u e . so , We can u s e 8−PSK
modulation . ”)

Scilab code Exa 4.6 To find choice of modulation scheme without error correcting c

1 // Exa 4 . 6
2 // To d e t e r m i n e d e s i g n c h o i c e o f m o d u l a t i o n scheme
w i t h o u t an e r r o r c o r r e c t i o n c o d i n g .
3
4 clc ;
5 clear all ;
6
7 SNR =48; //dB−Hz
8 BW =45*10^3; // i n Hz
9 R =9.6*10^3; // bps
10 Pb =10^ -5; // B i t e r r o r r a t e
11 e =2.71828; // N a t u r a l e x p o n e n t e
12
13 // s o l u t i o n
14 disp ( ” s i n c e t h e a v a i l a b l e bandwidth o f 45 kHz i s
more t h a n a d e q u a t e t o s u p p o r t t h e r e q u i r e d d a t a
r a t e o f 9 . 6 kbps . ” ) ;
15 disp ( ” So , t h e c h a n n e l i s n o t bandwidth l i m i t e d ” ) ;
16 Eb_No = SNR -10* log10 ( R ) ;
17 //We t r y t h e 16−FSK m o d u l a t i o n scheme
18 M =16;
19
20 Es_No = log2 ( M ) * Eb_No ;
21 Ps =( M -1) /2* e ^( - Es_No /2) ;
22 // For o r t h o g o n a l s i g n a l l i n g
23 Ps16 =(2^ M -1) /(2^( M -1) ) * Pb ;
24 disp ( ” ” ) ;
25 printf ( ’ The maximum symbol e r r o r p r o b a b i l i t y i s %0

34
. 5 f \n ’ , Ps16 ) ;
26 printf ( ’ The symbol e r r o r p r o b a b i l i t y a c h i e v e d by 16−
PSK i s %. 9 f \n ’ , Ps ) ;
27 disp ( ” As a c h i e v e d symbol e r r o r p r o b a b i l i t y i s f a r
l e s s t h a n maximum t o l e r a b l e v a l u e ” ) ;
28 disp ( ” So , we can meet t h e g i v e n s p e c i cations for
t h i s power−l i m i t e d c h a n n e l w i t h a 16−FSK
m o d u l a t i o n scheme w i t h o u t any e r r o r −c o r r e c t i o n
coding ”)

35
Chapter 5

Fundamentals of Cellular
Communications

Scilab code Exa 5.1 To find system capacity

1 // Exa 5 . 1
2 // To C a l c u l a t e
3 // A) The s y s t e m c a p a c i t y i f t h e c l u s t e r s i z e , N (
r e u s e f a c t o r ) , i s 4 and
4 // B) The s y s t e m c a p a c i t y i f t h e c l u s t e r s i z e i s 7 .
5 // C) How many t i m e s would a c l u s t e r o f s i z e 4 have
t o be r e p l i c a t e d t o c o v e r t h e e n t i r e c e l l u l a r
area ?
6 // D) Does d e c r e a s i n g t h e r e u s e f a c t o r N i n c r e a s e
the system c a p a c i t y ?
7
8 clc ;
9 clear all ;
10
11 ToCH =960; // T o t a l a v a i l a b l e channels
12 Cellarea =6; // i n kmˆ2
13 Covarea =2000; // i n kmˆ2
14 N1 =4; // C l u s t e r S i z e
15 N2 =7; // C l u s t e r S i z e

36
16
17 // s o l u t i o n
18 Area1 = N1 * Cellarea ; // f o r N=4
19 Area2 = N2 * Cellarea ; // For N=7
20 No_of_clusters1 = round ( Covarea / Area1 ) ;
21 No_of_clusters2 = round ( Covarea / Area2 ) ;
22 No_of_CH1 = ToCH / N1 ; // No o f c h a n n e l s w i t h c l u s t e r
size 4
23 No_of_CH2 = ToCH / N2 ; // No o f c h a n n e l s w i t h c l u s t e r
size 7
24 SysCap1 = No_of_clusters1 * ToCH ;
25 SysCap2 = No_of_clusters2 * ToCH ;
26 printf ( ’ System C a p a c i t y w i t h c l u s t e r s i z e 4 i s %d
c h a n n e l s \n ’ , SysCap1 ) ;
27 printf ( ’ Number o f c l u s t e r s f o r c o v e r i n g t o t a l a r e a
w i t h N e q u a l s 4 a r e %d \n ’ , No_of_clusters1 ) ;
28 printf ( ’ System C a p a c i t y w i t h c l u s t e r s i z e 7 i s %d
c h a n n e l s \n ’ , SysCap2 ) ;
29 disp ( ” I t i s e v i d e n t when we d e c r e a s e t h e v a l u e
o f N from 7 t o 4 , we i n c r e a s e t h e s y s t e m
c a p a c i t y from 4 6 0 8 0 t o 7 9 6 8 0 c h a n n e l s . Thus ,
d e c r e a s i n g t h e r e u s e f a c t o r (N) i n c r e a s e s t h e
system c a p a c i t y . ”)

Scilab code Exa 5.2 To find reuse factor for AMPS and GSM

1 // Exa 5 . 2
2 // To c a l c u l a t e r e u s e f a c t o r f o r AMP and GSM s y s t e m s
.
3
4 clc ;
5 clear all ;
6
7 S_IAMP =18; // S/ I r a t i o i n dB
8 S_IGSM =12; // S/ I r a t i o i n dB

37
9 PPL =4; // p r o p o g a t i o n p a t h l o s s c o e f f i c i e n t
10
11 // s o l u t i o n
12 // U s i n g E q u a t i o n 5 . 1 6 on p a g e no 1 3 2 , we g e t
13 N_AMP =(1/3) *((6*10^(0.1* S_IAMP ) ) ^(2/ PPL ) ) ; // r e u s e
f a c t o r f o r AMPS
14
15 N_GSM =(1/3) *((6*10^(0.1* S_IGSM ) ) ^(2/ PPL ) ) ; // r e u s e
f a c t o r f o r GSM
16
17 printf ( ’ Reuse F a c t o r f o r AMP s y s t e m i s N = %f =
a p p r o x %d \n ’ , N_AMP , N_AMP +1) ;
18 printf ( ’ Reuse F a c t o r f o r GSM s y s t e m i s N = %f =
a p p r o x %d \n ’ , N_GSM , N_GSM +1) ;

Scilab code Exa 5.3 To calculate call capacity of cell and Mean S by I for N as 4

1 // Exa 5 . 3
2 // To c a l c u l a t e
3 // A) The number o f c a l l s p e r c e l l s i t e p e r h o u r ( i .
e . , c a l l capacity of c e l l ) .
4 // B) Mean S/ I r a t i o f o r c e l l r e u s e f a c t o r e q u a l t o
4 , 7 and 1 2 .
5
6 clc ;
7 clear all ;
8
9 VCH =395; // T o t a l v o i c e c h a n n e l s
10 CallHT =120; // a v e r a g e c a l l h o l d i n g t i m e i n s e c
11 Blocking =0.02; // 2%
12 PPL =4; // p r o p o g a t i o n p a t h l o s s c o e f f i c i e n t
13 N1 =4 // r e u s e f a c t o r
14 N2 =7; // r e u s e f a c t o r
15 N3 =12; // r e u s e f a c t o r
16

38
17 // s o l u t i o n
18 No_of_VCH1 = VCH / N1 ; // f o r r e u s e f a c t o r N1
19 No_of_VCH2 = VCH / N2 ; // f o r r e u s e f a c t o r N2
20 No_of_VCH3 = VCH / N3 ; // f o r r e u s e f a c t o r N3
21 printf ( ’ \nNO o f v o i c e c h a n n e l s f o r N=4 a r e %d ’ , round
( No_of_VCH1 ) ) ;
22 printf ( ’ \nNO o f v o i c e c h a n n e l s f o r N=7 a r e %d ’ , round
( No_of_VCH2 ) ) ;
23 printf ( ’ \nNO o f v o i c e c h a n n e l s f o r N=12 a r e %d\n ’ ,
round ( No_of_VCH3 ) ) ;
24 disp ( ” U s i n g t h e E r l a n g −B t r a f c t a b l e ( s e e
Appendix A) f o r 99 c h a n n e l s w i t h 2% b l o c k i n g , we
nd a t r a f c l o a d o f 87 E r l a n g s . ” ) ;
25 TrafLoad1 =87.004;
26 Carryload1 =(1 - Blocking ) * TrafLoad1 ;
27 disp ( ” U s i n g t h e E r l a n g −B t r a f c t a b l e ( s e e
Appendix A) f o r 56 c h a n n e l s w i t h 2% b l o c k i n g , we
nd a t r a f c l o a d o f 4 5 . 8 8 E r l a n g s . ”);
28 TrafLoad2 =45.877;
29 Carryload2 =(1 - Blocking ) * TrafLoad2 ;
30 disp ( ” U s i n g t h e E r l a n g −B t r a f c t a b l e ( s e e
Appendix A) f o r 33 c h a n n e l s w i t h 2% b l o c k i n g , we
nd a t r a f c l o a d o f 2 4 . 6 E r l a n g s . ”);
31 TrafLoad3 =24.629;
32 Carryload3 =(1 - Blocking ) * TrafLoad3 ;
33 // To f i n d c e l l c a p a c i t y
34 Ncall1 = Carryload1 *3600/ CallHT ; // C a l l s p e r h o u r p e r
cell
35 Ncall2 = Carryload2 *3600/ CallHT ;
36 Ncall3 = Carryload3 *3600/ CallHT ;
37 printf ( ’ \ n c a l l s p e r h o u r p e r c e l l f o r N=4 a r e %d ’ ,
round ( Ncall1 ) ) ;
38 printf ( ’ \ n c a l l s p e r h o u r p e r c e l l f o r N=7 a r e %d ’ ,
round ( Ncall2 ) ) ;
39 printf ( ’ \ n c a l l s p e r h o u r p e r c e l l f o r N=12 a r e %d \
n ’ , Ncall3 ) ;
40 // To f i n d S BY I
41 // N= ( 1 / 3 ) [ 6 ∗ ( S / I ) ] ˆ ( 2 / PPL)

39
42 S_I1 =10*( PPL /2) *( log10 ( N1 ) - log10 (1/3) -(2/ PPL ) * log10
(6) ) ; // Mean S / I ( dB )
43
44 S_I2 =10*( PPL /2) *( log10 ( N2 ) - log10 (1/3) -(2/ PPL ) * log10
(6) ) ;
45 S_I3 =10*( PPL /2) *( log10 ( N3 ) - log10 (1/3) -(2/ PPL ) * log10
(6) ) ;
46
47 printf ( ’ \nMean S / I ( dB ) f o r N=4 i s %. 1 f ’ , S_I1 ) ;
48 printf ( ’ \nMean S / I ( dB ) f o r N=7 i s %. 1 f ’ , S_I2 ) ;
49 printf ( ’ \nMean S / I ( dB ) f o r N=12 i s %. 1 f ’ , S_I3 ) ;

Scilab code Exa 5.4 To calculate the number of calls per hour per cellsite

1 // Exa 5 . 4
2 // To f i n d t h e number o f c a l l s p e r h o u r p e r c e l l
site .
3
4 clc ;
5 clear all ;
6
7 spectrum =12.5*10^6; // i n Hz
8 CHBW =200*10^3; // i n Hz
9 N =4; // r e u s e f a c t o r
10 Blocking =0.02; // 2%
11 callHT =120; // a v e r a g e c a l l h o l d i n g t i m e i n s e c
12 PPL =4; // p r o p o g a t i o n p a t h l o s s c o e f f i c i e n t
13 CntrlCH =3; //No o f c o n t r o l c h a n n e l s
14 Ts =8; // No o f v o i c e c h a n n e l s p e r RF c h a n n e l
15
16 // s o l u t i o n
17 No_ofVCH =(( spectrum * Ts ) /( CHBW * N ) ) - CntrlCH ;
18 printf ( ’ \n No o f v o i c e c h a n n e l s f o r N=4 a r e %d ’ ,
No_ofVCH ) ;
19 disp ( ” ” ) ;

40
20 disp ( ” U s i n g t h e E r l a n g −B t r a f c t a b l e f o r 122
c h a n n e l s w i t h 2% b l o c k i n g , we nd a t r a f c
l o a d o f 110 E r l a n g s . ” ) ;
21 TrafLoad =110;
22 CarryLoad =(1 - Blocking ) * TrafLoad ;
23 Ncall = CarryLoad *3600/ callHT ;
24 printf ( ’ \n C a l l s p e r h o u r p e r c e l l f o r N=4 a r e %d
c a l l s / h o u r / c e l l \n ’ , round ( Ncall ) ) ;
25 S_I =10*( PPL /2) *( log10 ( N ) - log10 (1/3) -(2/ PPL ) * log10 (6)
);
26 printf ( ’ \n Mean S/ I ( dB ) f o r N=4 i s %. 1 f dB \n ’ , S_I )
;

Scilab code Exa 5.5 To calculate calls per hour per cellsite and mean S by I and s

1 // Exa 5 . 5
2 // To C a l c u l a t e :
3 // a ) The c a l l s p e r h o u r p e r c e l l s i t e
4 // b ) The mean S / I r a t i o
5 // c ) The s p e c t r a l e f ciency i n E r l a n g /km2/MHz
6 // f o r Reuse r a t i o = 4 , 7 , 1 2 and f o r o m n i d i r e c t i o n a l ,
120 d e g r e e and 60 d e g r e e a n t e n n a s y s t e m s .
7
8 clc ;
9 clear all ;
10
11 VCH =395; // T o t a l a l l o c a t e d v o i c e c h a n n e l s
12 CHBW =30; // i n kHz
13 Spectrum =12.5; // i n MHz
14 CallHT =120; // A v e r a g e c a l l h o l d i n g t i m e i n s e c
15 Blocking =0.02; // 2%
16 PL =40; // s l o p e o f p a t h l o s s i n d B p e r d e c a d e
17
18 // s o l u t i o n
19 disp ( ”We c o n s i d e r o n l y t h e rst tier interferers

41
and n e g l e c t t h e e f f e c t s o f c o c h a n n e l i n t e r f e r e n c e
from t h e s e c o n d and o t h e r h i g h e r t i e r s . ” ) ;
20 //FOR 120 d e g r e e s e c t o r i z a t i o n
21 //N=4
22 VCH11 =( VCH /(4*3) ) ;
23 OffLoad11 =24.629; // O f f e r e d t r a f c l o a d p e r
s e c t o r from E r l a n g −B t a b l e ( Appendix A)
24 Load_site11 =3* OffLoad11 ;
25 CarLoad11 =(1 - Blocking ) * Load_site11 ;
26 Calls_hr_site11 = CarLoad11 *3600/ CallHT ;
27 R11 = sqrt ( CarLoad11 /0.52) ;
28 Seff11 = CarLoad11 /(2.6* Spectrum * R11 ^2) ;
29 S_I11 = PL * log10 ( sqrt (3*4) ) -10* log10 (2) ;
30 //N=7
31 VCH12 =( VCH /(3*7) ) ;
32 OffLoad12 =12.341; // O f f e r e d t r a f c l o a d p e r
s e c t o r from E r l a n g −B t a b l e ( Appendix A)
33 Load_site12 =3* OffLoad12 ;
34 CarLoad12 =(1 - Blocking ) * Load_site12 ;
35 Calls_hr_site12 = CarLoad12 *3600/ CallHT ;
36 R12 = sqrt ( CarLoad12 /0.52) ;
37 Seff12 = CarLoad12 /(2.6* Spectrum * R12 ^2) ;
38 S_I12 = PL * log10 ( sqrt (3*7) ) -10* log10 (2) ;
39 //N=12
40 VCH13 = VCH /(3*12) ;
41 OffLoad13 =5.842; // O f f e r e d t r a f c l o a d p e r
s e c t o r from E r l a n g −B t a b l e ( Appendix A)
42 Load_site13 =3* OffLoad13 ;
43 CarLoad13 =(1 - Blocking ) * Load_site13 ;
44 Calls_hr_site13 = CarLoad13 *3600/ CallHT ;
45 R13 = sqrt ( CarLoad13 /0.52) ;
46 Seff13 = CarLoad13 /(2.6* Spectrum * R13 ^2) ;
47 S_I13 = PL * log10 ( sqrt (3*12) ) -10* log10 (2) ;
48 // For o m n i d i r e c t i o n a l
49 //N=4
50 VCH21 = VCH /(4) ;
51 OffLoad21 =87.004; // O f f e r e d t r a f c l o a d p e r
s e c t o r from E r l a n g −B t a b l e ( Appendix A)

42
52 Load_site21 = OffLoad21 ;
53 CarLoad21 =(1 - Blocking ) * Load_site21 ;
54 Calls_hr_site21 = CarLoad21 *3600/ CallHT ;
55 R21 = sqrt ( CarLoad21 /0.52) ;
56 Seff21 = CarLoad21 /(2.6* Spectrum * R21 ^2) ;
57 S_I21 = PL * log10 ( sqrt (3*4) ) -10* log10 (6) ;
58 //N=7
59 VCH22 = VCH /(7) ;
60 OffLoad22 =46.817; // O f f e r e d t r a f c load per
s e c t o r from E r l a n g −B t a b l e ( Appendix A)
61 Load_site22 = OffLoad22 ;
62 CarLoad22 =(1 - Blocking ) * Load_site22 ;
63 Calls_hr_site22 = CarLoad22 *3600/ CallHT ;
64 R22 = sqrt ( CarLoad22 /0.52) ;
65 Seff22 = CarLoad22 /(2.6* Spectrum * R22 ^2) ;
66 S_I22 = PL * log10 ( sqrt (3*7) ) -10* log10 (6) ;
67 //N=12
68 VCH23 = VCH /(12) ;
69 OffLoad23 =24.629; // O f f e r e d t r a f c l o a d p e r
s e c t o r from E r l a n g −B t a b l e ( Appendix A)
70 Load_site23 = OffLoad23 ;
71 CarLoad23 =(1 - Blocking ) * Load_site23 ;
72 Calls_hr_site23 = CarLoad23 *3600/ CallHT ;
73 R23 = sqrt ( CarLoad23 /0.52) ;
74 Seff23 = CarLoad23 /(2.6* Spectrum * R23 ^2) ;
75 S_I23 = PL * log10 ( sqrt (3*12) ) -10* log10 (6) ;
76 // For 60 d e g r e e S e c t o r i z a t i o n
77 //N=3
78 VCH31 = VCH /(6*3) ;
79 OffLoad31 =14.902; // O f f e r e d t r a f c l o a d p e r
s e c t o r from E r l a n g −B t a b l e ( Appendix A)
80 Load_site31 =6* OffLoad31 ;
81 CarLoad31 =(1 - Blocking ) * Load_site31 ;
82 Calls_hr_site31 = CarLoad31 *3600/ CallHT ;
83 R31 = sqrt ( CarLoad31 /0.52) ;
84 Seff31 = CarLoad31 /(2.6* Spectrum * R31 ^2) ;
85 S_I31 = PL * log10 ( sqrt (3*3) ) -10* log10 (1) ;
86 //N=4

43
87 VCH32 = VCH /(6*4) ;
88 OffLoad32 =10.656; // O f f e r e d t r a f c l o a d p e r
s e c t o r from E r l a n g −B t a b l e ( Appendix A)
89 Load_site32 =6* OffLoad32 ;
90 CarLoad32 =(1 - Blocking ) * Load_site32 ;
91 Calls_hr_site32 = CarLoad32 *3600/ CallHT ;
92 R32 = sqrt ( CarLoad32 /0.52) ;
93 Seff32 = CarLoad32 /(2.6* Spectrum * R32 ^2) ;
94 S_I32 = PL * log10 ( sqrt (3*4) ) -10* log10 (1) ;
95 //N=7
96 VCH33 = VCH /(6*7) ;
97 OffLoad33 =5.084; // O f f e r e d t r a f c l o a d p e r
s e c t o r from E r l a n g −B t a b l e ( Appendix A)
98 Load_site33 =6* OffLoad33 ;
99 CarLoad33 =(1 - Blocking ) * Load_site33 ;
100 Calls_hr_site33 = CarLoad33 *3600/ CallHT ;
101 R33 = sqrt ( CarLoad33 /0.52) ;
102 Seff33 = CarLoad33 /(2.6* Spectrum * R33 ^2) ;
103 S_I33 = PL * log10 ( sqrt (3*7) ) -10* log10 (1) ;
104 //N=12
105 VCH34 = VCH /(6*12) ;
106 OffLoad34 =2.227; // O f f e r e d t r a f c l o a d p e r
s e c t o r from E r l a n g −B t a b l e ( Appendix A)
107 Load_site34 =6* OffLoad34 ;
108 CarLoad34 =(1 - Blocking ) * Load_site34 ;
109 Calls_hr_site34 = CarLoad34 *3600/ CallHT ;
110 R34 = sqrt ( CarLoad34 /0.52) ;
111 Seff34 = CarLoad34 /(2.6* Spectrum * R34 ^2) ;
112 S_I34 = PL * log10 ( sqrt (3*12) ) -10* log10 (1) ;
113
114 printf ( ’ For O m n i d i r e c t i o n a l
Calls per hour per cellsite Mean S I r a t i o
S p e c r t a l E f f i c i e n c y \n ’ )
115 printf ( ’ For N=4 %d
%. 1 f %. 3 f \n ’ ,
Calls_hr_site21 , S_I21 , Seff21 ) ;
116 printf ( ’ For N=7 %d
%. 1 f %. 3 f \n ’ ,

44
Calls_hr_site22 , S_I22 , Seff22 ) ;
117 printf ( ’ For N=12 %d
%. 1 f %. 3 f \n ’ ,
Calls_hr_site23 , S_I23 , Seff23 ) ;
118
119 printf ( ’ For 120 deg s e c t o r
Calls per hour per cellsite Mean S I r a t i o
S p e c r t a l E f f i c i e n c y \n ’ )
120 printf ( ’ For N=4 %d
%. 1 f %. 3 f \n ’ ,
Calls_hr_site11 , S_I11 , Seff11 ) ;
121 printf ( ’ For N=7 %d
%. 1 f %. 3 f \n ’ ,
Calls_hr_site12 , S_I12 , Seff12 ) ;
122 printf ( ’ For N=12 %d
%. 1 f %. 3 f \n ’ ,
Calls_hr_site13 , S_I13 , Seff13 ) ;
123
124 printf ( ’ For 60 deg S e c t o r
Calls per hour per cellsite Mean S I r a t i o
S p e c r t a l E f f i c i e n c y \n ’ )
125 printf ( ’ For N=3 %d
%. 1 f %. 3 f \n ’ ,
Calls_hr_site31 , S_I31 , Seff31 ) ;
126 printf ( ’ For N=4 %d
%. 1 f %. 3 f \n ’ ,
Calls_hr_site32 , S_I32 , Seff32 ) ;
127 printf ( ’ For N=7 %d
%. 1 f %. 3 f \n ’ ,
Calls_hr_site33 , S_I33 , Seff33 ) ;
128 printf ( ’ For N=12 %d
%. 1 f %. 3 f \n ’ ,
Calls_hr_site34 , S_I34 , Seff34 ) ;

45
Chapter 6

Multiple Access Techniques

Scilab code Exa 6.1 To calculate spectral efficiency of modulation

1 // Exa 6 . 1
2 // To c a l c u l a t e s p e c t r a l e f ciency .
3
4 clc ;
5 clear all ;
6
7 Area =8; // i n kmˆ2
8 Cover =4000; // i n kmˆ2
9 CallBH =1.2; // Avg c a l l s d u r i n g BH
10 HT =100; // Avg h o l d i n g t i m e i n s e c
11 Block =0.02; // B l o c k i n g =2%
12 N =4; // F r e q u e n c y r e u s e f a c t o r
13 Spectrum =12.5; // i n MHz
14 CHBW =200; // i n kHz
15 User_CH =8; //No o f u s e r s p e r RF c h a n n e l
16
17 // s o l u t i o n
18 RFCH = Spectrum *1000/ CHBW ;
19 TCH = int ( RFCH ) * User_CH ;
20 SigCH =3; //No o f s i g n a l l i n g c h a n n e l s p e r c e l l
21 TCH_cell = TCH /N - SigCH ;

46
22 Cells = Cover / Area ;
23 OffLoad =108.4; // i n E r l a n g s
24 printf ( ’ U s i n g E r l a n g −B T a b l e s , T o t a l t r a f f i c o f f e r e d
by %d c h a n n e l s a t 0 . 0 2 b l o c k i n g = %. 1 f E r l a n g s /
c e l l \n ’ , TCH_cell , OffLoad *(1 - Block ) ) ;
25 CarLoad = OffLoad *(1 - Block ) ;
26 Calls_hr_cell = CarLoad *3600/ HT ;
27 MaxUser_hr_cell = Calls_hr_cell / CallBH ;
28 Seff = CarLoad * Cells /( Spectrum * Cover ) ;
29 printf ( ’ S p e c t r a l E f f i c i e n c y i s %. 2 f E r l a n g s /MHz/km
ˆ2\ n ’ , Seff ) ;

Scilab code Exa 6.2 To find multiple access spectral efficiency for FDMA

1 // Exa 6 . 2
2 // To c a l c u l a t e s p e c t r a l e f f i c i e n c y o f FDMA.
3
4 clc ;
5 clear all ;
6
7 TCH =395; // T r a f f i c C h a n n e l s
8 SysBW =12.5; // i n MHz
9 CHspace =30; // i n kHz
10
11 // s o l u t i o n
12 Eff = TCH * CHspace /( SysBW *1000) ;
13 printf ( ’ M u l t i p l e a c c e s s s p e c t r a l e f f i c i e n c y o f FDMA
System i s %. 3 f \n ’ , Eff ) ;

Scilab code Exa 6.3 To find multiple access spectral efficiency of the TDMA system

1 // Exa 6 . 3
2 // To c a l c u l a t e s p e c t r a l e f f i c i e n c y o f TDMA.

47
3
4 clc ;
5 clear all ;
6
7 Tf =40; // Frame d u r a t i o n i n msec
8 Mt =6; // Frames p e r s l o t
9 Bu =30; // bandwidth (KHz) o f an i n d i v i d u a l u s e r d u r i n g
h i s or her time s l o t
10 Nu =395; // number o f u s e r s s h a r i n g t h e same t i m e
s l o t i n t h e system , but h a v i n g a c c e s s t o
d i f f e r e n t f r e q u e n c y sub−bands
11 Bw =12.5; // i n MHz
12 DR =16.2; // Data r a t e i n kbps
13 FDur =40; // Frame d u r a t i o n i n msec
14 slots =6; //No o f s l o t s p e r t i m e f r a m e
15 IndiRate =16.2; // I n d i v i d u a l d a t a r a t e i n kbps
16 Srate =13; // S p e e c h r a t e i n kbps
17
18 // s o l u t i o n
19 TimeSlot =( Srate / IndiRate ) *( FDur / slots ) ;
20 Seff = TimeSlot * slots * Bu * Nu /( FDur * Bw *1000) ;
21 printf ( ’ M u l t i p l e a c c e s s s p e c t r a l e f f i c i e n c y o f TDMA
i s %. 2 f \n ’ , Seff ) ;
22 printf ( ’ The o v e r h e a d p o r t i o n o f t h e f r a m e i s %d
p e r c e n t \n ’ , round ((1 - Seff ) *100) ) ;

Scilab code Exa 6.4 To calculate the capacity and spectral efficiency of TDMA syst

1 // Exa 6 . 4
2 // To c a l c u l a t e c a p a c i t y and s p e c t r a l e f ciency of
a TDMA s y s t e m .
3
4 clc ;
5 clear all ;
6

48
7 nb =0.9; //BW e f f i c i e n c y f a c t o r
8 u =2; // B i t E f f i c i e n c y w i t h QPSK
9 Vf =1; // V o i c e a c t i v i t y f a c t o r
10 BW =12.5; // i n MHz
11 IR =16.2; // i n kbps
12 N =19; // f r e q u e n c y r e u s e f a c t o r
13
14 // s o l u t i o n
15 Nu = nb * u * BW *1000/( Vf * IR * N ) ; // number o f c h a n n e l s (
mobile users ) per c e l l
16 Seff = int ( Nu ) * IR /( BW *1000) ;
17 printf ( ’ C a p a c i t y o f s y s t e m i s %d m o b i l e u s e r s p e r
c e l l \n ’ , Nu ) ;
18 printf ( ’ S p e c t r a l e f f i c i e n c y o f TDMA s y s t e m i s %. 3 f
b i t / s e c /Hz\n ’ , Seff ) ;

Scilab code Exa 6.5 To calculate the frame efficiency and the number of channels p

1 // Exa 6 . 6
2 // To c a l c u l a t e f r a m e e f ciency and t h e number o f
channels per frame .
3
4 clc ;
5 clear all ;
6
7 Nr =2; // number o f r e f e r e n c e b u r s t s p e r f r a m e
8 Nt =24; // number o f t r a f c b u r s t s ( s l o t s ) p e r
f r a m e ( 1 2 0 msec )
9 FL =120; // Frame l e n g t h i n msec
10 Br =148; // number o f o v e r h e a d b i t s p e r r e f e r e n c e
burst
11 Bp =34; // number o f o v e r h e a d b i t s p e r p r e a m b l e p e r
slot
12 Bg =8.25; // number o f e q u i v a l e n t b i t s i n e a c h g u a r d
time i n t e r v a l

49
13 Tf =120; // f r a m e d u r a t i o n i n msec
14 Rrf =270.83333333; // b i t r a t e o f t h e RF c h a n n e l i n
kbps
15 R =22.8; // b i t r a t e o f e a c h c h a n n e l i n kbps
16
17 // s o l u t i o n
18 B0 = Nr *(8* Br ) + Nt *(8* Bp ) +( Nt + Nr ) *(8* Bg ) ; // The number
o f overhead b i t s per frame
19 Bt = FL *10^ -3* Rrf *10^3; // The t o t a l number o f b i t s p e r
frame
20 Eff =(1 - B0 / Bt ) *100;
21 CH_Frame =( Eff /100) * Rrf / R ; //No o f c h a n n e l s / f r a m e
22 printf ( ’ The f r a m e e f f i c i e n c y i s %. 2 f p e r c e n t \n ’ , Eff
);
23 printf ( ’ Number o f c h a n n e l s / f r a m e a r e %d\n ’ , round (
CH_Frame ) ) ;

Scilab code Exa 6.6 To calculate capacity and spectral efficiency of the DSCDMA sy

1 // Exa 6 . 6
2 // To c a l c u l a t e c a p a c i t y and s p e c t r a l e f ciency of
t h e DS−CDMA s y s t e m .
3
4 clc ;
5 clear all ;
6
7 nb =0.9; // bandwidth e f ciency
8 nf =0.45; // f r e q u e n c y r e u s e e f ciency
9 Cd =0.8; // c a p a c i t y d e g r a d a t i o n f a c t o r
10 Vf =0.4; // v o i c e a c t i v i t y f a c t o r
11 Eb_I0 =7; // d e s i r e d e n e r g y −to − i n t e r f e r e n c e r a t i o i n
dB
12 L =1; // e f ciency o f s e c t o r −a n t e n n a i n c e l l
13 BW =12.5; // One way s y s t e m BW i n MHz
14 R =16.2; // I n f o r m a t i o n r a t e i n kbps

50
15
16 // s o l u t i o n
17 Eb_I =10^( Eb_I0 *0.1) ; //To c o n v e r t from dB t o a n o r m a l
value
18 Nu =( nf * nb * Cd * L / Vf ) *( BW *1000/( Eb_I * R ) ) ; // C a p a c i t y o f
system
19 Seff = round ( Nu ) * R /(12.5*10^3) ;
20 printf ( ’ C a p a c i t y o f s y s t e m i s %d m o b i l e u s e r s p e r
c e l l \n ’ , round ( Nu ) ) ;
21 printf ( ’ S p e c t r a l e f f i c i e n c y o f TDMA s y s t e m i s %. 3 f
b i t s / s e c /Hz\n ’ , Seff ) ;
22
23 disp ( ” I n t h e s e c a l c u l a t i o n s , an o m n i d i r e c t i o n a l
a n t e n n a i s assumed . I f a t h r e e s e c t o r antenna ( i
. e . , G=3) i s u s e d a t a c e l l s i t e w i t h lamda (
e f f i c i e n c y o f s e c t o r −a n t e n n a i n a c e l l )= 2 . 6 , t h e
c a p a c i t y w i l l be i n c r e a s e d t o 325 m o b i l e u s e r s
p e r c e l l , and s p e c t r a l e f ciency w i l l be 0 . 4 2 1
b i t s / s e c /Hz . ” )

Scilab code Exa 6.7 Compare DS CDMA and TDMA omnidirectional cell

1 // Exa 6 . 7
2 // U s i n g t h e d a t a g i v e n i n Exa 6 . 4 and 6 . 6 , compare
t h e c a p a c i t y o f t h e DS−CDMA and TDMA
omnidirectional cell .
3
4 clc ;
5 clear all ;
6
7 // Given Data from Exa 6 . 4 and Exa 6 . 6
8 Cd =0.8; // c a p a c i t y d e g r a d a t i o n f a c t o r
9 R =16.2; // Data r a t e i n kbps
10 Eb_I0 =7; // i n dB
11 Eb_I =10^( Eb_I0 *0.1) ; //To c o n v e r t from dB t o a n o r m a l

51
value
12 Vf =0.4; // v o i c e a c t i v i t y f a c t o r
13 u =2; // B i t E f f i c i e n c y
14 IR =16.2; // i n kbps
15 N =19; // f r e q u e n c y r e u s e f a c t o r
16 nf =0.45; // f r e q u e n c y r e u s e e f ciency
17
18 // s o l u t i o n
19 Ncdma_by_Ntdma = Cd * N * nf * IR /( Eb_I * Vf * u * R ) ;
20 printf ( ’ The r a t i o o f c a p a c i t y o f DS−CDMA t o TDMA i s
%. 3 f \n ’ , Ncdma_by_Ntdma ) ;

Scilab code Exa 6.8 To calculate minimum number of PN chips per frequency word

1 // Exa 6 . 8
2 // To c a l c u l a t e t h e minimum number o f PN c h i p s t h a t
a r e r e q u i r e d f o r e a c h f r e q u e n c y word .
3
4 clc ;
5 clear all ;
6
7 Bss =600; // Hopping bandwidth i n MHz
8 stepsize =400; // i n Hz
9
10 // s o l u t i o n
11 No_of_Tones = Bss *10^6/ stepsize ;
12 Min_chips_required = log2 ( No_of_Tones ) ;
13 printf ( ’ Minimum number o f c h i p s r e q u i r e d a r e %d
c h i p s \n ’ , Min_chips_required ) ;

Scilab code Exa 6.9 To find normalized throughput for different CSMA protocols

1 // Exa 6 . 9

52
2 // To c a l c u l a t e the normalized throughput with :
3 // ( a ) an u n s l o t t e d n o n p e r s i s t e n t ,
4 // ( b ) a s l o t t e d p e r s i s t e n t , and
5 // ( c ) a s l o t t e d 1− p e r s i s t e n t CSMA p r o t o c o l .
6
7 clc ;
8 clear all ;
9
10 e =2.71828; // E u l e r ’ s number
11 Tprop =0.4; //Max p r o p o g a t i o n d e l a y i n s e c
12 R =10; // d a t a r a t e i n Mbps
13 PackLen =400; // p a c k e t l e n g t h i n b i t s
14
15 // s o l u t i o n
16 Tp = PackLen / R ; // p a c k e t t r a n s m i s s i o n t i m e i n m i c r o s e c
17 a = Tprop / Tp ;
18 G = Tp *10^ -6* R *10^6/ PackLen ; // n o r m a l i z e d o f f e r e d
t r a f c load
19 // S l o t t e d n o n p e r s i s t e n t
20 S0 = a * G * e ^( - a * G ) /(1 - e ^( - a * G ) + a ) ; // n o r m a l i z e d
throughput
21 // U n s l o t t e d n o n p e r s i s t e n t
22 S1 = G * e ^( - a * G ) /(1+(2* a ) + e ^( - a * G ) ) ; // n o r m a l i z e d
throughput
23 // S l o t t e d 1− p e r s i s t e n t
24 S2 = G * e ^( - G *(1+ a ) ) *(1+ a - e ^( - a * G ) ) /((1+ a ) *(1 - e ^( - a * G ) )
+ a * e ^( - G *(1+ a ) ) ) ; // n o r m a l i z e d t h r o u g h p u t
25 printf ( ’ The N o r m a l i z e d t h r o u g h p u t w i t h an u n s l o t t e d
non p e r s i s t e n t , a s l o t t e d p e r s i s t e n t and a
s l o t t e d 1− p e r s i s t e n t CSMA p r o t o c o l a r e \n %. 3 f ,%
. 3 f and %. 3 f r e s p e c t i v e l y \n ’ ,S0 , S1 , S2 ) ;

Scilab code Exa 6.10 To find data link protocol efficiency with different protocol

1 // Exa 6 . 1 0

53
2 // To c a l c u l a t e t h e d a t a l i n k p r o t o c o l e f ciency
with
3 // ( 1 ) S t o p and Wait p r o t o c o l f u l l duplex ,
4 // ( 2 ) SRP w i t h window s i z e W=8 , and
5 // ( 3 ) Go−Back−N p r o t o c o l w i t h window s i z e W=8.
6
7 clc ;
8 clear all ;
9
10 Tprop =4; //maximum p r o p o g a t i o n d e l a y i n s e c
11 R =10; // d a t a r a t e i n Mbps
12 PackLen =400; // d a t a p a c k e t l e n g t h i n b i t s
13 ACK =20; // l e n g t h o f ACK p a c k e t i n b i t s
14 Tproc =1; // p r o c e s s i n g t i m e ( s e c )
15 p =0.01; // p r o b a b i l i t y t h a t a d a t a p a c k e t o r i t s ACK
can be c o r r u p t e d d u r i n g t r a n s m i s s i o n
16
17 // s o l u t i o n
18 Tp = PackLen / R ; // p a c k e t t r a n s m i s s i o n t i m e i n m i c r o s e c
19 Ta = ACK / R ; // t r a n s m i s s i o n t i m e f o r an ACK i n
microsec
20 T = Tp +2* Tprop +2* Tproc + Ta ; // t o t a l t i m e f o r
t r a n s m i s s i o n time
21 // S t o p and w a i t ARQ
22 Eff0 =(1 - p ) * Tp /((1 - p ) * T + p * Tp ) ;
23 //SRP w i t h window s i z e W=8
24 W =8;
25 Eff1 =(2+ p *( W -1) ) /(2+ p *(3* W -1) ) ;
26 //Go−Back−N p r o t o c o l w i t h window s i z e W=8
27 Eff2 =1/(1+ W *( p /(1 - p ) ) ) ;
28 printf ( ’ The d a t a l i n k p r o t o c o l e f f i c i e n c y w i t h S t o p
and Wait p r o t o c o l , SRP and GBN a r e \n %. 3 f , %. 3 f
abd %. 3 f r e s p e c t i v e l y \n ’ , Eff0 , Eff1 , Eff2 ) ;

54
Chapter 8

Speech Coding and Channel


Coding

Scilab code Exa 8.1 To calculate the gain in the link budget in dB

1 // Exa 8 . 1
2 // To c a l c u l a t e c o v e r a g e g a i n i n dB .
3
4 clc ;
5 clear all ;
6
7 Pdiff = -3; // i n dB
8 AMR1 =12.2; // i n kbps
9 AMR2 =7.95; // i n kbps
10 AMR3 =4.75; // i n kbps
11
12 // s o l u t i o n
13 //CG( dB ) =10 l o g { (DPDCH( kbps )+DPCCH) / (DPDCH(AMR b i t
r a t e ( kbps ) )+ DPCCH) }
14 CG1 =10* log10 (( AMR1 + AMR1 *10^( Pdiff /10) ) /( AMR2 + AMR1
*10^( Pdiff /10) ) ) ;
15 CG2 =10* log10 (( AMR1 + AMR1 *10^( Pdiff /10) ) /( AMR3 + AMR1
*10^( Pdiff /10) ) ) ;
16 printf ( ’ By r e d u c i n g t h e AMR b i t r a t e from 1 2 . 2 t o

55
7 . 9 5 kbps c o v e r a g e g a i n becomes %. 2 f dB \n ’ , CG1 )
;
17 printf ( ’ By r e d u c i n g t h e AMR b i t r a t e from 7 . 9 5 t o
4 . 7 5 kbps c o v e r a g e g a i n becomes %. 2 f dB \n ’ , CG2 )
;

Scilab code Exa 8.2 To calculate output of convolution encoder

1 // Exa 8 . 2
2 // To c a l c u l a t e t h e o u t p u t o f t h e e n c o d e r .
3
4 clc ;
5 clear all ;
6
7 K =4; // c o n s t r a i n t l e n g t h
8 r =1/2; // c o d e r a t e ( n / k )
9 x = poly (0 , ” x ” ) ; // D e f i n i n g x a s a p l o y n o m i a l v a r i a b l e
10 G1 =1+ x ^2+ x ^3;
11 G2 =1+ x + x ^2+ x ^3;
12 in =[1 0 1 1 1]; // i n p u t ( f i r s t b i t f i r s t )
13
14 // s o l u t i o n
15 // w i t h r e f e r e n c e t o F i g 8 . 9 on p a g e no 239
16 g1 =[1 0 1 1]; // c o n v e r t i n g from G1 p o l y n o m i a l t o b i t
form
17 g2 =[1 1 1 1]; // // c o n v e r t i n g from G2 p o l y n o m i a l t o
b i t form
18 x1 = round ( convol ( g1 , in ) ) ;
19 x2 = round ( convol ( g2 , in ) ) ;
20 V1 = modulo ( x1 ,2) ;
21 V2 = modulo ( x2 ,2) ;
22 disp ( ” M u l t i p l e x i n g t h e V1 and V2 t o g e t r e q u i r e d
output s e q u e n c e as ”);
23 a =5;
24 for i = 1:5

56
25 printf ( ’%d%d ’ , V2 ( a ) , V1 ( a ) ) ;
26 a =a -1;
27
28 end

Scilab code Exa 8.3 To demonstrate operations of converting burst errors into bit

1 // Exa 8 . 3
2 // To d e m o s t r a t e 4X4 B i t i n t e r l e a v i n g / de− i n t e r l e v i n g
.
3
4 clc ;
5 clear all ;
6
7 BitStream = [0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1]; // L a s t
b i t to f i r s t bit
8
9 // s o l u t i o n
10 disp ( ” I n t e r l e a v i n g i s p e r f o r m e d by s t o r i n g t h e d a t a
i n a t a b l e c o n t a i n i n g r o w s and c o l u m n s a t t h e
t r a n s m i t t e r . The d a t a i s w r i t t e n i n r o w s and
transmitted in a v e r t i c a l d i r e c t i o n ( according to
c o l u m n s ) . At t h e r e c e i v e r , t h e d a t a i s w r i t t e n
and r e a d i n t h e o p p o s i t e manner . ” )
11
12 // I n t e r l e a v e r
13 Input1 =[1 0 0 0 // W r i t i n g d a t a
row w i s e
14 1 0 0 0
15 1 1 1 0
16 0 0 0 0];
17 disp ( ” GIven B i t s t r e a m i s ” )
18 disp ( BitStream ) ;
19 disp ( ” I n p u t t o i n t e r l e a v e r i s ” )
20 disp ( Input1 ) ;

57
21
22 Output1 =[0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1]; //
R e a d i n g d a t a column w i s e
23 disp ( ” Output o f i n t e r l e a v e r i s ” ) ;
24 disp ( Output1 ) ;
25 //De− i n t e r l e a v e r
26 Input2 =[1 1 1 0 // W r i t i n g o / p d a t a
row w i s e
27 0 0 1 0
28 0 0 1 0
29 0 0 0 0];
30 // L e t From 6 t h t o 9 t h b i t s have B u r s t E r r o r
31 disp ( ” I n p u t t o de− i n t e r l e a v e r i s ” ) ;
32 disp ( Input2 ) ;
33 // Output o f d e i n t e r l e a v e r
34
35 Output2 = [0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1];
36 disp ( ” Output o f de− i n t e r l e a v e r i s ” )
37 disp ( Output2 ) ;
38 disp ( ” B i t s w i t h B u r s t e r r o r w e r e from 6 t h t o 9 t h .
But i n o u t p u t o f de−i n t e r l e a v e r , t h e y r e l o c a t e d
t o p o s i t i o n s 3 rd , 6 th , 10 t h and 14 t h . ” ) ;

58
Chapter 9

Modulation Schemes

Scilab code Exa 9.1 To find Eb by No in dB

1 // Exa 9 . 1
2 // To c a l c u l a t e Eb/No i n dB f o r BPSK and C o h e r e n t
FSK .
3
4 clc ;
5 clear all ;
6
7 Pe =10^ -6; // P r o b a b i l i t y o f e r r o r
8 e =2.71828; // E u l e r ’ s Number
9
10 // s o l u t i o n
11 // For BPSK
12 // Pe (=10ˆ −6)=e ˆ(−x ) / ( 2 ∗ s q r t ( %pi ∗ x ) ) ; where x=Eb/No
13
14 deff ( ’ y=f ( x ) ’ , ’ y =2.71828ˆ( − x ) / ( 2 ∗ s q r t ( %pi ∗ x ) ) −10ˆ−6 ’
);
15 [x ,v , info ]= fsolve (0.1 , f ) ;
16
17 printf ( ’ Eb/No For BPSK i s %. 2 f dB\n ’ ,10* log10 ( x ) ) ;
18 printf ( ’FSK r e q u i r e s 3 dB more i n t e r m s o f Eb/N0 t o
g i v e t h e same Pe a s BPSK s o i t comes o u t t o be %

59
. 2 f dB ’ ,10* log10 ( x ) +3) ;

Scilab code Exa 9.2 To calculate amplitude A of the carrier signal

1 // Exa 9 . 2
2 // To c a l c u l a t e a m p l i t u d e A o f a c a r r i e r s i g n a l .
3
4 clc ;
5 clear all ;
6
7 Pe =10^ -6; // P r o b a b i l i t y o f e r r o r
8 No =10^ -10; // PSD i n W/Hz
9 R =100*10^3; // d a t a r a t e i n bps
10
11 // s o l u t i o n
12 disp ( ”From Example 9 . 1 , Eb/N0= 1 0 . 5 4 dB ( 1 1 . 3 2 ) f o r
Pe=10ˆ−6 ” ) ;
13 // T h e r e f o r e
14 Eb_No =11.32; // From Exa . 9 . 1
15 // Eb/No = Aˆ 2 / ( 2 ∗ No∗R) ;
16 A = sqrt (2* No *( Eb_No ) * R ) ;
17 printf ( ’ A m p l i t u d e o f a c a r r i e r s i g n a l i s %. 3 f mV ’ ,A
*1000) ;

Scilab code Exa 9.3 To calculate final phase for given bitstream for given modulat

1 // Exa 9 . 3
2 // To c a l c u l a t e f i n a l p h a s e f o r t h e p i /4−DQPSK
m o d u l a t i o n method .
3
4 clc ;
5 clear all ;
6

60
7 B =[ ’ 00 ’ , ’ 10 ’ , ’ 01 ’ , ’ 11 ’ , ’ 01 ’ , ’ 00 ’ , ’ 11 ’ , ’ 10 ’ , ’ 10 ’ , ’ 01 ’
, ’ 01 ’ , ’ 00 ’ ]; // Given B i t s t r e a m
8
9 // s o l u t i o n
10 disp ( ” Phase t r a n s i t i o n t a b l e f o r p i /4−DQPSK
Modulation i s given as ”)
11 disp ( ” By R e f e r r i n g T a b l e 9 . 1 on p a g e No 266 i . e ” ) ;
12 disp ( ” Symbol Phase t r a n s i t i o n ” )
13 disp ( ” 00 => 45 ” ) ;
14 disp ( ” 01 => 135 ” ) ;
15 disp ( ” 10 => −45 ” ) ;
16 disp ( ” 11 => −135 ” ) ;
17 disp ( ” ” ) ;
18 disp ( ”sym Dell phi ( k ) Phi ( k ) ” )
19 // B i t S t r e a m = ’ 0 0 1 0 0 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 0 ’ ;
20
21 phase =0; // Taking i n i t i a l phase as zero
22 for i =1:12
23
24
25 if ( B ( i ) == ’ 00 ’ )
26 phase = phase +45;
27 printf ( ’ %s 45 %d \n ’ ,B ( i ) ,
phase ) ;
28 end
29
30 if ( B ( i ) == ’ 01 ’ )
31 phase = phase +135;
32 printf ( ’ %s 135 %d \n ’ ,B ( i ) ,
phase ) ;
33 end
34 if ( B ( i ) == ’ 10 ’ )
35 phase = phase -45;
36 printf ( ’ %s −45 %d \n ’ ,B ( i ) ,
phase ) ;
37 end
38 if ( B ( i ) == ’ 11 ’ )
39 phase = phase -135;

61
40 printf ( ’ %s −135 %d \n ’ ,B ( i ) ,
phase ) ;
41
42 end
43 end
44 disp ( ” ” ) ;
45 printf ( ’ f i n a l
p h a s e f o r t h e p i /4−DQPSK m o d u l a t i o n
method f o r g i v e n b i t s t r e a m i s %d d e g r e e \n ’ , phase )
;

Scilab code Exa 9.4 To calculate frequency shift along with transmitted frequencie

1 // Exa 9 . 4
2 // To c a l c u l a t e
3 // ( a ) t h e f r e q u e n c y s h i f t b e t w e e n b i n a r y 1 and
binary 0 ,
4 // ( b ) t h e t r a n s m i t t e d f r e q u e n c i e s i f t h e c a r r i e r
f r e q u e n c y i s 900 MHz, and
5 // ( c ) t h e bandwidth e f ciency i n bps /Hz .
6
7 clc ;
8 clear all ;
9
10 CHBW =200; // Channel BW i n KHz
11 R =270.83; // Data r a t e i n kbps
12 Fc =900; // c a r r i e r f r e q u e n c y i n MHz
13
14 // s o l u t i o n
15 FreqShift =0.5* R ;
16 // T r a n s m i t t e d F r e q u e n c i e s
17 Fh = Fc *1000+0.25* R ; //Max
18 Fl = Fc *1000 -0.25* R ; // Min
19 BWEff = R / CHBW ;
20 printf ( ’ The f r e q u e n c y s h i f t b e t w e e n b i n a r y 1 and
b i n a r y 0 i s %. 3 f kHz \n ’ , FreqShift ) ;

62
21 printf ( ’ Maximum and Minimum v a l u e o f t r a n s m i t t e d
f r e q u e n c i e s a r e %. 4 f mHz and %. 4 f mHz
r e s p e c t i v e l y \n ’ , Fh /1000 , Fl /1000) ;
22 printf ( ’ Bandwidth e f f i c i e n c y i s %. 2 f bps /Hz ’ , BWEff ) ;

Scilab code Exa 9.5 To calculate bit error probability for GMSK

1 // Exa 9 . 5
2 // To c a l c u l a t e −
3 // a ) 3−dB bandwidth f o r a G a u s s i a n low−p a s s lter
,
4 // b ) 9 9 . 9 9% power bandwidth i n t h e RF c h a n n e l , and
5 // c ) b i t e r r o r p r o b a b i l i t y f o r GMSK.
6
7 clc ;
8 clear all ;
9
10 R =270; // d a t a r a t e i n kbps
11 Eb_No =6; // i n dB
12 GMSK =0.3; // G a u s s i a n minimum s h i f t k e y i n g
13
14 // s o l u t i o n
15 Tb =1/ R *10^3; // i n m i c r o s e c
16 B = GMSK / Tb ;
17 printf ( ’ 3−dB BW f o r a g a u s s i a n low p a s s f i l t e r i s %
. 3 f kHz \n ’ ,B *1000) ;
18 disp ( ” The 3−dB bandwidth i s 8 1 . 0 8 kHz . t o d e t e r m i n e
t h e 9 9 . 9 9% power bandwidth , we u s e T a b l e 9 . 3 t o
nd t h a t 1 . 4 1 ∗ Rb i s t h e r e q u i r e d v a l u e and
d e g r a d a t i o n f a c t o r ( b e t a )= 0 . 8 9 ” ) ;
19 PowerBW =1.41* R ;
20 DegradFac =0.89;
21 Pe = erfc ( sqrt (2* DegradFac *10^(0.1* Eb_No ) ) ) ;
22 printf ( ’ Power bandwidth i n t h e RF c h a n n e l i s %. 1 f
kHz \n ’ , PowerBW ) ;

63
23 printf ( ’ B i t e r r o r p r o b a b i l i t y f o r GMSK i s %f ∗
10ˆ −5\n ’ , Pe *10^5) ;

Scilab code Exa 9.6 To calculate bit rate of modulator

1 // Exa 9 . 6
2 // To c a l c u l a t e b i t r a t e .
3
4 clc ;
5 clear all ;
6
7 Rs =19200; // s y m b o l s p e r s e c o n d
8 states =64;
9
10 // s o l u t i o n
11 Bits_symbol = log2 ( states ) ;
12 BitRate = Bits_symbol * Rs ;
13 printf ( ’ B i t Rate o f t h e m o d u l a t o r i s %. 1 f kbps ’ ,
BitRate /1000 );

Scilab code Exa 9.7 To determine the modulation scheme to be used along with requi

1 // Exa 9 . 7
2 // To d e t e r m i n e m o d u l a t i o n scheme t o be u s e d and Eb/
No .
3
4 clc ;
5 clear all ;
6
7 Rb =144; // d a t a r a t e i n kbps
8 BW =36; // i n MHz
9 Pb =3*10^ -5; // p r o b a b i l i t y o f b i t e r r o r
10

64
11 // s o l u t i o n
12 Seff = Rb / BW ; // s p e c t r a l e f f i c i e n c y i n bps /Hz
13
14 M =2^( Rb / BW ) ; // s i n c e t h e c h a n n e l i s band l i m i t e d
15 disp ( ”16−QAM ( r e f e r E q u a t i o n 9 . 6 6 ) s h o u l d be u s e d
a s i t i s more e f cient t h a n 16−PSK ( r e f e r
Equation 9 . 5 0 ) ”);
16 disp ( ” ” ) ;
17
18 // s i n c e Q [ s q r t ( 2 ∗ Eb No ) ] = ( 1 / 2 ) ∗ e r f c [ s q r t ( Eb No ) ]
// r e f e r p a g e no 257 equ 9 . 3 5
19 deff ( ’ y=f ( x ) ’ , ’ y = ( 3 / 8 ) ∗ e r f c ( s q r t ( ( 2 / 5 ) ∗ x ) )−Pb ’ ) ;
// from eqn 9 . 6 6 and 9 . 3 5
20
21 [x ,v , info ]= fsolve (0.1 , f ) ; // x=Eb No
22
23 printf ( ’ For a r e c t a n g u l a r c o n s t e l l a t i o n ( refer
F i g u r e 9 . 1 2 ) , w i t h a G a u s s i a n c h a n n e l and matched
lter r e c e p t i o n , t h e c a l c u l a t e d Eb/No v a l u e i s
%. 1 f dB\n ’ ,10* log10 ( x ) ) ;

Scilab code Exa 9.8 Compare the performance of 16PSK with 16QAM

1 // Exa 9 . 8
2 // To compare t h e p e r f o r m a n c e o f 16−PSK w i t h 16−QAM.
3
4 clc ;
5 clear all ;
6
7 Pb =10^ -8; //BER p r o b a b i l i t y
8
9 // s o l u t i o n
10 disp ( ” For 16−PSK” ) ;
11 // Pb =0.5∗Q( 0 . 5 5 2 ∗ s q r t ( Eb No ) ) ;
12 // s i n c e Q [ s q r t ( 2 ∗ Eb No ) ] = ( 1 / 2 ) ∗ e r f c [ s q r t ( Eb No ) ]

65
// r e f e r p a g e no 257 equ 9 . 3 5
13 deff ( ’ y=f ( x ) ’ , ’ y = 0.2 5 ∗ e r f c ( s q r t ( 0 . 5 ∗ 0 . 5 5 2 ˆ 2 ∗ x ) )−Pb ’ )
;
14 [x ,v , info ]= fsolve (0.1 , f ) ; // x=Eb No
15
16 printf ( ’ U s i n g e q u a t i o n 9 . 5 0 we g e t Eb/No a s %d dB (
a p p r o x ) \n ’ , round (10* log10 ( x ) ) ) ;
17 disp ( ” For 16−QAM” ) ;
18 //Pb =0. 75 ∗Q( s q r t ( 0 . 8 ∗ Eb No ) ) ;
19 deff ( ’ y=f 1 ( x1 ) ’ , ’ y = ( 3 / 8 ) ∗ e r f c ( s q r t ( 0 . 4 ∗ x1 ) )−Pb ’ ) ; //
x=Eb No
20 // s i n c e Q [ s q r t ( 2 ∗ Eb No ) ] = ( 1 / 2 ) ∗ e r f c [ s q r t ( Eb No ) ] //
r e f e r p a g e no 257 equ 9 . 3 5
21 [ x1 , v1 , info1 ]= fsolve (0.1 , f1 ) ; // x=Eb No
22 printf ( ’ U s i n g e q u a t i o n 9 . 6 6 we g e t Eb/No a s %d dB (
a p p r o x ) \n ’ , round (10* log10 ( x1 ) ) ) ;
23 disp ( ” ” ) ;
24 printf ( ’ Thus 16−QAM h a s an a d v a n t a g e o f a b o u t %d dB
compared t o 16−PSK \n ’ ,10* log10 ( x ) -10* log10 ( x1 ) )
;

Scilab code Exa 9.9 To find total bandwitdth and its efficiency along with require

1 // Exa 9 . 9
2 // To c a l c u l a t e −
3 // a ) The t o t a l bandwidth r e q u i r e d ,
4 // b ) The bandwidth e f ciency ,
5 // c ) The Eb/No r e q u i r e d , and
6 // d ) No o f c a r r i e d b i t s p e r symbol .
7
8 clc ;
9 clear all ;
10
11 M =8; // number o f d i f f e r e n t s i g n a l e l e m e n t s
12 Fc =250; // c a r r i e r f r e q u e n c y i n kHz

66
13 DelF =25; // kHz
14 Pe =10^ -6; // p r o b a b i l i t y o f e r r o r
15
16 // s o l u t i o n
17 TotalBW =2* M * DelF ;
18 nb =2* log2 ( M ) /( M +3) ;
19 // Pe=7∗Q( z ) and z=a p p r o x ( 5 . 0 8 )
20 z =5.08;
21 Eb_No =( z ) ^2/ log2 ( M ) ;
22 bits_sym = log2 ( M ) ;
23 printf ( ’ T o t a l bandwidth r e q u i r e d i s %d kHz \n ’ ,
TotalBW ) ;
24 printf ( ’ The bandwidth e f f i c i e n c y i s %. 4 f \n ’ , nb ) ;
25 printf ( ’ The r e q u i r e d Eb/No i s %. 3 f dB \n ’ ,10* log10 (
Eb_No ) ) ;
26 printf ( ’ C a r r i e d b i t s p e r symbol a r e %d \n ’ , bits_sym
);

67
Chapter 10

Antennas Diversity and Link


Analysis

Scilab code Exa 10.1 To find received signal power and SNR of antenna

1 // Exa 1 0 . 1
2 // To c a l c u l a t e t h e r e c e i v e d s i g n a l power a t t h e
r e c e i v e r a n t e n n a and t h e SNR o f t h e r e c e i v e d
signal .
3
4 clc ;
5 clear all ;
6
7 D =10000; // i n m e t r e s
8 TxEIRP =30; // E f f e c t i v e I s o t r o p i c R a d i a t e d Power (
EIRP )dBW
9 lamda =0.2; // i n m e t r e s
10 Pt =10; // T r a n s m i t t e d power i n dBW
11 Gt =20; // t r a n s m i t t e r g a i n i n dBi
12 Gr =3; // r e c e i v e r g a i n i n dBi
13 Lo =6; // t o t a l s y s t e m l o s s s e s i n dB
14 Nf =5; // n o i s e f i g u r e i n dB
15 BW =1.25; //mHz
16 k =1.38*10^ -23; // Boltzmann c o n s t a n t

68
17 T =290; // t e m p e r a t u r e i n d e g r e e k e l v i n
18
19 // s o l u t i o n
20 Lp =20* log10 ( lamda /(4* %pi * D ) ) ; // f r e e s p a c e l o s s
21 Pr = Lp + Pt + Gt + Gr - Lo ; // r e c e i v e d power i n dBW
22
23 No =10* log10 ( k * T ) ; // N o i s e d e n s i t y i n dBW
24 NO = No +30; // f a c t o r o f ’ 3 0 ’ t o c o n v e r t from dBW t o
dBm
25 Pn = Nf +10* log10 ( BW *10^6) + NO ; // n o i s e s i g n a l power i n
dBm
26 SNR =( Pr +30) - Pn ;
27 printf ( ’ The r e c e i v e d s i g n a l power i s %d dBm\n ’ ,
round ( Pr +30) ) ; // f a c t o r o f ’ 3 0 ’ t o c o n v e r t from
dBW t o dBm
28 printf ( ’SNR i s %d dB\n ’ , SNR ) ;

Scilab code Exa 10.2 To find received signal power and SNR of antenna

1 // Exa 1 0 . 2
2 // To c a l c u l a t e t h e r e c e i v e d s i g n a l power a t t h e
r e c e i v e r a n t e n n a and t h e SNR o f t h e r e c e i v e d
signal .
3
4 clc ;
5 clear all ;
6
7 // As we have t o u s e d a t a from Eg 1 0 . 1 ,
8 D =10000; // i n m e t r e s
9 TxEIRP =30; // E f f e c t i v e I s o t r o p i c R a d i a t e d Power (
EIRP )dBW
10 lamda =0.2; // i n m e t r e s
11 Pt =10; // t r a s m i t t e d power i n dBW
12 Gt =20; // t r a n s m i t t e r g a i n i n dBi
13 Gr =3; // r e c e i v e r g a i n i n dBi

69
14 Lo =6; // t o t a l s y s t e m l o s s s e s i n dB
15 Nf =5; // n o i s e f i g u r e i n dB
16 BW =1.25; //mHz
17 k =1.38*10^ -23; // Boltzmann c o n s t a n t
18 T =290; // t e m p e r a t u r e i n d e g r e e k e l v i n
19 // a d d i t i o n a l d a t a g i v e n i n t h i s e g
20 hr =40; // h e i g h t o f r e c e i v e r i n m e t r e
21 ht =2; // t r a s m i t t t e r a n t e n n a h e i g h t i n m e t r e s
22
23 // s o l u t i o n
24 Lp =20* log10 ( hr * ht / D ^2) ;
25 Pr = Lp + Pt + Gt + Gr - Lo ; // r e c e i v e d power i n dBW
26 No =10* log10 ( k * T ) ; // N o i s e d e n s i t y i n dBW
27 NO = No +30; // f a c t o r o f ’ 3 0 ’ t o c o n v e r t from dBW t o
dBm
28 Pn = Nf +10* log10 ( BW *10^6) + NO ; // n o i s e s i g n a l power i n
dBm
29 SNR =( Pr +30) - Pn ;
30 printf ( ’ The r e c e i v e d s i g n a l power i s %d dBm\n ’ ,
round ( Pr +30) ) ; // f a c t o r o f ’ 3 0 ’ t o c o n v e r t from
dBW t o dBm
31 printf ( ’SNR i s %d dB\n ’ , SNR ) ;

Scilab code Exa 10.3 To calculate gain of antenna

1 // Exa 1 0 . 3
2 // To c a l c u l a t e g a i n o f a n t e n n a .
3
4 clc ;
5 clear all ;
6
7 Pin =12; // I n p u t power i n w a t t s
8 Ploss =3; // r e s i s t i v e l o s s e s i n Watts
9 D =5; // D i r e c t i v i t y
10

70
11 // s o l u t i o n
12 Eff =( Pin - Ploss ) / Pin ;
13 G = Eff * D ;
14 printf ( ’ Gain o f t h e a n t e n n a i s %. 2 f dB = %. 2 f \n ’
,10* log10 ( G ) ,G ) ;

Scilab code Exa 10.4 To determine 3dB beam width of an antenna

1 // Exa 1 0 . 4
2 // To c a l c u l a t e t h e 3−dB beam w i d t h o f a l i n e a r
element antenna .
3
4 clc ;
5 clear all ;
6
7 G =12; // Gain o f a n t e n n a i n dBi
8
9 // s o l u t i o n
10 Theta =101.5/10^( G /10) ;
11 printf ( ’ The 3−dB beam w i d t h o f a l i n e a r element
a n t e n n a i s %. 1 f d e g r e e s ’ , Theta ) ;

Scilab code Exa 10.5 To calculate various parameters of helical antenna

1 // Exa 1 0 . 5
2 // To c a l c u l a t e t h e optimum d i a m e t e r (DH) , s p a c i n g (
S ) f o r t h e a n t e n n a and t o t a l l e n g t h o f t h e
antenna ,
3 // To c a l c u l a t e t h e a n t e n n a g a i n ,
4 // To c a l c u l a t e t h e beam w i d t h o f t h e a n t e n n a .
5
6 clc ;
7 clear all ;

71
8
9 N =12; // number o f t u r n s
10 fr =1.8; // f r e q u e n c y i n GHz
11
12 // s o l u t i o n
13 lamda =3*10^8/( fr *10^9) ;
14 DH = lamda / %pi ; // d i a m e t e r o f h e l i x i n m i l l i −m e t e r s
15 S = lamda /4; // t u r n s p a c i n g i n m i l l i m e t r e s
16 L=N*S;
17 G =15* N * S *( DH * %pi ) ^2/ lamda ^3;
18 Theta =52* lamda /( %pi * DH ) * sqrt ( lamda /( N * S ) ) ;
19 printf ( ’ The optimim d i a m e t e r i s %d mm\n ’ , DH *1000) ;
20 printf ( ’ S p a c i n g i s %. 1 f mm\n ’ ,S *1000) ;
21 printf ( ’ T o t a l Length o f a n t e n n a i s %d mm\n ’ ,L *1000)
;
22 printf ( ’ The a n t e n n a g a i n i s %. 1 f dBi \n ’ ,10* log10 ( G )
);
23 printf ( ’ The BeamWidth o f a n t e n n a i s %d d e g r e e s \n ’ ,
Theta ) ;

Scilab code Exa 10.6 To find probability that SNR will drop below 10dB and compare

1 // Exa 1 0 . 6
2 // To f i n d p r o b a b i l i t y t h a t SNR w i l l f a l l b e l o w 10dB
(= 1 0 ) .
3
4 clc ;
5 clear all ;
6
7 E0 =1000; // a v e r a g e SNR
8 Eg =10; // t h r e s h o l d v a l u e f o r SNR
9 M =3; //3−Branch Combiner
10 e =2.71828; // E u l e r ’ s number
11
12 // s o l u t i o n

72
13 x = Eg / E0 ;
14 P3 =(1 - e ^( - x ) ) ^ M ; // C o n s i d e r i n g 3− b r a n c h selection
combiner
15 printf ( ’ By c o n s i d e r i n g 3− b r a n c h s e l e c t i o n c o m b i n e r
t e c h n i q u e , p r o b a b i l i t y comes t o be %d ∗ 10ˆ −6\n ’
, round ( P3 *10^6) ) ;
16
17 disp ( ”When d i v e r s i t y i s n o t used , M =1” ) ;
18 P1 =(1 - e ^( - x ) ) ; //M=1;
19 printf ( ’ BY n o t c o n s i d e r i n g d i v e r s i t y t e c h n i q u e ,
p r o b a b i l i t y comes t o be %d ∗ 10ˆ −2 \n ’ , round ( P1
*10^2) ) ;

Scilab code Exa 10.7 To calculate minimum delay difference to successfully resolve

1 // Exa 1 0 . 7
2 // To d e t e r m i n e t h e minimum d e l a y d i f f e r e n c e t o
s u c c e s s f u l l y r e s o l v e t h e m u l t i p a t h c o m p o n e n t s and
o p e r a t e t h e Rake r e c e i v e r
3
4 clc ;
5 clear all ;
6
7 SR =3.84; // s p r e a d i n g r a t e i n Mcps
8
9 // s o l u t i o n
10 disp ( ” I n o r d e r t o r e s o l v e m u l t i p a t h components , the
chip d u r a t i o n s h o u l d be e q u a l t o o r g r e a t e r
t h a n T( t a u ) , where T i s d e ned a s r a t i o o f
d e l a y d i s t a n c e t o s p e e d t o e l e c t r o m a g n e t i c wave ” )
;
11 ChipDur =1/( SR *10^6) ;
12 Speed =3*10^8;
13 Dd = ChipDur * Speed ;
14 disp ( ” ” ) ;

73
15 printf ( ’ Minimum d e l a y d i s t a n c e t o s u c c e s s f u l l y
r e s o l v e t h e m u l t i p a t h c o m p o n e n t s and o p e r a t e t h e
Rake r e c e i v e r i s %d m \n ’ , Dd ) ;

74
Chapter 11

Spread Spectrum and CDMA


Systems

Scilab code Exa 11.1 To calculate processing gain and improvemet in information ra

1 // Exa 1 1 . 1
2 // To c a l c u l a t e t h e p r o c e s s i n g g a i n and improvement
in information rate .
3
4 clc ;
5 clear all ;
6
7 CR1 =1.2288; // Mcps ( C l o c k r a t e 1 )
8 CR2 =5; // Mcps ( C l o c k r a t e 2 )
9 R1 =9.6; // I n f o r m a t i o n r a t e i n Kbps f o r CR1
10 PG2 =256; // P r o c e s s i n g Gain f o r CR2
11
12 // s o l u t i o n
13 PG1 =10* log10 ( CR1 *10^3/9.6) ; // P r o c e s s i n g Gain f o r CR1
14 R2 = CR2 *10^3/ PG2 ; // i n f o r m a t i o n r a t e i n Kbps f o r CR2
15 printf ( ’ The p r o c e s s i n g g a i n f o r c l o c k r a t e 1 . 2 2 8 8
Mcps i s %d dB\n ’ , PG1 ) ;
16 printf ( ’ Improvemrnt i n i n f o r m a t i o n r a t e i s %. 2 f Kbps
\n ’ ,R2 - R1 ) ;

75
Scilab code Exa 11.2 Show that the transmitted signals to mobiles 1 2 and 3 are re

1 // Exa 1 1 . 2
2 // To show t h a t t h e t r a n s m i t t e d s i g n a l s t o m o b i l e s
1 , 2 , and 3 a r e r e c o v e r e d a t t h e m o b i l e r e c e i v e r s
by d e s p r e a d i n g t h e r e s u l t a n t s i g n a l z ( t ) .
3
4 clc ;
5 clear all ;
6
7 // s o l u t i o n
8 disp ( ”From f i g u r e 1 1 . 4 , we n o t e t h a t t r a n s m i t t e d
data f o r mobile1 as [ 0 1 1 0 0 ] , f o r mobile2 as
[ 0 0 1 0 0 ] and f o r m o b i l e 3 a s [ 0 1 0 0 1 ] ” ) ;
9 disp ( ”From f i g u r e 1 1 . 5 we g e t r e s u l t a n t d e m o d u l a t e d
s i g n a l at a mobile ”);
10 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]}; // R e s u l t a n t
demodulated s i g n a l at mobile
11 disp ( Rx ) ;
12 // from F i g u r e 1 1 . 4
13 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]};
14 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]};
15 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]};
16 // t ={[1 2 3 4 5 6 ] ; [ 7 8 9 10 11 1 2 ] ; [ 1 3 14 15 16 17
1 8 ] ; [ 1 9 20 21 22 23 2 4 ] ; [ 2 5 26 27 28 29 3 0 ] } ;
17 // f o r M o b i l e 1
18 for i = 1:5
19
20 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 (

76
i ,6) ;
21 if ( Demod1 ( i ) <0)
22 B1 ( i ) =1;
23 else
24 B1 ( i ) =0;
25 end
26 end
27 // f o r m o b i l e 2
28 for i = 1:5
29
30 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) ;
31 if ( Demod2 ( i ) <0)
32 B2 ( i ) =1;
33 else
34 B2 ( i ) =0;
35 end
36 end
37 // f o r m o b i l e 3
38 for i = 1:5
39
40 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) ;
41 if ( Demod3 ( i ) <0)
42 B3 ( i ) =1;
43 else
44 B3 ( i ) =0;
45 end
46 end
47 disp ( ” V a l u e o f i n t e g r a t i o n a t end o f b i t p e r i o d f o r
mobile1 ”);
48 disp ( Demod1 ’) ;
49 disp ( ” V a l u e o f i n t e g r a t i o n a t end o f b i t p e r i o d f o r
mobile2 ”);
50 disp ( Demod2 ’) ;
51 disp ( ” V a l u e o f i n t e g r a t i o n a t end o f b i t p e r i o d f o r

77
mobile3 ”);
52 disp ( Demod3 ’) ;
53 disp ( ” The r e c o v e r e d s i g n a l a t m o b i l e 1 i s ”);
54 disp ( B1 ’) ;
55 disp ( ” The r e c o v e r e d s i g n a l a t m o b i l e 2 i s ”);
56 disp ( B2 ’) ;
57 disp ( ” The r e c o v e r e d s i g n a l a t m o b i l e 3 i s ”);
58 disp ( B3 ’) ;
59 disp ( ” I n a l l c a s e s , R e c o v e r e d s i g n a l i s negated
value of transmitted s i g n a l ”)

Scilab code Exa 11.3 Minimum number of PN chips required for each frequency symbol

1 // Exa 1 1 . 3
2 // To f i n d t h e minimum number o f PN c h i p s .
3
4 clc ;
5 clear all ;
6
7 BW =100; // i n MHz
8 Fspac =10; // f r e q u e n c y s p a c i n g i n kHz
9
10 // s o l u t i o n
11 FreqTones = BW *10^3/ Fspac ;
12 Chips = log2 ( FreqTones ) ;
13 printf ( ’ Minimum number o f c h i p s r e q u i r e d a r e %d
c h i p s \n ’ , Chips ) ;

Scilab code Exa 11.4 To calculate data symbol transmitted per hop and number of no

1 // Exa 1 1 . 4
2 // To c a l c u l a t e −
3 // ( a ) d a t a symbol t r a n s m i t t e d p e r hop , and

78
4 // ( b ) t h e number o f n o n o v e r l a p p i n g hop f r e q u e n c i e s .
5
6 clc ;
7 clear all ;
8
9 R =120; // t r a n s m i s s i o n r a t e i n kbps
10 Hop =2000; // p e r s e c o n d
11 Spectrum =10; // i n MHz
12
13 // s o l u t i o n
14 // For 32−FSK
15 Bits_sym = log2 (32) ;
16 SR = R / Bits_sym ;
17 printf ( ’ B i t s p e r symbol a r e %d \n ’ , Bits_sym ) ;
18 printf ( ’ Hops p e r s e c o n d a r e 2 0 0 0 and Symbol r a t e i s
%d kbps \n ’ , SR ) ;
19 disp ( ” S i n c e t h e symbol r a t e i s h i g h e r t h a n t h e hop
r a t e , t h e s y s t e m i s a s l o w FHSS s y s t e m . ” ) ;
20 Sym_hop = SR *10^3/ Hop ;
21 Min_BW = Sym_hop * SR ;
22 Nonoverlap_hop = Spectrum *10^3/ Min_BW ;
23 disp ( ” ” ) ;
24 printf ( ’ Symbols t r a n s m i t t e d p e r hop a r e %d \n ’ ,
Sym_hop ) ;
25 printf ( ’ Number o f non−O v e r l a p p i n g hop f r e q u e n c i e s
a r e %d \n ’ , round ( Nonoverlap_hop ) ) ;

Scilab code Exa 11.5 To consider various parameters of FHSS systems

1 // Exa 1 1 . 5
2 // To C a l c u l a t e :
3 // ( a ) minimum s e p a r a t i o n b e t w e e n f r e q u e n c y t o n e s ,
4 // ( b ) number o f f r e q u e n c y t o n e s p r o d u c e d by a
frequency synthesizer ,
5 // ( c ) p r o c e s s i n g g a i n , and

79
6 // ( d ) h o p p i n g bandwidth .
7
8 clc ;
9 clear all ;
10
11 R =200; // i n p u t d a t a r a t e i n bps
12 Fhop =200; // p e r s e c o n d
13 k =1; // M u l t i p i c a t i o n F a c t o r
14
15 // s o l u t i o n
16 // We have 32−FSK m o d u l a t i o n scheme
17 Bits_sym = log2 (32) ;
18 Rs = Fhop / Bits_sym ;
19 printf ( ’ There a r e 200 h o p s p e r s e c o n d and Symbol
r a t e i s %d s y m b o l s p e r s e c \n ’ , Rs ) ;
20 disp ( ” The hop r a t e i s h i g h e r t h a n symbol r a t e , t h e
s y s t e m i s a f a s t FHSS s y s t e m . ” ) ;
21 SDur =1/ Rs ;
22 L = Fhop / Rs ;
23 CDur = SDur / L ;
24 Separation =1/ CDur ;
25 M =2^ Bits_sym ;
26 Hop_BW = k * M * Fhop * L ;
27 Gp = M * k * L ;
28 disp ( ” ” ) ;
29 printf ( ’ Minimum s e p a r a t i o n b e t w e e n f r e q u e n c y t o n e s
s h o u l d be %d Hz\n ’ , Separation ) ;
30 printf ( ’ Number o f d i f f e r e n t f r e q u e n c y t o n e s
p r o d u c e d by a f r e q u e n c y s y n t h e s i z e r a r e %d\n ’ ,M ) ;
31 printf ( ’ P r o c e s s i n g Gain i s %d\n ’ , Gp ) ;
32 printf ( ’ Hopping bandwidth i s %d kHz \n ’ , Hop_BW /1000) ;

Scilab code Exa 11.6 To show how mobile1 will detect its information using a two p

1 // Exa 1 1 . 6

80
2 // To show how t h e s i g n a l i s r e c o v e r e d a t m o b i l e by
u s i n g two−r a k e r e c e i v e r s .
3
4 clc ;
5 clear all ;
6
7 // s o l u t i o n
8 disp ( ” As we a r e g i v e n t h a t a c t u a l bit values for
mobile a r e [ 1 0 0 1 1 ] ”);
9 M1 =[1 0 0 1 1];
10
11 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]}; // R e s u l t a n t d e m o d u l a t e d s i g n a l a t m o b i l e ( Z ( t )
) from p a t h 1
12
13 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]}; // R e s u l t a n t d e m o d u l a t e d s i g n a l a t m o b i l e ( Z ( t
−2Tc ) ) from p a t h 2
14
15 Rx = Rx1 + Rx2 ; // s i n c e , Z ( t )=z ( t )+Z ( t −2Tc )
16
17 // from F i g u r e 1 1 . 1 3 ( d ) & F i g u r e 1 1 . 1 4
18 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]};
19 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]};
20
21 // c a s e −1:Z ( t ) ∗C1 ( t ) ;
22 for i = 1:5
23
24 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) ;
25 if ( Demod_1 ( i ) <0)
26 B1 ( i ) =1;

81
27 else
28 B1 ( i ) =0;
29 end
30 end
31
32 // c a s e −2:Z ( t ) ∗C1 ( t −2Tc ) ;
33 for j =1:5
34
35 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) ;
36 if ( Demod_2 ( j ) <0)
37 B2 ( j ) =1;
38 else
39 B2 ( j ) =0;
40 end
41 end
42 disp ( ” c a s e −1: z ( t ) ∗ c 1 ( t ) ” ) ;
43 disp ( ” V a l u e o f i n t e g r a t i o n a t end o f b i t p e r i o d f o r
m o b i l e ( c a s e −1) ” ) ;
44 disp ( Demod_1 ’) ;
45 disp ( ” The r e c o v e r e d s i g n a l a t m o b i l e ( c a s e −1) i s ” ) ;
46 disp ( B1 ’) ;
47 disp ( ” A c t u a l b i t v a l u e s a r e ” ) ;
48 disp ( M1 ) ;
49 disp ( ” R e c o v e r e d and a c t u a l v a l u e s a r e n o t m a t c h i n g ” )
;
50 disp ( ” c a s e −2: z ( t ) ∗ c 1 ( t −2Tc ) ” ) ;
51 disp ( ” V a l u e o f i n t e g r a t i o n a t end o f b i t p e r i o d f o r
m o b i l e ( c a s e −2) ” ) ;
52 disp ( Demod_2 ’) ;
53 disp ( ” The r e c o v e r e d s i g n a l a t m o b i l e ( c a s e −2) i s ” ) ;
54 disp ( B2 ’) ;
55 disp ( ” A c t u a l b i t v a l u e s a r e ” ) ;
56 disp ( M1 ) ;
57 disp ( ” R e c o v e r e d and a c t u a l v a l u e s a r e n o t m a t c h i n g ” )
;
58 // c a s e 3 −Sum o f p a t h 1 and p a t h 2

82
59 disp ( ” c a s e −3:Sum o f p a t h 1 & p a t h 2 i n t e g r a t o r ” ) ;
60 disp ( ”Sum o f i n t e g r a t o r o u t p u t s ( r a k e r e c e i v e r o u t p u t
) ”);
61 Demod_3 = Demod_1 + Demod_2 ;
62 disp ( Demod_3 ’) ;
63 for k =1:5
64
65 if ( Demod_3 ( k ) <0)
66 B3 ( k ) =1;
67 else
68 B3 ( k ) =0;
69 end
70 end
71 disp ( ” D e t e c t e d b i t v a l u e ” ) ;
72 disp ( B3 ’) ;
73 disp ( ” A c t u a l b i t v a l u e s a r e ” ) ;
74 disp ( M1 ) ;
75 disp ( ” R e c o v e r e d and a c t u a l v a l u e s a r e m a t c h i n g ” ) ;

Scilab code Exa 11.7 To calculate the time required by mobile to make the required

1 // Exa 1 1 . 7
2 // To f i n d power v a l u e t o be s e t a s a f i r s t
a p p r o x i m a t i o n a n s t i m e r e q u i r e d by m o b i l e s t a t i o n
t o make c h a n g e s a s d i r e c t e d by b a s e s t a t i o n .
3
4 clc ;
5 clear all ;
6
7 Prm = -97; // t h e s i g n a l s t r e n g t h from t h e b a s e s t a t i o n s
in dBm
8
9 // The c o n s t a n t ( K ) i s t h e p a r t o f t h e b r o a d c a s t
m e s s a g e t h a t i s s e n t t o t h e m o b i l e by t h e b a s e
s t a t i o n on t h e p a g i n g c h a n n e l .

83
10 K = -73; //dB
11 P2 =18; // power a s d i r e c t e d by BS (dBm)
12
13 // s o l u t i o n
14 Ptm =K - Prm ;
15 printf ( ’ The m o b i l e t r a n s m i t t e r power be s e t a s a
f i r s t a p p r o x i m a t i o n o f %d dBm \n ’ , Ptm ) ;
16 Pwr_Redu = Ptm - P2 ; // power r e d u c t i o n
17 printf ( ’ Power r e d u c t i o n = %d dBm \n ’ , Pwr_Redu ) ;
18 disp ( ” T h e r e f o r e , m o b i l e r e q u i r e s 6 d e c r e m e n t s e a c h
a t 1 . 2 5 ms ( 1 / 8 0 0 s e c ) ” ) ;
19 Time =6*1.25;
20 printf ( ’ Time r e q u i r e d by m o b i l e s t a t i o n t o make
c h a n g e s a s d i r e c t e d by b a s e s t a t i o n i s %. 1 f msec \
n ’ , Time ) ;

Scilab code Exa 11.8 To determine the possible pair of soft slope and add intercep

1 // Exa 1 1 . 8
2 // To d e t e r m i n e a p o s s i b l e p a i r o f t h e SOFT−SLOPE
and ADD−INTERCEPT v a l u e s t h a t w i l l t r i g g e r t h e
m o b i l e s t a t i o n t o s e n d a PSMM t o t h e b a s e s t a t i o n
and i f t h e m o b i l e s t a t i o n i s IS −95 c o m p l i a n t ,
nd t h e v a l u e o f T−COMP t h a t c o u l d t r i g g e r t h e
m o b i l e s t a t i o n t o g e n e r a t e a PSMM.
3
4 clc ;
5 clear all ;
6
7 P1 = -95; // p i l o t 1 i n dBm
8 P2 = -100; // p i l o t 2 i n dBm
9 P3 = -101; // p i l o t 3 i n dBm
10 P4 = -105; // p i l o t 4 i n dBm
11 P5 = -102; // p i l o t i n dBm
12 NoiseP = -107; // R e c e i v e r s e n s i t i v i t y (dBm)

84
13 Tadd = -13; //dB
14
15 // s o l u t i o n
16 // P c j = r e c e i v e d power o f t h e j t h p i l o t i n t h e
candidate set
17 // P a i= r e c e i v e d power o f t h e i t h p i l o t i n t h e
active set
18 Pa1 = P1 - NoiseP ;
19 Pa2 = P2 - NoiseP ;
20 Pa3 = P3 - NoiseP ;
21 Pa4 = P4 - NoiseP ;
22 Pc5 = P5 - NoiseP ;
23
24 X =10* log10 (10^(0.1* Pa1 ) +10^(0.1* Pa2 ) +10^(0.1* Pa3 )
+10^(0.1* Pa4 ) +10^(0.1* Pc5 ) ) ;
25 disp ( ”Max { 1 4 . 2 2 ∗ (SOFT−SLOPE)+ (ADD−INTERCEPT) , −13
}<=5” ) ;
26 disp ( ” Thus we have two e q u a t i o n s a s f o l l o w s ” ) ;
27 disp ( ” 1 4 . 2 2 ∗ SOFT−SLOPE+ADD−INTERCEPT>=−13 and ” ) ;
28 disp ( ” 1 4 . 2 2 ∗ SOFT−SLOPE+ADD−INTERCEPT<=5” ) ;
29 disp ( ” S o l v i n g t h e s e e q u a t i o n s , we g e t SOFT−SLOPE=
0 . 5 and ADD−INTERCEPT=−4” ) ;
30 disp ( ” For an IS −95− c o m p l i a n t m o b i l e s t a t i o n ( Pcj −P a i
) >=0.5∗T−COMP” ) ;
31 disp ( ” S i n c e P1>P2>P3>P4 , we r e p l a c e P4” ) ;
32 T_COMP =( P5 - P4 ) /0.5;
33 disp ( ” ” ) ;
34 printf ( ’ The v a l u e o f T−COMP t h a t c o u l d t r i g g e r t h e
m o b i l e s t a t i o n t o g e n e r a t e a PSMM s h o u l d be <= %d
dB (<= %d) . \ n ’ , T_COMP , round (10^(0.1* T_COMP ) ) ) ;

85
Chapter 12

Mobility Management in
Wireless Networks

Scilab code Exa 12.1 To evaluate the impact of LUs on the radio resource and calcu

1 // Exa 1 2 . 1
2 // To e v a l u a t e t h e i m p a c t o f LUs on t h e r a d i o
r e s o u r c e and c a l c u l a t e t h e MSC/VLR t r a n s a c t i o n
load using the uid ow model .
3
4 clc ;
5 clear all ;
6
7 P =10000; // M o b i l e d e n s i t y ( m o b i l e s /kmˆ 2 )
8 R =500*10^ -3; //km
9 V =10; .. // A v e r a g e moving v e l o c i t y o f a m o b i l e i n
Kmph
10 Nc =10; //No o f c e l l s p e r LA
11 N_LA =5; // Number o f LAs p e r MSC/VLR
12
13 // Number o f t r a n s a c t i o n s and d u r a t i o n o f e a c h
t r a n s a c t i o n t o MSC/VLR p e r LU f o r d i f f e r e n t LU
t y p e s a r e g i v e n i n T a b l e 1 2 . 1 . ( p a g e no . 3 7 4 )
14

86
15 // s o l u t i o n
16 // L=l e n g t h (km) o f t h e c e l l e x p o s e d p e r i m e t e r i n an
LA
17 L =6* R *(1/3+1/(2* sqrt ( Nc ) -3) ) ; //Km
18 // lamdaLU=number o f t r a n s a c t i o n s p r o c e s s e d by MSC/
VLR i n an LA p e r i m e t e r o f t h e j t h c e l l p e r h o u r
19 LamdaLu = V * P * L / %pi ; // Lus p e r h o u r
20
21
22 // c a s e ( 1 )
23 disp ( ” Case −1: I n t h e rst case , the j t h c e l l
l o c a t e d a t t h e b o r d e r o f two LAs i s r e l a t e d t o
t h e same MSC/VLR, o n l y i n t r a −VLR LUs a r e
p r o c e s s e d i n the c e l l ”);
24 R1_LU = LamdaLu /3600*(1*600/1000) ; // r e s o u r c e
o c c u p a n c y from T a b l e 1 2 . 1
25 disp ( ” ” ) ;
26 printf ( ’ The r e s o u r c e o c c u p a n c y i n t h e j t h c e l l due
t o MS LUs i s %. 1 f E r l a n g s \n ’ , R1_LU ) ;
27
28 disp ( ” T h i s r e q u i r e s 18 c h a n n e l s a t 1% b l o c k i n g (
r e f e r t o t h e E r l a n g −B t a b l e , Appendix A) o r 1 8 / 8
=2.25 t r a f c c h a n n e l ( a b o u t 1/4 o f an RF
channel , assuming t h e r e are 8 t r a f c channels
p e r RF c h a n n e l ) . ” )
29
30 // c a s e ( 2 )
31 disp ( ” c a s e −2: I n t h i s c a s e t h e j t h c e l l i s l o c a t e d a t
t h e b o r d e r o f two LAs r e l a t e d t o two d i f f e r e n t
VLRs . I n t h i s c a s e , o n l y i n t e r −VLR LUs w i l l be
p r o c e s s e d i n t h e c e l l . We assume 80% o f LUs a r e
w i t h TMSI and 20% o f LUs a r e w i t h IMSI ” ) ;
32 R2_LU = LamdaLu /3600*(0.8* 3500/1000+0.2*4000/10 00) ;
// from T a b l e 1 2 . 1
33 disp ( ” ” ) ;
34 printf ( ’ The r e s o u r c e o c c u p a n c y i n t h e j t h c e l l due
t o MS LUs i s %. 2 f E r l a n g s \n ’ , R2_LU ) ;
35 disp ( ” T h i s r e q u i r e s 75 c h a n n e l s a t 1% b l o c k i n g (

87
r e f e r t o t h e E r l a n g −B t a b l e , Appendix A) o r
7 5 / 8 = 9 . 3 8 t r a f c c h a n n e l s ( a b o u t 1 . 2 5 RF
c h a n n e l s ) . ”);
36
37
38 disp ( ”MSC/VLR t r a n s a c t i o n l o a d ” ) ;
39
40 disp ( ”We assume t h a t one LA i s i n t h e c e n t e r o f t h e
r e g i o n and t h e r e m a i n i n g f o u r LAs a r e on t h e
b o r d e r o f t h e r e g i o n . We a l s o assume t h a t , i n t h e
p e r i m e t e r c e l l s a t t h e b o r d e r LAs , o n l y i n t r a −VLR
LUs a r e g e n e r a t e d . For h a l f o f t h e p e r i m e t e r
c e l l s a t t h e b o r d e r LAs , o n l y i n t e r −VLR LUs a r e
generated . ”)
41
42 Np =6* sqrt ( Nc /3) -3; // Number o f c e l l s l o c a t e d on
p e r i m e t e r o f an LA
43 disp ( ” ” ) ;
44 printf ( ’ Number o f c e l l s where i n t e r −VLR LUs o c c u r
w i l l be : %d \n ’ , round (0.5* Np *4) ) ;
45 disp ( ” ” ) ;
46 printf ( ’ Number o f c e l l s where i n t r a −VLR LUs o c c u r
w i l l be : %d \n ’ ,4* Nc -16) ;
47 disp ( ” ” ) ;
48 TNLU = LamdaLu *(2*24+16*(0.8*14+0.2*16) ) ; // from
table 12.1
49 printf ( ’ The MSC/VLR t r a n s a c t i o n l o a d u s i n g t h e
uid ow model i s %. 2 f ∗ 1 0 ˆ 6 t r a n s a c t i o n s a t
peak h o u r \n ’ , TNLU /10^6) ;

88
Chapter 13

Security in Wireless Systems

Scilab code Exa 13.1 To generate public and private keys for RSA algorithm

1 // Exa 1 3 . 1
2 // To g e n e r a t e p u b l i c and p r i v a t e k e y s f o r RSA
algorithm .
3
4 clc ;
5 clear all ;
6
7 //Two p r i m e numbers
8 p =5;
9 q =7;
10
11 // s o l u t i o n
12 n=p*q;
13 z =( p -1) *( q -1) ;
14 e = input ( ” Choose e s u c h t h a t 1<e<z and e and n a r e
c o p r i m e= ” ) ;
15 d = input ( ” Choose d s u c h t h a t e ∗d−1 s h o u l d be
e x a c t l y d i v i s i b l e by z= ” ) ;
16 printf ( ’ P u b l i c k e y s i s (%d , %d) \n ’ ,n , e ) ;
17 printf ( ’ P r i v a t e key i s (%d , %d) \n ’ ,n , d ) ;
18

89
19 // R e s u l t s
20 // Choose e s u c h t h a t 1<e<z and e and n a r e c o p r i m e=
5
21 // Choose d s u c h t h a t e ∗d−1 s h o u l d be e x a c t l y
d i v i s i b l e by z= 29
22 // P u b l i c k e y s i s ( 3 5 , 5 )
23 // P r i v a t e key i s ( 3 5 , 2 9 )

Scilab code Exa 13.2 To determine the secret encrypting key K using DH key exchang

1 // Exa 1 3 . 2
2 // To d e t e r m i n e s e c r e t e n c r y p t i n g key K u s i n g DH key
exchange algorithm .
3
4 clc ;
5 clear all ;
6
7 p =23; // p r i m e number t h a t b o t h p a r t i e s a g r e e d upon
8 g =5; // g i s p r i m i t i v e mod p
9 a =6; // p a r t y A c h o o s e n number
10 b =15; // p a r t y B c h o o s e n number
11
12 // s o l u t i o n
13 printf ( ’ P a r t y A s e n d s t o p a r t y B a s ( g ˆ a mod p ) = %d
\n ’ , modulo ( g ^a ,23) ) ;
14 printf ( ’ P a r t y B s e n d s t o p a r t y A a s ( g ˆ b mod p ) =
%d \n ’ , modulo ( g ^b ,23) ) ;
15 printf ( ’ P a r t y A c o m p u t e s s e c r e t key a s ( ( g ˆ b modp ) ˆ
a mod p ) = %d \n ’ , modulo ( modulo ( g ^b ,23) ^a , p ) ) ;
16 printf ( ’ P a r t y B c o m p u t e s s e c r e t key a s ( ( g ˆ a modp ) ˆ
b mod p ) = %d \n ’ , modulo ( modulo ( g ^a ,23) ^b , p ) ) ;
17 disp ( ” Thus b o t h p a r t i e s u s e s k=2 a s s e c r e t key f o r
e n c r y p t i o n ”);

90
Chapter 14

Mobile Network and Transport


Layer

Scilab code Exa 14.1 To determine minimum possible latency and window size to achi

1 // Exa 1 4 . 1
2 // To d e t e r m i n e t h e minimum p o s s i b l e l a t e n c y amd t h e
minimum window s i z e t h a t a c h i e v e s t h i s l a t e n c y .
3
4 clc ;
5 clear all ;
6
7 O =800*1000; // O b j e c t s i z e ( B y t e s )
8 S =536*8; //max Segment S i z e ( i n b i t s )
9 RTT =0.1; // Round t r i p −t i m e i n s e c
10 R =1*10^6; // T r a n s m i s s i o n r a t e o f t h e l i n k from t h e
s e r v e r t o t h e c l i e n t i n bps
11
12 // s o l u t i o n
13 Lmin =2* RTT +( O / R ) ; // l a t e n c y ( msec )
14 // For minimum l a t e n c y ( S/R) +RTT −(W∗S /R) = 0 ;
Therefore
15 W =1+( RTT ) /( S / R ) ;
16 printf ( ’ The minimum p o s s i b l e l a t e n c y i s %d s e c \n ’ ,

91
Lmin ) ;
17 printf ( ’ The minimum window s i z e i s %. 1 f s e g m e n t s \n
’ ,W ) ;

Scilab code Exa 14.2 To calculate upper bound of the throughput for TP connection

1 // Exa 1 4 . 2
2 // To d e t e r m i n e t h e u p p e r bound o f t h e t h r o u g h p u t
and t h e t h r o u g h p u t w i t h r e t r a n s m i s s i o n s due t o
errors .
3
4 clc ;
5 clear all ;
6
7 RTT =0.1; // Round t r i p −t i m e i n s e c
8 MSS =536*8; //Maximum s e g m e n t s i z e i n b i t s
9 p =0.01; // p a c k e t l o s s p r o b a b i l i t y f o r t h e p a t h
10 RTO =5* RTT ; // R e t r a n s m i s s i o n t i m e o u t ( from eqn 1 4 . 2
on p a g e 4 5 0 )
11
12 // s o l u t i o n
13 R =0.93* MSS /( RTT * sqrt ( p ) ) ;
14 RR = MSS /( RTT * sqrt (1.33* p ) + RTO * p *(1+32* p ^2) * min (1 ,3*
sqrt (0.75* p ) ) ) ;
15 printf ( ’ The u p p e r bound o f t h e t h r o u g h p u t i s %. 4 f
Mbps \n ’ ,R *10^ -6) ;
16 printf ( ’ The t h r o u g h p u t w i t h r e t r a n s m i s s i o n due t o
e r r o r s i s %. 4 f Mbps \n ’ , RR *10^ -6) ;

92
Chapter 17

Planning and Design of a


Wireless Network

Scilab code Exa 17.1 To calculate various parameters for GSM 1800 network

1 // Exa 1 7 . 1
2 //To c a l c u l a t e −
3 // ( a ) a v e r a g e busy−h o u r t r a f c p e r s u b s c r i b e r ,
4 // ( b ) t r a f c c a p a c i t y p e r c e l l ,
5 // ( c ) r e q u i r e d number o f b a s e s t a t i o n s p e r zone , and
6 // ( d ) t h e h e x a g o n a l c e l l r a d i u s f o r t h e z o n e .
7
8 clc ;
9 clear all ;
10
11 Susage =150; // s u b s c r i b e r u s a g e p e r month i n mins
12 days =24; // d a y s p e r month
13 busyhrs =6; // i n a day
14 BW =4.8*10^3; // i n kHz
15 Freqreuse =4/12; // F r e q u e n c y r e u s e p l a n
16 chwidth =200; // i n kHz
17 subscriber =50000; // P r e s e n t s u b s c r i b e r c o u n t
18 Sgrowth =0.05; // Growth r a t e p e r y e a r
19 Area =500; // i n km

93
20 BTScapacity =30; // i n E r l a n g s
21 N =4; // I n i t i a l i n s t a l l a t i o n d e s i g n y e a r s
22
23 // s o l u t i o n
24 Erlangspersub = Susage /( days * busyhrs *60) ;
25 printf ( ’ A v e r a g e busy−h o u r t r a f c p e r s u b s c r i b e r
i s %. 4 f E r l a n g s \n ’ , Erlangspersub ) ;
26 RFcarriers = BW / chwidth ;
27 RFcarrier_percell = RFcarriers /(( Freqreuse ^ -1) *4) ; //
freq reuse factor of 4
28
29 // Assuming 2 c o n t r o l c h a n n e l s p e r c e l l
30 CC =2; // c o n t r o l c h a n n e l s
31 TC_percell =2* RFcarriers /3 - CC ;
32 // R e f e r r i n g E r l a n g −B t a b l e i n Appendix A
33 disp ( ” R e f e r r i n g E r l a n g −B t a b l e i n Appendix A,
T r a f c c a p a c i t y o f a GSM c e l l a t 2% GoS f o r 14
c h a n n e l s = 8 . 2 E r l a n g s ”);
34 Tcapacity =8.2; // i n E r l a n g s
35 disp ( ” There a r e 3 c e l l s p e r BTS” ) ;
36 BTS =3;
37 Traffic_perBTS = Tcapacity * BTS ;
38 printf ( ’ T r a f f i c c a p a c i t y p e r BTS i s %. 1 f E r l a n g s ’ ,
Traffic_perBTS ) ;
39 disp ( ” T h e r e f o r e , T r a f f i c p e r BTS i s l e s s t h a n BTS
c a p a c i t y (30 Erlangs ) ”)
40 maxsubscriber = Traffic_perBTS / Erlangspersub ;
41 initialsub = subscriber *(1+ Sgrowth ) ^ N ;
42 BTS_perZone = initialsub / maxsubscriber ;
43 printf ( ’ The r e q u i r e d number o f b a s e s t a t i o n s p e r
z o n e a r e %d \n ’ , round ( BTS_perZone ) ) ;
44 cellRadius =( Area /( BTS_perZone *2.6) ) ^0.5;
45 printf ( ’ The h e x a g o n a l c e l l r a d i u s i s %. 1 f km \n ’ ,
cellRadius ) ;

94
Scilab code Exa 17.2 To estimate the data and voice traffic per subscriber and per

1 // Exa 1 7 . 2
2 // To c a l c u l a t e v o i c e and d a t a t r a f f i c p e r c e l l .
3
4 clc ;
5 clear all ;
6
7 usage =150; // s u b s c r i b e r u s a g e p e r month i n mins
8 days =24; // Days i n a month
9 BHrs =6; // Busy h o u r s p e r day
10 BW =4.8; // i n MHz
11 RFch =200; // i n kHz
12 Psubscribers =50000; // p r e s e n t s u b s c r i b e r c o u n t
13 growth =0.05; // s u b s c r i b e r g r o w t h p e r y e a r
14 rollover =4; // n e t w o r k r o l l o v e r p e r i o d
15 NPCS =5; // Number o f p a c k e t c a l l s p e r s e s s i o n
16 NPP =25; // Number o f p a c k e t s w i t h i n a p a c k e t c a l l
17 Tr =120; // R e a d i n g t i m e b e t w e e n p a c k e t c a l l s ( s e c )
18 NBP =480*8; // P a c k e t s i z e ( i n b i t s )
19 Tint =0.01; // Time i n t e r v a l b e t w e e n two p a c k e t s ( s e c )
20 Ttot =3000; // T o t a l p a c k e t s e r v i c e h o l d i n g t i m e
21 BH_PS =0.15; // Busy h o u r p a c k e t s e s s i o n s p e r
subscriber
22 Penetration =0.25;
23 datarate =48; // i n kbps
24 PTT =10; // P a c k e t t r a n s m i s s i o n t i m e ( s e c )
25 BTS =40; //NO o f BTS s i t e s
26
27 // s o l u t i o n
28 Bitstx_duringPTT = NPCS * NPP * NBP /1000;
29 PST = PTT + Tr *( NPCS -1) + Tint *( NPP -1) ;
30 PT_duringBH = BH_PS * Ttot / PST ;
31 Bits_persub_persec = Bitstx_duringPTT * PT_duringBH
/(60*60) ;
32 VoiceErlangs = usage /( days * BHrs *60) ;
33 Initial_subscribers = round ( Psubscribers *(1+ growth ) ^
rollover ) ;

95
34 Data_subscribers = Initial_subscribers * Penetration ;
35 Totalvoice = Initial_subscribers * VoiceErlangs ;
36 Voicetraffic_perBTS = Totalvoice / BTS ;
37 printf ( ’ V o i c e T r a f f i c p e r C e l l ( s e c t o r ) i s %. 2 f
E r l a n g s \n ’ , Voicetraffic_perBTS /3) ;
38 Totaldata = Data_subscribers * Bits_persub_persec ;
39 Datathroughput_perBTS = Totaldata / BTS ;
40 printf ( ” Data t h r o u g h p u t p e r C e l l ( s e c t o r ) i s %. 2 f
kbps \n ’ , D a t a t h r o u g h p u t p e r B T S / 3 ) ;

Scilab code Exa 17.3 To calculate data Erlangs along with TS utilization and capac

1 // Exa 1 7 . 3
2 // U s i n g t r a f c d a t a p e r c e l l f o r a GSM/GPRS
n e t w o r k from Example 1 7 . 2
3 // To c a l c u l a t e −
4 // ( a ) d a t a E r l a n g s ,
5 // ( b ) t i m e s l o t u t i l i z a t i o n , and
6 // ( c ) TS c a p a c i t y .
7
8 clc ;
9 clear all ;
10
11 Holdtime =120; // A v e r a g e h o l d i n g t i m e d u r i n g Busy
Hours ( i n s e c )
12 Tx =3; // No o f t r a n s r e c e i v e r s
13 TSsig =3; //No o f TSs p e r c e l l f o r s i g n a l i n g
14 RLC =0.80; // Radio l i n k c o n t r o l e f f i c i e n c y
15 Radioblocks =9000; // T o t a l numbers o f t r a n s m i t t e d
radio blocks
16 TSdata =3; // TSs a l l o c a t e d f o r d a t a t r a f c p e r c e l l
17 Datarate =15.5; // From e g 1 7 . 2
18 Voicetraffic =8.82; // From e g . 1 7 . 2
19 Duration =0.02; // D u r a t i o n o f b l o c k i n s e c
20

96
21 // s o l u t i o n
22 DataEr = Radioblocks * Duration / Holdtime ;
23 printf ( ’ Data E r l a n g s = %. 1 f \n ’ , DataEr ) ;
24 TSuti = DataEr / TSsig ;
25 printf ( ’ Time S l o t ( TS ) u t i l i z a t i o n = %. 1 f \n ’ , TSuti )
;
26 Throughput =( Datarate / TSdata ) * RLC ;
27 TScap = Throughput / TSuti ;
28 printf ( ”TS c a p a c i t y i s %. 2 f kbps \n ’ , TScap ) ;

Scilab code Exa 17.4 To develop downlink and uplink cell budget and calculate cell

1 // Exa 1 7 . 4
2 //To c a l c u l a t e t h e c e l l r a d i u s .
3
4 clc ;
5 clear all ;
6
7 Pt =36; // Base s t a t i o n t r a n s m i t t e d power i n dBm
8 Pms =24; // m o b i l e s t a t i o n t r a n s m i t t e d power i n dBm
9 Nms =8; // m o b i l e s t a t i o n n o i s e f i g u r e i n dB
10 Nbs =5; // Base s t a t i o n n i s e f i g u r e i n dB
11 Ga =18; // Base s t a t i o n t r a n s m i t and r e c e i v e a n t e n n a
g a i n i n dBi
12 Gm =0; // M o b i l e a n t e n n a g a i n i n dBi
13 SNR =12; // i n dB
14 Lc_TX =5; //BS t r a n s m i t a n t e n n a c a b l e , c o n n e c t o r , and
lter l o s s e s i n dB
15 Lc_RX =2; //BS r e c e i v e r a n t e n n a c a b l e , c o n n e c t o r , and
lter l o s s e s i n dB
16 Bodyloss =3; // Body l o s s e s a t m o b i l e
17 fading =10.2; // i n dB
18 ThermalNoise = -174; // i n dBm/Hz
19 Gdiversity =5; // Antenna d i v e r s i t y g a i n a t BS i n dB
20 // Assuming s t a n d a r d v a l u e o f RF c h a n n e l a s

97
21 RFch =200*10^3; // i n Hz
22
23 // s o l u t i o n
24 N = ThermalNoise +10* log10 ( RFch ) + Nms ;
25 Smin = N + SNR ;
26 Smean = Smin + fading + Bodyloss ;
27 Lp = Pt - Lc_TX + Ga - Smean ;
28 N1 = ThermalNoise +10* log10 ( RFch ) + Nbs ;
29 Smin = N1 + SNR - Gdiversity ;
30 Smean1 = Smin + fading + Bodyloss ;
31 Lp1 = Pms - Smean1 + Ga - Lc_RX ;
32 disp ( ” U s i n g u p l i n k p a t h l o s s and Hata model t o
c a l c u l a t e c e l l r a d i u s ”);
33 R =10^(( Lp1 -133.2) /33.8) ;
34 printf ( ’ C e l l r a d i u s i s %. 1 f km \n ’ ,R ) ;

Scilab code Exa 17.5 To calculate Uplink cell load factor and pole capacity

1 // Exa 1 7 . 5
2 // To c a l c u l a t e u p l i n k c e l l l o a d f a c t o r , number o f
v o i c e u s e r s and p o l l c a p a c i t y o f t h e c e l l .
3
4 clc ;
5 clear all ;
6
7 Ri =12.2*10^3; // I n f o r m a t i o n r a t e i n bps
8 Rc =3.84*10^6; // Chip r a t e i n c p s ( c h i p s p e r s e c o n d )
9 Eb_Nt =4; // i n dB
10 Imargin =2; // I n t e r f e r e n c e m a r g i n ( 3 dB )
11 B =0.5; // I n t e r f e r e n c e f a c t o r due t o o t h e r c e l l s
12 Vi =0.65; // Channel a c t i v i t y f a c t o r
13
14 // s o l u t i o n
15 Eb_Ntreqd =10^( Eb_Nt /10) ;
16 LF_peruser =(1+ B ) *(1/(1+( Rc / Ri ) *(1/ Eb_Ntreqd ) *(1/ Vi ) )

98
) ; //M( no o f u s e r s =1) i n Eq 1 7 . 1 3
17 printf ( ” C e l l l o a d f a c t o r p e r v o i c e u s e r i s %. 5 f \n
’ , LF peruser ) ;
18 C e l l L o a d i n g =( I m a r g i n −1) / I m a r g i n ;
19 V o i c e U s e r s=C e l l L o a d i n g / L F p e r u s e r ;
20 p r i n t f ( ’ No o f V o i c e U s e r s a r e %d p e r c e l l \n ’ ,
VoiceUsers ) ;
21 // From EQ 1 7 . 6 a s s u m i n g Power c o n t r o l e f f i c i e n c y =1
22 P o l e c a p=Rc / ( Ri ∗ Vi ∗(1+B) ∗ Eb Nt req d ) ;
23 p r i n t f ( ’ P o l e C a p a c i t y i s %d \n ’ , P o l e c a p ) ;

Scilab code Exa 17.6 To calculate uplink throughput for WCDMA data service

1 // Exa 1 7 . 6
2 // To c a l c u l a t e U p l i n k t h r o u g h p u t f o r a WCDMA c e l l .
3
4 clc ;
5 clear all ;
6
7 Eb_Nt =1; // i n dB
8 cellLoading =0.5; // R e q u i r e d i n t e r f e r e n c e m a r g i n ( 3 dB )
9 B =0.5; // I n t e r f e r e n c e f a c t o r due t o o t h e r c e l l s
10 Vi =1; // Channel a c t i v i t y f a c t o r
11
12 // s o l u t i o n
13 Eb_Ntreqd =10^( Eb_Nt /10) ;
14 // Assuming s t a n d a r d v a l u e o f c h i p r a t e a s 3 . 8 4 Mcps
15 Rc =3.84*10^6; // i n c p s ( c h i p s p e r s e c o n d )
16 Throughput =( cellLoading * Rc ) /( Eb_Ntreqd *(1+ B ) ) ;
17 printf ( ’ U p l i n k Throughput i s %d kbps \n ’ , Throughput
/1000) ;

Scilab code Exa 17.7 To calculate downlink cell load factor and number of voice us

99
1 // Exa 1 7 . 7
2 // To c a l c u l a t e d o w n l i n k c e l l l o a d −f a c t o r and number
o f v o i c e u s e r s p e r c e l l f o r a WCDMA s y s t e m .
3
4 clc ;
5 clear all ;
6
7 Ri =12.2*10^3; // I n f o r m a t i o n r a t e i n bps
8 Rc =3.84*10^6; // Chip r a t e i n c h i p s p e r s e c o n d
9 Eb_Nt =4; // i n dB
10 Eb_Nt =10^( Eb_Nt /10) ;
11 B =0.5; // A v e r a g e i n t e r f e r e n c e f a c t o r due t o o t h e r
cells
12 Zeta =0.6; // o r t h o g o n a l i t y f a c t o r
13 Imargin =2; // I n t e r f e r e n c e m a r g i n ( 3 dB )
14 Vi =0.65 // a s s u m i n g Channel a c t i v i t y f a c t o r a s 0 . 6 5
15
16 // s o l u t i o n
17 Loadfactor_peruser =( Zeta + B ) *(1/(( Rc / Ri ) *(1/ Eb_Nt )
*(1/ Vi ) ) )
18 printf ( ’ Downlink c e l l l o a d f a c t o r i s %. 4 f \n ’ ,
Loadfactor_peruser ) ;
19 cellLoading =( Imargin -1) / Imargin ;
20 Voiceusers = cellLoading / Loadfactor_peruser ;
21 printf ( ’ No o f v o i c e u s e r s p e r c e l l a r e %d \n ’ ,
Voiceusers ) ;

Scilab code Exa 17.8 To determine minimum signal power and maximum allowable path

1 // Exa 1 7 . 8
2 // To c a l c u l a t e minimum s i g n a l power r e q u i r e d and
maximum a l l o w a b l e p a t h l o s s .
3
4 clc ;
5 clear all ;

100
6
7 N0 = -174; // N o i s e d e n s i t y i n dBm/Hz
8 Bc =1.25; // Channel bandwidth i n mHz
9 Rc =1.2288; // Chip r a t e i n Mcps
10 Nf =6; // R e c e i v e r N o i s e f i g u r e i n dB
11 Pt =27; // E f f e c t i v e r a d i a t e d power from m o b i l e i n
dBm
12 Lct =0.5; // T r a n s m i t t e r c a b l e and c o n n e c t o r l o s s i n
dBm
13 Lbody =1.5; // Body l o s s i n dB
14 Lcr =2; // R e c e i v e r c a b l e and c o n n e c t o r l o s s i n dB
15 Mint =0; // I n t e r f e r e n c e m a r g i n i n dB
16 Mfading =2; // f a s t f a d i n f m a r g i n i n dB
17 Lpent =8; // P e n e t r a t i o n l o s s i n dB
18 Gm =0; // T r a n s m i t t e r a n t e n n n a g a i n i n dBi
19 Gb =12; // R e c e i v e r a n t e n n a g a i n i n dBi
20 Fm =8; // Fade m a r g i n i n dB
21 Eb_Nt =7; // i n dB
22
23 // s o l u t i o n
24 Nth = N0 + Nf ;
25 S_Nt = Eb_Nt +10* log10 (( Rc *10^6) /( Bc *10^6) ) ;
26 Smin = S_Nt +10* log10 ( Rc *10^6) + Nth ;
27 Lpmax =( Pt - Smin ) +( Gb + Gm ) -( Lbody + Lct + Lcr + Fm + Lpent ) -
Mint - Mfading ;
28 printf ( ’ Minimum s i g n a l power r e q u i r e d i s %. 2 f dBm \n
’ , Smin ) ;
29 printf ( ’ Maximum a l l o w a b l e p a t h l o s s i s %. 2 f dB \n ’ ,
Lpmax ) ;

Scilab code Exa 17.9 To develop a radio link budget for uplink and downlink

1 // Exa 1 7 . 9
2 // To c a l c u l a t e Radio l i n k b u d g e t f o r u p l i n k and
downlink

101
3 // R e f e r i n g T a b l e 1 7 . 1 on p a g e no 613
4
5 clc ;
6 clear all ;
7
8 Rc =3.84; // Chip r a t e i n Mcps
9 Ri =16; // Data r a t e i n kbps
10 UL =0.5; //UL l o a d i n g f a c t o r
11 DL =0.9; //DL l o a d i n g f a c t o r
12 Eb_NtU =4; // i n dB
13 Eb_NtD =6; // i n dB
14 Gm =0; // M o b i l e a n t e n n a g a i n i n dBi
15 Gb =18; // Base s t a t i o n g a i n i n dBi
16
17 // s o l u t i o n
18 disp ( ” The Okumara−Hata model f o r an urban macro− c e l l
w i t h a b a s e s t a t i o n a n t e n n a h e i g h t o f 25m, a
m o b i l e s t a t i o n h e i g h t o f 1 . 5m, and a c a r r i e r
f r e q u e n c y o f 1 9 5 0MHz g i v e s Lp = 1 3 8 . 5 + 3 5 . 7 ∗ l o g 1 0 (R
) where R i s r a d i u s o f h e x a g o n a l c e l l ” ) ;
19 disp ( ”From t a b l e 1 7 . 1 , Lp ( A l l o w a b l e p a t h l o s s ) f o r
u p l i n k i s 1 3 9 . 6 5 dB” ) ;
20 R =10^((139.65 -138.5) /35.7) ;
21 printf ( ’ C e l l R a d i u s i s %. 3 f km \n ’ ,R ) ;
22 Area = round (2.6* R ^2) ;
23 printf ( ’ Area c o v e r e d by h e x a g o n a l c e l l i s %d kmˆ2 \n
’ , Area ) ;
24 printf ( ’ Number o f BTSs r e q u i r e d t o c o v e r an a r e a o f
2 4 0 0 Kmˆ2 a r e %d \n ’ ,2400/ Area ) ;

Scilab code Exa 17.10 To find the number of users supported on the downlink of a W

1 // Exa 1 7 . 1 0
2 //To c a l c u l a t e No o f u s e r s t h a t can be s u p p o r t e d on
t h e d o w n l i n k o f t h e WCDMA n e t w o r k .

102
3
4 clc ;
5 clear all ;
6
7 Rc =3.84; // c h i p r a t e i n Mcps
8 N =3; // N o i s e r i s e i n dB
9 OF =0.8; // o r t h o g o n a l i t y f a c t o r
10 B =0.55; // I n t e r f e r e n c e from o t h e r c e l l s
11 Eb_N0 =4; // i n dB
12 Sec_Eff =0.85; // S e c t o r e f f i c i e n c y
13 Pwr_Eff =0.80; // Power c o n t r o l e f f i c i e n c y
14 Y =1.2; // R e t r a n s m i t r a t e
15 X =10; // 10MB a t 384 Kbps
16 X1 =2; // 2MB a t 144 Kbps
17 X2 =1; // 1MB a t 64 Kbps
18
19 // s o l u t i o n
20 // Assuming V o i c e a c t i v i t y =Vf=1
21 Vf =1;
22 AvgDR = Y * X *10^6*(1/3600) + Y * X1 *10^6*(1/3600) + Y * X2
*10^6*(1/3600) ;
23 CLoad =( N -1) /( N +1) ;
24 DLcap =( Rc *10^6* Pwr_Eff * Sec_Eff ) /(((10^( Eb_N0 /10) ) *( B
+ OF ) * Vf ) ) ;
25 Allowcap = CLoad * DLcap ;
26 users = Allowcap / AvgDR ;
27 printf ( ’NO o f u s e r s t h a t can be s u p p o r t e d on t h e
d o w n l i n k o f t h e WCDMA n e t w o r k a r e %d \n ’ , round (
users ) ) ;

Scilab code Exa 17.11 find the average throughput for various cases

1 // Exa 1 7 . 1 1
2 // To c a l c u l a t e a v e r a g e t h r o u g h p u t and compare i t
with equal l a t e n c y c o n d i t i o n .

103
3
4 clc ;
5 clear all ;
6
7 P1 =1/2; // r e l a t i v e frequency of packets for user
class1
8 P2 =1/3; // r e l a t i v e f r e q u e n c y o f p a c k e t s f o r u s e r
class2
9 P3 =1/6; // r e l a t i v e f r e q u e n c y o f p a c k e t s f o r u s e r
class3
10 R1 =16; // d a t a r a t e i n kbps f o r P1
11 R2 =64; // d a t a r a t e i n kbps f o r P2
12 R3 =1024; // d a t a r a t e i n kbps f o r P3
13 S1 =16; // number o f s l o t s a s s i g n e d t o t h e R1 u s e r
14 S2 =8; // number o f s l o t s a s s i g n e d t o t h e R2 u s e r
15 S3 =2; // number o f s l o t s a s s i g n e d t o t h e R3 u s e r
16
17 // s o l u t i o n
18 // U s i n g E q u a t i o n 1 7 . 2 0 from p a g e no 616
19 Ravg =( P1 * R1 * S1 + P2 * R2 * S2 + P3 * R3 * S3 ) /( P1 * S1 + P2 * S2 + P3 * S3
);
20 // For e q u a l l a t e n c y , u s i n g Eq 1 7 . 1 8
21 Rav =1/( P1 / R1 + P2 / R2 + P3 / R3 ) ;
22 // For L a t e n c y r a t i o =4 , u s i n g Eq 1 7 . 1 9 from p a g e no
616
23 PL =4;
24 C =( P1 + P2 + PL * P3 ) /( P1 / R1 + P2 / R2 + P3 / R3 ) ;
25 printf ( ’ The a v e r a g e t h r o u g h p u t f o r e q u a l a c c e s s
c o n d i t i o n i s %. 1 f kbps \n ’ , Ravg ) ;
26 printf ( ’ The a v e r a g e t h r o u g h p u t by c o n s i d e r i n g e q u a l
l a t e n c y i s %. 1 f kbps \n ’ , Rav ) ;
27 printf ( ’ The a v e r a g e t h r o u g h p u t by c o n s i d e r i n g
l a t e n c y r a t i o a s 4 i s %. 2 f kkbps \n ’ ,C )
28 disp ( ” I i i s o b s e r v e d t h a t e q u a l a c c e s s p r o v i d e s t h e
h i g h e s t average output ”)

104
Scilab code Exa 17.12 TO find the allowable throughput of a reverse link of a CDMA

1 // Exa 1 7 . 1 2
2 // To c a l c u l a t e a l l o w a b l e t h r o u g h p u t o f r e v e r s e l i n k
i n cdma 2 0 0 0 .
3
4 clc ;
5 clear all ;
6
7 Ec_Nt = -23; // i n dB
8 DRC = -1.5; //DRC g a i n w i t h r e s p e c t t o p i l o t i n dB
9 Tg =3.75; // T r a f c c h a n n e l g a i n w i t h r e s p e c t t o
p i l o t i n dB
10 B =0.85; // I n t e r f e r e n c e f a c t o r due t o o t h e r c e l l s
11
12 // s o l u t i o n
13 Mmax =(1/(1+10^( DRC /10) +10^( Tg /10) ) ) *(1/((10^( Ec_Nt
/10) *(1+ B ) ) ) ) ;
14 // The s e c t o r l o a d i n g can be e x p r e s s e d a s a f r a c t i o n
o f t h e p o l e c a p a c i t y Mmax . T h i s i s t y p i c a l l y 70%
of the pole capacity .
15 M_allow = int (0.7* Mmax ) ;
16 // From t a b l e 1 7 . 2 we g e t T r a f f i c c h a n n e l r a t e a s 9 . 6
kbps s i n c e we a r e g i v e n t r a f f i c c h a n n e l g a i n w i t h
r e s p e c t t o p i l o t a s 3 . 7 5 dB
17 Ri =9.6; // i n kbps ( s e e t a b l e 1 7 . 2 )
18 Tput = Ri * M_allow ;
19 printf ( ’ A l l o w a b l e r e v e r s e l i n k t h r o u g h p u t i s %d
kbps \n ’ , round ( Tput ) ) ;

Scilab code Exa 17.13 To estimate average SINR of a HSDPA

105
1 // Exa 1 7 . 1 3
2 // To c a l c u l a t e a v e r a g e SINR o f HSDPA .
3
4 clc ;
5 clear all ;
6
7 Ptmax =5.5; //Maximum t r a n s m i t power o f DSCH i n w a t t s
8 Pbs =18; // T o t a l b a s e s t a t i o n power in watts
9 alpha =0.2; // d o w n l i n k o r t h o g o n a l i t y factor
10 G =0.363; // g e o m e t r y f a c t o r
11 SF =16; // S p r e a d i n g F a c t o r f o r DSCH ; f i x e d at value of
16
12
13 // s o l u t i o n
14 // U s i n g e q u a t i o n no 1 7 . 2 7 g i v e n on p a g e no 623
15 SINR = SF *( Ptmax /( Pbs *(1 - alpha +(1/ G ) ) ) ) ;
16 // I n dB
17 SINR_db =10* log10 ( SINR ) ;
18
19 printf ( ’ The a v e r a g e SINR o f HSDPA i s %. 1 f dB = %. 4 f
\n ’ , SINR_db , SINR ) ;

Scilab code Exa 17.14 To find bandwidth of a Iub interface

1 // Exa 1 7 . 1 5
2 // To c a l c u l a t e bandwidth o f I u b i n t e r f a c e .
3
4 clc ;
5 clear all ;
6
7 Users =350; // no o f u s e r s s u p p o r t e d
8 ExpectedTraf =1.8; // From s e c t i o n 1 7 . 7 ( i n Kbps )
9 BHTraf =1.785; // Busy h o u r t r a f f i c i n kbps
10 BTS =180;
11

106
12 // s o l u t i o n
13 IubBW =( ExpectedTraf * Users * BHTraf ) /1000; // i n Mbps
14 TotalBW = BTS * IubBW ;
15 printf ( ’ R e q u i r e d t o t a l bandwidth o f I u b I n t e r f a c e i s
%. 2 f Mbps \n ’ , TotalBW ) ;

Scilab code Exa 17.15 To find the required RNCs

1 // Exa 1 7 . 1 5
2 // To c a l c u l a t e No o f RNC r e q u i r e d .
3
4 clc ;
5 clear all ;
6
7 BTS =800; //No o f BTS s i t e s
8 Sec =3; //No o f s e c t o r s p e r BTS
9 freq_sec =2; //No o f f r e q u e n c i e s u s e d p e r s e c t o r
10 cellsRNC =1152; //Maximum c a p a c i t y o f cellRNC
11 btsRNC =384; // One RNC can s u p p o r t btsRNC ( BTSs )
12 VE =25; // V o i c e s e r v i c e ( mErl / s u b s c r i b e r )
13 BRV =16; // b i t r a t e V o i c e
14 CS1 =10; //CS d a t a s e r v i c e 1 ( mErl / s u b s c r i b e r )
15 BRC1 =32; // b i t r a t e f o r CS1 i n kbps
16 CS2 =5; //CS d a t a s e r v i c e 2 ( mErl / s u b s c r i b e r )
17 BRC2 =64; // // b i t r a t e f o r CS2 i n kbps
18 PSdata =0.2; //PS d a t a s e r v i c e ( kbps p e r s u b s c r i b e r )
19 PSoverhead =0.15;
20 SHO =0.4; // 40%
21 Totalsub =350000; // T o t a l s u b s r i b e r s
22 Maxcap =196; //Maximum I u b c a p a c i t y o f tpRNC ( i n Mbps )
23 FR1 =0.9; FR2 =0.9; FR3 =0.9; // F i l l e r r a t e s
24
25 // s o l u t i o n
26 RNCreqd =( BTS * Sec * freq_sec ) /( cellsRNC * FR1 ) ; // from eqn
17.28

107
27 printf ( ’ u s i n g e q u a t i o n 1 7 . 2 8 , Number o f RNC r e q u i r e d
a r e %d \n ’ , round ( RNCreqd ) ) ;
28 RNC_reqd = BTS /( btsRNC * FR2 ) ; // from eqn 1 7 . 2 9
29 printf ( ’ u s i n g e q u a t i o n 1 7 . 2 9 , Number o f RNC r e q u i r e d
a r e %d \n ’ , round ( RNC_reqd ) ) ;
30 RNCrequired =(( VE /1000* BRV + CS1 /1000* BRC1 + CS2 /1000*
BRC2 +( PSdata /(1 - PSoverhead ) ) ) *(1+ SHO ) * Totalsub ) /(
Maxcap *1000* FR3 ) ; // from eqn 1 7 . 3 0
31 printf ( ’ u s i n g e q u a t i o n 1 7 . 3 0 , Number o f RNC r e q u i r e d
a r e %d \n ’ , round ( RNCrequired ) ) ;
32
33 printf ( ’ We s e l e c t f i r s t v a l u e which i s %d RNCs \n ’
, round ( RNCreqd ) ) ;

108
Chapter 19

Wireless Personal Area


Network Bluetooth

Scilab code Exa 19.1 To find hopping rate and various other parameters of Bluetoot

1 // Exa 1 9 . 1
2 // To c a l c u l a t e t h e h o p p i n g r a t e o f b l u e t o o t h , No o f
b i t s t r a n s m i t t e d i n one s l o t , e f f i c i e n c y o f
p a c k e t t r a n s m i s s i o n , and No o f t i m e s a p a c k e t i s
sent .
3
4 clc ;
5 clear all ;
6
7 SS =80; // Frame l e n g t h o f HV3 v o i c e p a c k e t
8 R =64*10^3; // Data r a t e i n bps
9
10 // s o l u t i o n
11 TS =240; //No o f b i t s c a r r i e d i n a s l o t
12 // From t a b l e 1 9 . 3 : B l u e t o o t h a i r i n t e r f a c e d e t a i l s ,
we g e t F r e q u e n c y h o p p i n g r a t e a s 1 6 0 0 h o p e s / s e c o n d
13
14 // From t a b l e 1 9 . 5 , we can n o t e t h a t f o r HV3 , No o f
s l o t s a r e 1 and c a r r y i n a l l ( 8 0 ( u s e r v o i c e s a m p l e

109
) +160( p a r i t y b i t s ) ) =240 b i t s i n one s l o t p a c k e t
15 HR =1600; // h o p e s / s e c o n d
16 Eff = SS / TS ;
17 x = R / SS ; // x i s number o f t i m e s a p a c k e t i s s e n t
18 printf ( ’ Hopping r a t e i s %d h o p e s / s e c \n ’ , HR ) ;
19 printf ( ’ No o f b i t s t r a n s m i t t e d i n one s l o t a r e %d \n
’ , TS ) ;
20 printf ( ’ E f f i c i e n c y o f p a c k e t t r a n s m i s s i o n i s %. 4 f \n
’ , Eff ) ;
21 printf ( ’ Number o f t i m e s a p a c k e t i s s e n t i s e q u a l t o
%d \n ’ ,x ) ;

Scilab code Exa 19.2 To find the associated data rate of a symmetric 1soot DM1

1 // Exa 1 9 . 2
2 // To f i n d t h e a s s o c i a t e d d a t a r a t e .
3
4 clc ;
5 clear all ;
6
7 R =136; // b i t s p e r s l o t
8 SR =800; // no o f s l o t s p e r s e c o n d
9
10 // s o l u t i o n
11 // A s y m m e t r i c 1− s l o t DM1 l i n k i s s e t u p between a
m a s t e r and a s l a v e
12 AR = R * SR ; // Data r a t e i n bps
13
14 printf ( ’ A s s o c i a t e d d a t a r a t e i s %0 . 1 f kbps \n ’ , AR
/1000) ;

110
Chapter 21

Wireless Local Area Network

Scilab code Exa 21.1 To find number of users supported by WLAN and its bandwidth e

1 // Exa 2 1 . 1
2 // To f i n d number o f u s e r s t h a t can be s u p p o r t e d by
t h e WLAN and t h e bandwidth e f ciency .
3
4 clc ;
5 clear all ;
6
7 Fl =902; // l o w e r l i m i t f r e q u e n c y MHz
8 Fh =928; // h i g h e r l i m i t f r e q u e n c y i n MHz
9 Rt =0.5; // symbol t r a n s m i s s i o n r a t e i n Mega s y m b o l s
per sec
10 S =16; //No o f s y m b o l s
11 BER =10^ -5; // B i r e r r o r r a t e
12 SG =2.6; // s e c t o r g a i n
13 B =0.5; // I n t e r f e r e n c e f a c t o r
14 a =0.9; // power c o n t r o l e f f i c i e n c y
15
16 // s o l u t i o n
17 BW = Fh - Fl ;
18 Rb = Rt * log2 ( S ) ;
19 Gp = BW / Rb ;

111
20 // BER = 10ˆ−5= 0 . 5 ∗ e r f c ( s q r t ( Eb No ) )
21 deff ( ’ y=f ( x ) ’ , ’ y =0.5∗ e r f c ( s q r t ( x ) ) −10ˆ−5 ’ )
22 [x ,v , info ]= fsolve (0.1 , f ) ; // x=Eb No
23 M = Gp / x * 1/(1+ B ) * SG * a ;
24 printf ( ’ Number o f u s e r s t h a t can be s u p p o r t e d by t h e
WLAN a r e %d \n ’ ,M ) ;
25 eff = Rb * int ( M ) / BW ;
26 printf ( ’ The bandwidth e f f i c i e n c y i s %. 2 f bps /Hz \n ’
, eff ) ;

Scilab code Exa 21.2 To find hopping bandwidth and various other parameters for FH

1 // Exa 2 1 . 2
2 // To f i n d −
3 // a ) t h e h o p p i n g bandwidth ,
4 // b ) What i s t h e c h i p −r a t e ,
5 // c ) How many c h i p s a r e t h e r e i n e a c h d a t a symbol ,
6 // d ) What i s t h e p r o c e s s i n g g a i n .
7
8 clc ;
9 clear all ;
10
11 Stepsize =200; // i n Hz
12 Chipsmin =20; // l e n g t h o f l i n e a r f e e d b a c k s h i f t
register
13 Datarate =1.2*10^3; // bps
14
15 // s o l u t i o n
16 No_of_tones =2^ Chipsmin ;
17 Bss = No_of_tones * Stepsize ;
18 Chiprate = Datarate * Chipsmin ;
19 Gp = Bss / Datarate ; // p r o c e s s i n g g a i n
20 Symbolrate = Datarate /3; //8− a r y FSK i s u s e d
21 Chips_symbol = Chiprate / Symbolrate ;
22 printf ( ’ The Hopping Bandwidth i s %. 3 f MHz\n ’ , Bss

112
/10^6) ;
23 printf ( ’ The c h i p r a t e i s %d k c h i p / s e c \n ’ , Chiprate
/10^3) ;
24 printf ( ’ C h i p s p e r symbol a r e %d \n ’ , Chips_symbol ) ;
25 printf ( ’ The p r o c e s s i n g g a i n i s %. 1 f \n ’ , Gp ) ;

Scilab code Exa 21.3 To find bandwidth of a subchannel and various other parameter

1 // Exa 2 1 . 3
2 //To f i n d −
3 // a ) The bandwidth o f a s u b c h a n n e l ,
4 // b ) m o d u l a t i o n e f ciency ,
5 // c ) u s e r symbol r a t e ,
6 // d ) u s e r d a t a r a t e i f t h e i n f o r m a t i o n b i t s a r e
encoded with a r a t e o f 3/4 ,
7 // e ) t i m e u t i l i z a t i o n e f ciency o f the system .
8
9 clc ;
10 clear all ;
11
12 InfoSc =48; // I n f o r m a t i o n s u b c a r r i e r s
13 SyncSc =4; // s y n c h r o n i z a t i o n s u b c a r r i e r s
14 ReservedSc =12; // R e s e r v e d s u b c a r r i e r s
15 Symrate =250; // k s p s ( k i l o s y m b o l s p e r s e c o n d )
16 BW =20; // / i n MHz
17 Grdt =800; // Guard t i m e i n n s e c
18
19 // s o l u t i o n
20 TotalSc = InfoSc + SyncSc + ReservedSc ; // T o t a l s u b c a r r i e r s
21 BW_Sch = BW *10^6/ TotalSc ; //BW o f s u b c h a n n e l
22 Mod_eff = Symrate *10^3/( BW_Sch ) ; // M o d u l a t i o n
efficiency
23 User_txrate = InfoSc * Symrate *10^3;
24 User_bitsymbol =4; // 16−QPSK i s u s e d
25 disp ( ”From t a b l e 2 1 . 7 For m o d u l a t i o n scheme a s 16−

113
QAM and c o d i n g r a t e =3/4 t h e n U s e r d a t a r a t e w i l l
be 36 Mbps” ) ;
26 User_DR =36; // Mbps
27 Sym_Dur =1/( Symrate *10^3) ;
28 TimeUti = Sym_Dur /( Sym_Dur +( Grdt /10^9) ) ;
29
30 printf ( ’ The bandwidth o f s u b c h a n n e l i s %. 1 f kHz \n ’ ,
BW_Sch /10^3) ;
31 printf ( ’ M o d u l a t i o n e f f i c i e n c y i s %. 1 f s y m b o l s / s e c /
Hz \n ’ , Mod_eff ) ;
32 printf ( ’ U s e r symbol r a t e i s %d Msps \n ’ , User_txrate
/10^6) ;
33 printf ( ’ Time U t i l i z a t i o n e f f i c i e n c y i s %. 2 f \n ’ ,
TimeUti ) ;

Scilab code Exa 21.4 To find coverage of the AP

1 // Exa 2 1 . 4
2 // To d e t e r m i n e t h e c o v e r a g e o f AP .
3
4 clc ;
5 clear all ;
6
7 Eb_No =10; // i n dB
8 Noise = -120; // i n dBm
9 Pt =20; // i n mwatt
10 R =1; // Data r a t e i n Mbps
11 CHBW =0.5; //BW i n MHz
12 A =37.7; // p a t h l o s s a t t h e rst m e t e r i n dB
13 Y =3.3; // p a t h l o s s e x p o n e n t
14 Lf =19; // f u n c t i o n r e l a t i n g power l o s s w i t h number o f
oors n ( i n dB )
15 Ls =10; // l o g n o r m a l l y d i s t r i b u t e d random v a r i a b l e
r e p r e s e n t i n g t h e shadow e f f e c t i n dB
16

114
17 // s o l u t i o n
18 S2Nreqd = Eb_No * R / CHBW ;
19 Rx_sensi = Noise + S2Nreqd ;
20 Lp =10* log10 (20) - Rx_sensi ;
21 // Lp=A+10 Ylod ( d )+L f+Ls ; t h e r e f o r e
22 d =10^(( Lp -A - Lf - Ls ) /(10* Y ) ) ;
23 printf ( ’ The c o v e r a g e o f AP i s %. 1 f m e t r e s \n ’ ,d ) ;

Scilab code Exa 21.5 To calculate coded symbol and bit transmission rate per subsc

1 // Exa 2 1 . 5
2 // To d e t e r m i n e t h e c o d e d symbol t r a n s m i s s i o n r a t e
p e r s u b c a r r i e r and b i t t r a n s m i s s i o n r a t e p e r
s u b c a r r i e r f o r e a c h o f t h e two modes .
3
4 clc ;
5 clear all ;
6
7 R =3/4; // c o d e r a t e o f c o n v o l u t i o n e n c o d e r
8 M1 =9; // p a y l o a d t r a n s m i s s i o n r a t e i n Mbps f o r mode 1
9 M2 =36; // p a y l o a d t r a n s m i s s i o n r a t e i n Mbps f o r mode
2
10
11 // s o l u t i o n
12 D1 = M1 *10^6/48; // u s e r d a t a r a t e i n kbps f o r mode 1
13 D2 = M2 *10^6/48; // u s e r d a t a r a t e i n kbps f o r mode 2
14 // R e f e r i n g t o T a b l e 2 1 . 1 1
15 printf ( ’ Data t r a n s m i s s i o n r a t e p e r c a r r i e r w i t h 3/4
c o n v o l u t i o n e n c o d e r a r e %. 1 f Kbps and %d Kbps \n ’
, D1 /10^3 , D2 /10^3) ;
16 C1 = D1 / R ;
17 C2 = D2 / R ;
18 printf ( ’ C a r r i e r t r a n s m i s s i o n r a t e w i t h R=3/4
c o n v o l u t i o n a l e n c o d e r a r e %d Kbps and %d Kbps \n ’ ,
C1 /10^3 , C2 /10^3) ;

115
19 printf ( ’ C a r r i e r symbol r a t e w i t h R=3/4
c o n v o l u t i o n a l e n c o d e r a r e %d k s p s and %d Ksps \n ’
, C1 /10^3 , C2 /4/10^3) ; // Mode1 a s BPSK and MOde2
a s 16−QAM

Scilab code Exa 21.6 To find user data rate for HIPERLAN 2

1 // Exa 2 1 . 6
2 // To d e t e r m i n e t h e u s e r d a t a r a t e f o r HIPERLAN / 2 .
3
4 clc ;
5 clear all ;
6
7 R =3/4; // c o d e r a t e f o r c o n v o l u t i o n e n c o d e r
8
9 // s o l u t i o n
10 // 64−QAM m o d u l a t i o n i s u s e d
11 Sc =250; // C a r r i e r symbol r a t e ( k s p s ) from Exa 2 1 . 5
12 Bits_sym = log2 (64) ; // 64−QAM i s u s e d
13 User_R = Bits_sym * Sc *10^3* R *48;
14 printf ( ’ The u s e r d a t a r a t e i s %d Mbps \n ’ , User_R
/10^6) ;

Scilab code Exa 21.7 To determine the collision probability of a FH packet

1 // Exa 2 1 . 7
2 // To d e t e r m i n e t h e PER( P a c k e t e r r o r r a t e ) f o r FH(
F r e q u e n c y Hopping p a c k e t ) and DS( D i r e c t s p r e a d
packet ) .
3
4 clc ;
5 clear all ;
6

116
7 D =1000*8; // p a c k e t s i z e i n b i t s
8 R =2*10^6; // t r a n s m i s s i o n r a t e i n bps
9 L =3; // msec ( D w e l l t i m e )
10 H =0.625; // msec ( D u r a t i o n o f BT p a c k e t )
11
12 // s o l u t i o n
13 Tw =10^3* D / R ; // t h e p a c k e t d u r a t i o n o f IEEE 8 0 2 . 1 1
i n msec
14 H_L =1;
15 G =( H_L ) *L - Tw - H ;
16 Gm = abs ( G ) ;
17 PER_FH =1 -((1 - Gm / L ) *(78/79) ^( H_L ) + Gm / L *(78/79) ^(( H_L )
-G / Gm ) ) ;
18 PER_DS =1 -((1 - Gm / L ) *(57/79) ^( H_L ) + Gm / L *(57/79) ^(( H_L )
-G / Gm ) ) ;
19 printf ( ’ The PER f o r FH p a c k e t and PER f o r DS p a c k e t
a r e %d p e r c e n t & %. 2 f p e r c e n t r e s p e c t i v e l y ’ , round
( PER_FH *100) , PER_DS *100) ;
20 disp ( ” The c o l l i s i o n p r o b a b i l i t y w i t h 8 0 2 . 1 1 DS i s
much h i g h e r t h a n w i t h 8 0 2 . 1 1 FH . ” )

Scilab code Exa 21.8 To calculate min SIR and using this SIR and other data calcul

1 // Exa 2 1 . 8
2 // To d e t e r m i n e SIRmin and r max .
3
4 clc
5 clear all ;
6
7 d =10; // d i s t a n c e b e t w e e n AP and IEEE 8 0 2 . 1 1 d e v i c e
in metres
8 Y =4; // p a t h l o s s e x p o n e n t
9 PBt =20; // t h e t r a n s m i t t e d power by t h e BT i n dBm
10 PAp =40; // t h e t r a n s m i t t e d power by t h e AP i n dBm
11 Pe =10^ -5; // a c c e p t a b l e e r r o r p r o b a b i l i t y

117
12
13 // s o l u t i o n
14 // Pe =0.5∗ e ˆ ( − 0 . 5 ∗ Eb/No )
15 SIR = log ( Pe /0.5) /( -0.5) ; // s i g n a l −to − i n t e r f e r e n c e
ratio
16 rmax = d *( SIR * PBt / PAp ) ^(1/ Y ) ; // r a n g e o f i n t e r f e r e n c e
b e t w e e n B l u e t o o t h and 8 0 2 . 1 1 d e v i c e
17 printf ( ’ Minimum SIR i s %. 2 f dB = %. 1 f \n ’ ,10* log10 (
SIR ) , SIR ) ;
18 printf ( ’ Maximum c o v e r a g e r a n g e i s %. 2 f m e t r e s \n ’ ,
rmax ) ;

Scilab code Exa 21.9 To calculate Rmax for given interference scenarios

1 // Exa 2 1 . 9
2 // To c a l c u l a t e rmax f o r t h e i n t e r f e r e n c e s c e n a r i o s
( s e e F i g u r e 2 1 . 2 1 ) u s i n g Smin from Example 2 1 . 8 .
3
4 clc ;
5 clear all ;
6
7 SIRmin =21.6; // From e g 2 1 . 8 i . e ( 1 3 . 3 6 dB )
8 d =10; // d i s t a n c e b e t w e e n AP and IEEE 8 0 2 . 1 1 d e v i c e
in m
9 PMs =40; // t r a n s m i t t e d power o f t h e IEEE 8 0 2 . 1 1
d e v i c e i n dBm
10 PBt =20; // t h e t r a n s m i t t e d power by t h e BT i n dBm
11 Y =4 ; // p a t h l o s s e x p o n e n t
12
13 // s o l u t i o n
14 rmax = d *( SIRmin * PMs / PBt ) ^(1/ Y ) ;
15 printf ( ’ Maximum c o v e r a g e r a n g e i s %. 1 f m e t r e s \n ’ ,
rmax ) ;

118
Scilab code Exa 21.10 To calculate Rmax for IEEE 802 11 FH and DS devices

1 // Exa 2 1 . 1 0
2 // Repeat P r o b l e m s 2 1 . 8 and 2 1 . 9 , i f t h e IEEE 8 0 2 . 1 1
FH d e v i c e i s r e p l a c e d by t h e IEEE 8 0 2 . 1 1 DS
d e v i c e (Gp=11) .
3
4 clc
5 clear all ;
6
7 Gp =11; // p r o c e s s i n g g a i n ( g i v e n )
8 // D e f i n i n g v a r i a b l e s from Exa 2 1 . 8 & 2 1 . 9
9 PBt =20; // t r a n s m i t t e d power by t h e BT i n dBm
10 PMs =40; // t r a n s m i t t e d power o f t h e IEEE 8 0 2 . 1 1
d e v i c e i n dBm
11 PAp =40; // t r a n s m i t t e d power by t h e AP i n dBm
12 d =10; // d i s t a n c e b e t w e e n AP and IEEE 8 0 2 . 1 1 d e v i c e
in m
13 Y =4; // p a t h l o s s e x p o n e n t
14 Pe =10^ -5; // E r r o r p r o b a b i l i t y
15
16 // s o l u t i o n
17 // Pe =0.5∗ e ˆ ( − 0 . 5 ∗ Eb/No )
18 SIR = log ( Pe /0.5) /( -0.5) ;
19 r1max = d *( SIR * PBt /( PAp * Gp ) ) ^(1/ Y ) ; // r a n g e o f
i n t e r f e r e n c e b e t w e e n B l u e t o o t h and 8 0 2 . 1 1 d e v i c e
20 printf ( ’ Maximum c o v e r a g e r a n g e f o r IEEE 8 0 2 . 1 1 DS
i s %. 2 f m e t r e s \n ’ , r1max ) ;
21 r2max = d *( SIR * PMs /( PBt * Gp ) ) ^(1/ Y ) ;
22 printf ( ’ Maximum c o v e r a g e r a n g e f o r IEEE 8 0 2 . 1 1 FH
i s %. 2 f m e t r e s \n ’ , r2max ) ;
23 disp ( ” Thus , t h e i n t e r f e r e n c e r a n g e s a r e s m a l l e r f o r
t h e IEEE 8 0 2 . 1 1 DS d e v i c e compared t o t h e IEEE
8 0 2 . 1 1 FH d e v i c e . ” )

119
Chapter 24

Spreading Codes used in


CDMA

Scilab code Exa 24.1 To generate m sequence and demonstrate its properties

1 // Exa D. 1
2 // U s i n g t h e s h i f t r e g i s t e r shown i n F i g u r e D. 3 ,
g e n e r a t e an m−s e q u e n c e and d e m o n s t r a t e i t s
properties .
3
4 clc ;
5 clear all ;
6
7 // s o l u t i o n
8 // R e f e r r i n g F i g D. 3
9 x =[0 0 1]; // I n i t i a l s t a g e
10 output = x (3) ;
11 disp ( ” F i r s t m−s e q u e n c e u s i n g 3− s t a g e shift register
. ”);
12 disp ( ” x1 x2 x3 output ”);
13 printf ( ’ I n i t i a l %d %d %d %d \n ’ ,x
(1) ,x (2) ,x (3) , output ) ;
14 for i = 1:7
15 printf ( ’ S h i f t %d ’ ,i ) ;

120
16 x (3) = x (2) ;
17 if ( x (3) ==1) //TO g e t v a l u e s i n r a n g e o f [ −1 1 ]
for plot
18 dummy ( i ) = -1
19 else
20 dummy ( i ) =1;
21 end
22 x (2) = x (1) ;
23 if ( output == 1& x (3) ==1) // As new x ( 1 )=p r e v s t a g e
x (3) ored
prev stage x (2)
24 x (1) =0;
25 else
26 if ( output == 0& x (3) ==0)
27 x (1) =0;
28 else
29 x (1) =1;
30 end
31 end
32
33 printf ( ’ %d %d %d ’ ,x (1) ,x (2) ,x (3) ) ;
34 output = x (3) ;
35 printf ( ’ %d ’ , output ) ;
36 printf ( ’ \n ’ ) ;
37 end
38 bar ( dummy ,0.2 , ’ g r e e n ’ ) ;
39 xlabel ( ” Time ” ,” F o n t S i z e ” ,5) ;
40 title ( ”7− c h i p f i r s t m−s e q u e n c e f o r one T p e r i o d ” ,”
F o n t S i z e ” ,5) ;
41 disp ( ” The p r o p e r t i e s o f m−s e q u e n c e i n F i g u r e ( 0 ) a r e −
”);
42 disp ( ”Number o f −1 s = 4 , Number o f 1 s = 3 ” ) ;
43 disp ( ”Run l e n g t h 1 = 2 , Run l e n g t h 2 = 1 ” ) ;
44 disp ( ”Run l e n g t h = 1 ” ) ;

121
Scilab code Exa 24.2 To generate second m sequence

1 // Exa D. 2
2 // what i s t h e l o c a t i o n o f t h e modulo −2 a d d e r f o r
t h e s e c o n d m−s e q u e n c e ? G e n e r a t e t h e s e c o n d m−
sequence .
3
4 clc ;
5 clear all ;
6
7 // s o l u t i o n
8 disp ( ” The l o c a t i o n o f modulo −2 a d d e r f o r t h e s e c o n d
m−s e q u e n c e i s shown i n F i g u r e D . 5 ( i n t h e book ) i . e
Modulo −2 a d d e r s h o u l d be b e t w e e n f i r s t ( x1 ) and
s e c o n d ( x2 ) s h i f t r e g i s t e r . ” ) ;
9 x =[0 0 1]; // I n i t i a l s t a g e
10 output = x (3) ;
11 disp ( ” S e c o n d m−s e q u e n c e u s i n f 3− s t a g e r e g i s t e r ” ) ;
12 disp ( ” x1 x2 x3 output ”);
13 printf ( ’ I n i t i a l %d %d %d %d \n ’ ,x
(1) ,x (2) ,x (3) , output ) ;
14 for i = 1:7
15 printf ( ’ S h i f t %d ’ ,i ) ;
16 x (3) = x (2) ;
17 if ( x (3) ==1) //TO g e t v a l u e s i n r a n g e o f [ −1 1 ]
for plot
18 dummy ( i ) = -1
19 else
20 dummy ( i ) =1;
21 end
22 x (2) = x (1) ;
23 if ( output == 1& x (2) ==1) // As new x ( 1 )=p r e v s t a g e
x (3) ored
prev stage x (2)
24 x (1) =0;
25 else
26 if ( output == 0& x (2) ==0)
27 x (1) =0;

122
28 else
29 x (1) =1;
30 end
31 end
32
33 printf ( ’ %d %d %d ’ ,x (1) ,x (2) ,x (3) ) ;
34 output = x (3) ;
35 printf ( ’ %d ’ , output ) ;
36 printf ( ’ \n ’ ) ;
37 end
38 figure (1) ;
39 bar ( dummy ,0.2 , ’ g r e e n ’ ) ;
40 xlabel ( ” Time ” ,” F o n t S i z e ” ,5) ;
41 title ( ”7− c h i p s e c o n d m−s e q u e n c e f o r one T p e r i o d ” ,”
F o n t S i z e ” ,5) ;
42 disp ( ” The p r o p e r t i e s o f m−s e q u e n c e i n F i g u r e ( 1 ) a r e −
”);
43 disp ( ”Number o f −1 s = 4 , Number o f 1 s = 3 ” ) ;
44 disp ( ”Run l e n g t h 1 = 2 , Run l e n g t h 2 = 1 ” ) ;
45 disp ( ”Run l e n g t h = 1 ” ) ;

123

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy