You are on page 1of 130

JIMMA UNIVERSITY

JIMMA INSTITUTE OF TECHNOLOGY

FACULITY OF ELECTRICAL AND COMPUTER ENGINEERING

POST-GRADUATE COMMUNIICATION STREAM

Modeling and Simulation of Digital communication System

Name ID number

Edemialem Tamiru……………………………...............….….RM7

Edemialem Tamiru……………………………...............….….RM7

Zemenu Addiss……………………………...............….….RM7 450/11-0

Edemialem Tamiru……………………………...............….….RM7 445/11-0

Edemialem Tamiru……………………………...............….….RM7

Edemialem Tamiru……………………………...............….….RM7

Edemialem Tamiru……………………………...............….….RM7

Submission Date: 10-Jan-2020


submitted to: Dr. Mulugata.A
CONTENTS
CHAPTER ONE ............................................................................................................................................... 1
INTRODUCTION TO DIGITAL COMMUNICATION SYSTEM......................................................................... 1
CHAPTER TWO .............................................................................................................................................. 3
SOURCE ENCODING .................................................................................................................................. 3
CHAPTER THREE ............................................................................................................................................ 9
Channel encoding and decoding techniques ............................................................................................ 9
2.1 Channel encoding............................................................................................................................ 9
2.2 Channel Decoding ............................................................................................................................. 21
2.2.1 Convolutional decoding ...................................................................................................... 21
2.2.2 Soft and Hard Decision Decoding........................................................................................ 22
Chapter four ................................................................................................................................................ 39
Multiplexing ............................................................................................................................................ 39
4.1 Types of multiplexing ........................................................................................................................ 40
4.1.1 Space division multiplexing ........................................................................................................ 40
4.1.2 Frequency division multiplexing ................................................................................................ 40
4.1.3 Wave division multiplexing ........................................................................................................ 42
4.1.4 Polarization division multiplexing .............................................................................................. 43
4.1.5 Code division multiplexing ......................................................................................................... 43
4.1.6 Time division multiplexing ......................................................................................................... 44
4.2 Demultiplexing .................................................................................................................................. 47
Chapter five ................................................................................................................................................. 53
Digital Modulations ................................................................................................................................. 53
5.1 BPSK digital modulation and Demodulation: ................................................................................ 53
5.2 QPSK Modulation and Demodulation ........................................................................................... 58
5.3 M-QAM Modulation...................................................................................................................... 63
5.4 Frequency shift key (FSK) modulation and demodulation............................................................ 66
CHAPTER six ................................................................................................................................................ 93
Frequency-Hopped Spread-Spectrum .................................................................................................... 93
Chapter seven ........................................................................................................................................... 104
Multiple access ..................................................................................................................................... 104

i
7.1 Time division multiple-access (TDMA) ........................................................................................ 105
7. 2. Code division multiple-access (CDMA) ..................................................................................... 106
7. 3. Frequency division multiple-access (FDMA) ............................................................................. 106
Chapter Eight ............................................................................................................................................ 115
Channel Model ...................................................................................................................................... 115
8.1 AWGN Model .............................................................................................................................. 115
8.2 Fading Channel ............................................................................................................................ 117
Conclusion ................................................................................................................................................. 125

ii
CHAPTER ONE
INTRODUCTION TO DIGITAL COMMUNICATION SYSTEM
Digital communication system involves the transmission of information in digital form from the
source that generates the information to one or more destinations. In the simplest form, a
transmission-reception system is a three-block system, consisting of a) a transmitter, b) a
transmission medium and c) a receiver. If we think of a combination of the transmission device
and reception device in the form of a ‘transceiver’ and if (as is usually the case) the transmission
medium allows signal both ways, we are in a position to think of a both-way (bi-directional)
communication system.

A digital communication system has several distinguishing features when compared with an
analog communication system. Both analog (such as voice signal) and digital signals (such as data
generated by computers) can be communicated over a digital transmission system. When the signal
is analog in nature, an equivalent discrete-time discrete-amplitude representation is possible after
the initial processing of sampling and quantization.

Figure 1.1 illustrates the functional diagram and the basic of a digital communication system. The
source output may be either an analog signal, such as audio or video signal, or digital signal. In a
digital communication system, the message produced by the source are converted into a sequence
of binary digits. Ideally, we should like to represent the source output (message) by as few binary
digits as possible. In other words, we seek an efficient representation of the source output that
results in little or no redundancy. The process of efficiently converting the output of either analog

1
or digital source into a sequence of binary digits is called source encoding or data compression.
Then after the channel encoder introduces some redundancy in the binary information sequence,
in a controlled manner. Such introduction of controlled redundancy can be used at the receiver to
provide error correction capability to the data being transmitted. For transmission of high-speed
digital data (e.g. Computer communication systems), the digital signal needs to be modulated. The
primary purpose of the digital modulator is to map the binary information sequence into high
frequency analog signal waveforms (carrier signals). Multiplexing and multiple access both
involve the idea of resource sharing. Multiplexing takes place locally and multiple access takes
place remotely. Spreading is used in military applications for achieving interference protection and
privacy. Signals can be spread in frequency, in time, or in both frequency and time. The
communication channel is the physical medium that is used to send the signal from the transmitter
to the receiver. In wireless transmission, the channel may be the atmosphere (free space). On the
other hand, telephone channels usually employ a variety of physical media, including wirelines,
optical fiber cables, and wireless (microwave radio).

At the receiver side, the baseband decoder block converts back the line coded pulse waveform to
transmitted data sequence. Then The receiver front end and/or the demodulator provides frequency
down conversion for each of the received band pass waveform. Digital demodulation is defined as
recovery of a waveform (base band pulse). The estimates of the transmitted data symbols are
passed to the channel decoder. The channel decoder attempts to reconstruct the original
information sequence from knowledge of the code used by the channel encoder and the redundancy
contained in the received data. The source decoder accepts the output sequence from the channel
decoder. From the knowledge of the source encoding method used, it attempts to reconstruct the
original signal from the source. Because of channel decoding errors and possible distortion
introduced by the source decoder, the signal at the output of the source decoder is an approximation
to the original source output.

In the next of each chapter we mainly focus on the designing each system components of digital
communication and performance analysis of each elements by mainly in terms of bit error rate.

2
CHAPTER TWO
SOURCE ENCODING
The process by which information symbols are mapped to alphabetical symbols is called source
coding. The mapping is generally performed in sequences or groups of information and
alphabetical symbols. Also, it must be performed in such a manner that it guarantees the exact
recovery of the information symbol back from the alphabetical symbols otherwise it will destroy
the basic theme of the source coding. The source coding is called lossless compression if the
information symbols are exactly recovered from the alphabetical symbols otherwise it is called
lossy compression. The Source coding also known as compression or bit-rate reduction process. It
is the process of removing redundancy from the source symbols, which essentially reduces data
size. Source coding is a vital part of any communication system as it helps to use disk space and
transmission bandwidth efficiently. The source coding can either be lossy or lossless. In case of
lossless encoding, error free reconstruction of source symbols is possible, whereas, exact
reconstruction of source symbols is not possible in case of lossy encoding. The minimum average
length of code words as function of entropy is restricted between an upper and lower bound of the
information source symbols by the Shannon’s source coding theorem.

In Fig.2 a general source encoding and decoding system is presented. Analog information
source is sampled and quantized and finally represented with binary (or M-ary) symbols b(kTs).
In
the receiver side the received symbols bˆ (kTs) are decoded and filtered back to analog signal. So
there is an analog-to-digital (A/D) conversion in the transmitter and digital-to-analog (D/A)
conversion in the receiver.

Fig 2. Block diagram for source coding system.

3
The quantization operation typically transforms an analog signal X into a discrete signal Xq. This
operation introduces some quantization noise Xq-X into the system and the system designer tries
to minimize the mean squared error E{(X-Xq)2}. If the samples X(kTs) are uncorrelated, then they
can be quantized independently, but otherwise some data processing is needed to remove
correlation between samples before quantization.

A. Quantization
Classical uniform quantization divides the input voltage into equal intervals, thus ith interval
corresponds to range i∆+(∆/2). When input voltage falls into this range, quantizer gives an output
integer i. Nonuniform quantizer divides the input range into unequal intervals. The input signal is
first processed by a compressor and after that with a uniform quantizer. So called µ-law for a
compressor gives xc=vc/V as a function of x=v/V as follows

Where xc is the compressor output, v the input, V the maximum input and µ is typically 255. So
called A-law is given by

The source decoder estimates xc by performing simply inverse mapping from the integer i as
follows

Finally, an estimate on the original input is given by the expander as follows

4
where (sgn x)g(x) describes the used compressor law in the above equation.

B. Differential Quantization
If the sequence {X(kTs)} is correlated, the variance of the difference X(kTs) - X((k-1)Ts) is smaller
than the original variance of X(kTs). Therefore it is beneficial to quantize the difference instead of
the original sequence to achieve lower MSE. In general a predictor uses a linear combination of
M previous values as follows

The predictor coefficients ai can be solved from

In Fig 3. transmitter and receiver with differential quantization are shown.

TRANSMITTER

5
RECEIVER

Fig 3. Differential encoding.

C. Encoding discrete information sources


In the case of discrete information source, there are only a limited number of possible symbols
that could be transmitted. Source encoding is now transforming original information into a binary
or
M-ary sequence. In order to conserve system bandwidth, it is beneficial that encoding utilizes as
low bit rate as possible and that the encoding is unique, hence the original message can be
recovered without errors.

There are many possible algorithms to encode discrete source. Here is given an algorithm that
was first proposed by Shannon and which maps M-ary alphabet into binary digits. Let us assume
that the encoder input consists of blocks of N symbols and there are q(N) possible messages of
that length. Let p1,p2,…,pq(N) be the probabilities of these messages, and p1+p2+…+pq(N)=1, p1 >
p2
>…> pq(N). Then the minimum average number of bits per symbol for these blocks is

Shannon proposes the following encoding for the blocks of N symbols. Let

6
.

Let also ni be a following integer

Then the binary encoding for message mi is the binary expansion of Fi using up to ni bits. This
algorithm assigns shorter codes for messages of higher probability, which decreases the average
number of bits per symbol.

D. Simulation of source coding

We can observe that idealized A/D operation, uniform or nonuniform quantization, is a simple
memoryless transformation. So it is enough to read input value and calculate the corresponding
output. Real A/D converters have many different properties, but very often idealized models will
do. In the receiver end an inverse D/A conversion is performed. Usually first the binary sequence
is mapped into quantized digital sequence and after that the sequence is filtered into an analog
signal. Hence, as we have presented source encoding and decoding steps, we can now assume that
encoded binary sequence consists of '0' and '1' with equal probabilities or M-ary sequence with
each symbol equally probably. As we have this assumption, we can replace the actual source
encoder with a (pseudo) random binary sequence, if we are not particularly interested in source
encoding/decoding, sampling or quantization operations.

Huffman encoding matlab code

>> clear all;

close all;

sig=1:4;

Symbols=[1 2 3 4];

P=[0.1 0.3 0.4 0.2];

7
dict = huffmandict(Symbols,P);

temp=dict;

for i=1: length(temp)

temp {i,2}= num2str(temp{i,2});

end

disp(temp);

hcode= huffmanenco(sig,dict)

dhsig= huffmandeco(hcode, dict)

[1] '0 0 1'

[2] '0 1'

[3] '1'

[4] '0 0 0'

hcode =

0 0 1 0 1 1 0 0 0

dhsig =

1 2 3 4

8
CHAPTER THREE
CHANNEL ENCODING AND DECODING TECHNIQUES
2.1 Channel encoding
Forward Error Correction (FEC)

The key idea of FEC is to transmit enough redundant data to allow receiver to recover from errors
all by itself. No sender retransmission required. In a digital communication system, we have to
transmit more data via a noisy channel which results in vast number of errors. The answer for this
issue is channel encoding and decoding techniques which helps in error control and in increasing
the effectiveness and performance of communication systems. Channel codes are used to add
protection against errors in the channel. It can be seen as a way of increasing the distance between
transmitted alternatives, so that a receiver has a better chance of detecting the correct one in a noisy
channel.

The major categories of FEC codes are:

 Block codes
 Cyclic codes
 Reed-Solomon codes
 Convolutional codes
 Turbo codes, etc.
The structured redundancy added in the channel coding is often called parity or check sum.

We can classify channel codes in two principal groups:

I. BLOCK CODES: Encodes data in blocks of k, using code words of length n.


II. CONVOLUTION CODES: Encodes data in a stream, without breaking it into blocks,
creating code sequences.

9
2.1.1 Block Codes
Block codes are one example of the forward error correcting coding (FECC) technique where we
encode the signal by adding additional bits or digits of redundant data so that the decoder is then
able to correct most of the errors which are introduced by transmission through a noisy channel.
Block codes collect or arrange incoming information carrying data into groups of k binary digits
and add coding (i.e. parity) bits to increase the coded block length up to n bits, where n>k.

Figure 2: Block coder with k information digits and appended parity check bits

The coding rate R is simply the ratio of data or information carrying bits to the overall block
length, k/n. The number of parity check (redundant) bits is therefore n – k. This block code is
usually described as a (n, k) code. An (n, k) block code is said to be linear if the vector sum of
two code words is a code word. The un coded k data bits be represented by the m vector: m=
(m , m , …, m ) and the corresponding code word be represented by the n-bit c vector: c= (c ,
1 2 k 1

c , …c , c , …, c , c ). Each parity bit consists of weighted modulo 2 sum of the data bits
2 k k+1 n-1 n

represented by Exclusive OR or modulo 2-addition. For K data bits and r = n-k redundant bits
the corresponding code word is given as:

10
c1  m1

c2  m2
...

ck  mk
c  m p
1 1( k 1)  m2 p2 ( k 1)  ...  mk pk ( k 1)
 k 1
...

cn  m1 p1n  m2 p2 n  ...  mk pkn

The block length C of the Linear Block Code is given by:

C=mG

where m is the information code word block length, G is the generator matrix.

G = [Ik | P] k × n

where Pi = Remainder of [x n-k+i-1/g(x)] for i=1, 2, ..., k, and I is unit or identity matrix.

At the receiving end, parity check matrix can be given as:

H = [PT | In-k], where PT is the transpose of the matrix P.

Figure 3: Operations of the generator matrix and the parity check matrix.

The parity check matrix H is used to detect errors in the received code by using the fact that C *
HT = 0 (null vector), let Received code vector x = c  e be the received message where c is the
correct code and e is the error and Compute S = x * HT =( c  e)* HT = c HT  e HT = e HT.

If S is 0 then message is correct else there are errors in it, from common known error patterns the
correct message can be decoded.

11
Suppose we want to code k = 4 information bits into a n = 7-bit code word, giving a coding rate
of 4/7. Code design is performed by using finite field algebra to achieve linear codes. We can
achieve this (7, 4) block code using 3 input exclusive or (EX - OR) gates to form the three even
parity check bits, P1, P2 and P3, from the 4 information carrying bits, I1...I4, as shown in Figure 4.

Figure 4: Logic gate representation for (7, 4) block coder

The “cross-in-the-circle” symbol indicates a bitwise exclusive-or (EX OR) operation.

Simulation result

linear Block Code matlab code


%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%

% Implementation Of linear Block Code

clc;
clear all;
% Input Generator Matrix
g=input('Enter The Generator Matrix: ')
disp ('G = ')

12
disp ('The Order of Linear block Code for given Generator Matrix is:')
[n,k] = size(transpose(g))
for i = 1:2^k
for j = k:-1:1
if rem(i-1,2^(-j+k+1))>=2^(-j+k)
u(i,j)=1;
else
u(i,j)=0;
end
end
end
u;
disp('The Possible Codewords are :')
c = rem(u*g,2)
disp('The Minimum Hamming Distance dmin for given Block Code is= ')
d_min = min(sum((c(2:2^k,:))'))

% Code Word
r = input('Enter the Received Code Word:')
p = [g(:,n-k+2:n)];
h = [transpose(p),eye(n-k)];
disp('Hammimg Code')
ht = transpose(h)
disp('Syndrome of a Given Codeword is :')
s = rem(r*ht,2)
for i = 1:1:size(ht)
if(ht(i,1:3)==s)
r(i) = 1-r(i);
break;
end
end

13
disp('The Error is in bit:')
i
disp('The Corrected Codeword is :')
r
******************** OUTPUT *******************

Enter The Generator Matrix: [1 0 0 0 1 0 1;0 1 0 0 1 1 1;0 0 1 0 1 1 0;0 0 0 1 0 1 1]

g=

1000101

0100111

0010110

0001011

G=

The Order of Linear block Code for given Generator Matrix is:

n=

k=

The Possible Codewords are :

c=

0000000

0001011

14
0010110

0011101

0100111

0101100

0110001

0111010

1000101

1001110

1010011

1011000

1100010

1101001

1110100

1111111

The Minimum Hamming Distance dmin for given Block Code is=

d_min =

Enter the Received Code Word:[1 0 0 0 1 0 0]

15
r=

1000100

Hammimg Code

ht =

101

111

110

011

100

010

001

Syndrome of a Given Codeword is :

s=

001

The Error is in bit:

i=

The Corrected Codeword is :

r=

16
1000101

The simulation below shows various values of the SNR and its corresponding BER of Hamming
codes. Consider a family of (n,k) linear block codes that have the following parameters.

Block length, n=2r-1

Number of message bits k=2r-r-1

Number of parity bits, n-k=r, where r>=3.

Assign the number of parity bits r=4

Performance analysis of hamming code matlab code

% performance analysis of hamming code (5,11) with AWGN


%HAMMING CODE
clc;
clear all;
close all;
m=4;
n=2^m-1;
k=11;
berf=[];
for i=1:10
b=0;
for j=1:50
msg=randi([0,1],500,k);
code=encode(msg,n,k,'hamming/binary');
t=0:0.1:10;
snr=0;
y=awgn(code,i);
y(find(y>0))=1;
y(find(y<0))=0;
msgop=decode(y,n,k,'hamming/binary');

17
[number,b1]=biterr(msgop,msg);
b=b+b1;
end
berf(i)=b/50;
end
semilogy(1:10,berf);
title('performance analysis in awgn for hamming codes');
xlabel('snr(db)');
ylabel('BER');

Figure 4: performance analysis of hamming code (5,11) with AWGN

2.1.2 Convolutional Encoder


We know that (n, k) block code where code words are constructed independently of each other.
Convolution code differ from block codes in the encoder output that is to say, it is not constructed
from single input but by using, previous encoder input bits. Clearly memory registers are required
to store the input for future use. In convolution codes, the coded bits are formed as convolutions
between the incoming bits and a number of generator sequences. A convolutional encoder encodes
K information bits to N > K code bits at one-time step. It can achieve a good performance by
expanding their memory depth.

18
Convolutional codes are denoted by (n, k, L), where L is code (or encoder) Memory depth (number
of register stages). Constraint length C=n(L+1) is defined as the number of encoded bits a message
bit can influence to. Convolutional encoder is a finite state machine (FSM) processing information
bits in a serial manner. Thus the generated code is a function of input and the state of the FSM.

Figure 5: (2,1, 2) Convolutional encoder.


(n, k, L) Convolutional code can be described by the generator sequences g (1), g (2) …, g (n) that
are the impulse responses for each coder n output branches as follows: .

Figure 6: Convolutional encoder generator sequences.

A polynomial forming the generator polynomial should be at most K degree and specifies the
connections between the shift registers and the modulo-2 adders or EXOR gates. Two generator
polynomials are g1(x) =1+x2, g2(x) =1+x+x2 which give g1(x) = (101) and g2(x) = (111).

Representation of Convolutional Codes

I. Tree diagram

19
The tree diagram helps in understanding the coding procedure of these type of codes.

Figure 7: Code tree diagram convolutional encoder.

The encoded group of bits can be derived from the tree diagram. It makes the encoding
procedure more detailed and easier to comprehend. Each branch of the tree represents an input
symbol and the corresponding pair of binary symbols(output) is shown on the branch. An input 0
indicates the upper and 1 represents the lower branch.

II. Trellis diagram


The trellis diagram of a convolutional code is acquired from its state diagram. All state moves at
every time step are expressly demonstrated in the graph to hold the time dimension, as is available
in the relating tree diagram. Normally, supporting portrayals on state moves, relating info, input
and output bits and so on are named in the trellis diagram. It is fascinating to note that the trellis
chart, which portrays the operation of the encoder, is extremely helpful for portraying the conduct
of the relating decoder, particularly when the celebrated 'Viterbi Algorithm (VA)' is taken after.

III. State Diagram

20
Substance of the furthest right (K-1) shift register stages characterize the states of the encoder.
Along these lines, the encoder in Fig. has four states. The move of an encoder starting with one
state then onto the next, as created by data bits. Another information bit causes a move starting
with one state then onto the next.

Figure 8: Trellis (a) and State (b) Diagrams of convolutional encoder.

2.2 CHANNEL DECODING


2.2.1 Convolutional decoding
In the process of recovering the encoded input data stream, at the receiver, once transmitted
through a channel, channel decoding algorithms are needed. There are two major forms of
channel decoding for convolutional codes: sequential decoding and the maximum likelihood
decoding or Viterbi decoding.

i. Maximum likelihood decoding


 It helps us to find the shortest path in the trellis diagram.

 It is based on the calculation of hamming distances.

ii. Viterbi Algorithm

21
Maximum likelihood decoding algorithm is complex to search all available paths because of end
to end calculation. Viterbi Algorithm performs maximum likelihood decoding by listening its
complexity dispensing the most unlikely trellis paths at every transmission stage. Viterbi algorithm
search trellis, accumulate distances, discard path with highest distance whenever they “collide”
and back-trace from the end. The Viterbi algorithm needs to keep track of one surviving path per
state in the trellis. For long code sequences this causes a memory problem. In practice we only
keep track of surviving paths in a window consisting of a certain number of trellis steps. At the
end of this window we enforce decisions on bits, based on the metric in the latest decoding step.

Figure 8: Examples of Viterbi decoding

If we do not detect ones and zeros before decoding our channel code using the Hamming distance,
we can use soft decoding. In the AWGN channel, this means comparing Euclidean distances
instead.

2.2.2 Soft and Hard Decision Decoding


In hard decision:

22
The decoder makes a firm or hard decision whether a one or a zero was transmitted and provides
no other information for the decoder such as how reliable the decision is. Hence, its output is only
zero or one (the output is quantized only to two level) that are called “hard-bits”. Decoding based
on hard-bits is called the “hard-decision decoding”.

In Soft decision:

The demodulator provides the decoder with some side information together with the decision. The
side information provides the decoder with a measure of confidence for the decision. The decoder
outputs which are called soft-bits, are quantized to more than two levels. Decoding based on soft-
bits, is called the “soft-decision decoding”.

Some of the key assumptions in Viterbi decoding are:

(a) Any state can be reached from only 2 possible previous state.

(b) Though we reach each state from 2 possible states, only one of the transition in valid. We can
find the transition which is more likely (based on the received coded bits) and ignore the other
transition.

(c) The errors in the received coded sequence are randomly distributed and the probability of error
is small.

Based on the above assumptions, the decoding scheme proceed as follows: Assume that there are
coded bits. Take two coded bits at a time for processing and compute Hamming distance, Branch
Metric, Path Metric and Survivor Path index for N/2+K-1 times.
Convolutional Coding and the associated hard decision Viterbi decoding
System Model
The simulation shows the bit error rate for BPSK modulation in AWGN using the convolutional
coding and Viterbi decoding is provided. Since 2 coded bits are required for transmission of each
data bit, the relation between coded bits to noise ratio Ec/No with bits to noise ratio Eb/No is
Ec/No = Eb/2No.

Simulation model

The simulation model performs the following:

 Generation of random BPSK modulated symbols +1’s and -1’s


23
 convolutional encode them using rate -1/2, generator polynomial [7,5] octal code
 Passing them through Additive White Gaussian Noise channel
 Hard decision demodulation on the received coded symbols
 Received coded bits are passed to Viterbi decoder
 Counting the number of errors from the output of Viterbi decoder
 Repeating the same for multiple Eb/No value.

Convolutionally encode binary data matlab code

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%
%Encode five two-bit symbols using a rate 2/3 convolutional code

data = randi([0 1],10,1);


trellis1 = poly2trellis([5 4],[23 35 0; 0 5 13]);
code1 = convenc(data,poly2trellis([5 4],[23 35 0; 0 5 13]));
length(code1)%Verify that the encoded output is 15 bits.
trellis2 = struct('numInputSymbols',2,'numOutputSymbols',4,...%Define the encoder's trellis
structure
'numStates',4,'nextStates',[0 2;0 2;1 3;1 3],...
'outputs',[0 3;1 2;3 0;2 1]);
code2 = convenc(randi([0 1],10,1),trellis2);%convenc to encode 10 one-bit symbols.
[code3,fstate] = convenc(data(1:6),trellis1);%Use the final and initial state arguments when
invoking convenc
code4 = convenc(data(7:10),trellis1,fstate);%Encode the rest of data
isequal(code1,[code3; code4])%Verify that the [code3; code4] matches code1.

Convolutional Coding and the associated hard decision Viterbi decoding Matlab code
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%

24
% Script for computing BER with Binary Convolutional Code
% and Viterbi decoding.
% Convolutional code of Rate-1/2, Generator polynomial - [7,5] octal
% Hard decision decoding is used.

clear
N = 10^6 ;% number of bits or symbols

Eb_N0_dB = [0:1:10]; % multiple Eb/N0 values


Ec_N0_dB = Eb_N0_dB - 10*log10(2);

ref = [0 0 ; 0 1; 1 0 ; 1 1 ];

ipLUT = [ 0 0 0 0;...
0 0 0 0;...
1 1 0 0;...
0 0 1 1 ];

for yy = 1:length(Eb_N0_dB)

% Transmitter
ip = rand(1,N)>0.5; % generating 0,1 with equal probability

% convolutional coding, rate - 1/2, generator polynomial - [7,5] octal


cip1 = mod(conv(ip,[1 1 1 ]),2);
cip2 = mod(conv(ip,[1 0 1 ]),2);
cip = [cip1;cip2];
cip = cip(:).';

s = 2*cip-1; % BPSK modulation 0 -> -1; 1 -> 0

25
n = 1/sqrt(2)*[randn(size(cip)) + j*randn(size(cip))]; % white gaussian noise, 0dB variance

% Noise addition
y = s + 10^(-Ec_N0_dB(yy)/20)*n; % additive white gaussian noise

% receiver - hard decision decoding


cipHat = real(y)>0;

% Viterbi decoding
pathMetric = zeros(4,1); % path metric
survivorPath_v = zeros(4,length(y)/2); % survivor path

for ii = 1:length(y)/2
r = cipHat(2*ii-1:2*ii); % taking 2 coded bits

% computing the Hamming distance between ip coded sequence with [00;01;10;11]


rv = kron(ones(4,1),r);
hammingDist = sum(xor(rv,ref),2);

if (ii == 1) || (ii == 2)

% branch metric and path metric for state 0


bm1 = pathMetric(1,1) + hammingDist(1);
pathMetric_n(1,1) = bm1;
survivorPath(1,1) = 1;

% branch metric and path metric for state 1


bm1 = pathMetric(3,1) + hammingDist(3);
pathMetric_n(2,1) = bm1;

26
survivorPath(2,1) = 3;

% branch metric and path metric for state 2


bm1 = pathMetric(1,1) + hammingDist(4);
pathMetric_n(3,1) = bm1;
survivorPath(3,1) = 1;

% branch metric and path metric for state 3


bm1 = pathMetric(3,1) + hammingDist(2);
pathMetric_n(4,1) = bm1;
survivorPath(4,1) = 3;

else
% branch metric and path metric for state 0
bm1 = pathMetric(1,1) + hammingDist(1);
bm2 = pathMetric(2,1) + hammingDist(4);
[pathMetric_n(1,1) idx] = min([bm1,bm2]);
survivorPath(1,1) = idx;

% branch metric and path metric for state 1


bm1 = pathMetric(3,1) + hammingDist(3);
bm2 = pathMetric(4,1) + hammingDist(2);
[pathMetric_n(2,1) idx] = min([bm1,bm2]);
survivorPath(2,1) = idx+2;

% branch metric and path metric for state 2


bm1 = pathMetric(1,1) + hammingDist(4);
bm2 = pathMetric(2,1) + hammingDist(1);
[pathMetric_n(3,1) idx] = min([bm1,bm2]);
survivorPath(3,1) = idx;

27
% branch metric and path metric for state 3
bm1 = pathMetric(3,1) + hammingDist(2);
bm2 = pathMetric(4,1) + hammingDist(3);
[pathMetric_n(4,1) idx] = min([bm1,bm2]);
survivorPath(4,1) = idx+2;

end

pathMetric = pathMetric_n;
survivorPath_v(:,ii) = survivorPath;
end

% trace back unit


currState = 1;
ipHat_v = zeros(1,length(y)/2);
for jj = length(y)/2:-1:1
prevState = survivorPath_v(currState,jj);
ipHat_v(jj) = ipLUT(currState,prevState);
currState = prevState;
end
% counting the errors
nErrViterbi(yy) = size(find([ip- ipHat_v(1:N)]),2);
end
simBer_Viterbi = nErrViterbi/N; % simulated ber - Viterbi decoding BER

theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber uncoded AWGN

close all
figure
semilogy(Eb_N0_dB,theoryBer,'bd-','LineWidth',2);

28
hold on
semilogy(Eb_N0_dB,simBer_Viterbi,'mp-','LineWidth',2);
axis([0 10 10^-5 0.5])
grid on
legend('theory - uncoded', 'simulation - Viterbi (rate-1/2, [7,5]_8)');
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('BER for BCC with Viterbi decoding for BPSK in AWGN');

Figure 10: BER plot for BPSK modulation in AWGN channel with Binary Convolutional code
and hard decision Viterbi decoding.
Observations

 For lower Eb/No regions, the error rate with Viterbi decoding is higher encoded bit error
rate. This is because, Viterbi decoder prefers the error to be randomly distributed for it
work effectively. At lower Eb/No values, there are more chances of multiple received
coded bits in errors, and the Viterbi algorithm is unable to recover.
 There can be further optimizations like – using soft decision decoding, limiting the
traceback length etc.
Convolutional Coding and the associated soft decision Viterbi decoding System Model
The received coded sequence is
, where

29
is the modulated coded sequence taking values if the coded bit is 1 and if the
coded bit is 0,
is the Additive White Gaussian Noise following the probability distribution function,

with mean and variance .


The conditional probability distribution function (PDF) of if the coded bit is 0 is,

.
Conditional probability distribution function (PDF) of if the coded bit is 1 is,

.
Euclidean distance
In the hard decision Viterbi decoding, based on the location of the received coded symbol, the
coded bit was estimated – if the received symbol is greater than zero, the received coded bit is 1;
if the received symbol is less than or equal to zero, the received coded bit is 0.
In Soft decision decoding, rather than estimating the coded bit and finding the Hamming
distance, the distance between the received symbol and the probable transmitted symbol is found
out.
Euclidean distance if transmitted coded bit is 0 is,

.
Euclidean distance if transmitted coded bit is 1 is,

As the terms , , and are common in both the equations they can be ignored. The
simplified Euclidean distance is,
and
.
As the Viterbi algorithm takes two received coded bits at a time for processing, we need to find
the Euclidean distance from both the bits.

30
Simulation Model
The simulation model performs the following:
 Generation of random BPSK modulated symbols +1’s and -1’s
 convolutional encode them using rate -1/2, generator polynomial [7,5] octal code
 Passing them through Additive White Gaussian Noise channel
 Received soft bits and hard bits are passed to Viterbi decoder
 Counting the number of errors from the output of Viterbi decoder
 Repeating the same for multiple Eb/No value.

Convolutional Coding and the associated soft and hard decision Viterbi decoding Matlab
code
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%

% Script for computing BER with Binary Convolutional Code


% and Viterbi decoding.
% Convolutional code of Rate-1/2, Generator polynomial - [7,5] octal
% Hard decision and soft decison decoding is used.

clear
N = 10^6 ;% number of bits or symbols

Eb_N0_dB = [0:1:10]; % multiple Eb/N0 values


Ec_N0_dB = Eb_N0_dB - 10*log10(2);

refHard = [0 0 ; 0 1; 1 0 ; 1 1 ];

31
refSoft = -1*[-1 -1; -1 1 ;1 -1; 1 1 ];

ipLUT = [ 0 0 0 0;...
0 0 0 0;...
1 1 0 0;...
0 0 1 1 ];

for yy = 1:length(Eb_N0_dB)

% Transmitter
ip = rand(1,N)>0.5; % generating 0,1 with equal probability

% convolutional coding, rate - 1/2, generator polynomial - [7,5] octal


cip1 = mod(conv(ip,[1 1 1 ]),2);
cip2 = mod(conv(ip,[1 0 1 ]),2);
cip = [cip1;cip2];
cip = cip(:).';

s = 2*cip-1; % BPSK modulation 0 -> -1; 1 -> 0

n = 1/sqrt(2)*[randn(size(cip)) + j*randn(size(cip))]; % white gaussian noise, 0dB variance

% Noise addition
y = s + 10^(-Ec_N0_dB(yy)/20)*n; % additive white gaussian noise

% receiver
cipHard = real(y)>0; % hard decision
cipSoft = real(y); % soft decision

% Viterbi decoding
pmHard = zeros(4,1); % hard path metric

32
svHard_v = zeros(4,length(y)/2); % hard survivor path
pmSoft = zeros(4,1); % soft path metric
svSoft_v = zeros(4,length(y)/2); % soft survivor path

for ii = 1:length(y)/2
rHard = cipHard(2*ii-1:2*ii); % taking 2 hard bits
rSoft = cipSoft(2*ii-1:2*ii); % taking 2 soft bits

% computing the Hamming distance and euclidean distance


rHardv = kron(ones(4,1),rHard);
rSoftv = kron(ones(4,1),rSoft);
hammingDist = sum(xor(rHardv,refHard),2);
euclideanDist = sum(rSoftv.*refSoft,2);

if (ii == 1) || (ii == 2)

% branch metric and path metric for state 0


bm1Hard = pmHard(1,1) + hammingDist(1);
pmHard_n(1,1) = bm1Hard;
svHard(1,1) = 1;
bm1Soft = pmSoft(1,1) + euclideanDist(1);
pmSoft_n(1,1) = bm1Soft;
svSoft(1,1) = 1;

% branch metric and path metric for state 1


bm1Hard = pmHard(3,1) + hammingDist(3);
pmHard_n(2,1) = bm1Hard;
svHard(2,1) = 3;
bm1Soft = pmSoft(3,1) + euclideanDist(3);
pmSoft_n(2,1) = bm1Soft;

33
svSoft(2,1) = 3;

% branch metric and path metric for state 2


bm1Hard = pmHard(1,1) + hammingDist(4);
pmHard_n(3,1) = bm1Hard;
svHard(3,1) = 1;
bm1Soft = pmSoft(1,1) + euclideanDist(4);
pmSoft_n(3,1) = bm1Soft;
svSoft(3,1) = 1;

% branch metric and path metric for state 3


bm1Hard = pmHard(3,1) + hammingDist(2);
pmHard_n(4,1) = bm1Hard;
svHard(4,1) = 3;
bm1Soft = pmSoft(3,1) + euclideanDist(2);
pmSoft_n(4,1) = bm1Soft;
svSoft(4,1) = 3;

else
% branch metric and path metric for state 0
bm1Hard = pmHard(1,1) + hammingDist(1);
bm2Hard = pmHard(2,1) + hammingDist(4);
[pmHard_n(1,1) idx] = min([bm1Hard,bm2Hard]);
svHard(1,1) = idx;
bm1Soft = pmSoft(1,1) + euclideanDist(1);
bm2Soft = pmSoft(2,1) + euclideanDist(4);
[pmSoft_n(1,1) idx] = min([bm1Soft,bm2Soft]);
svSoft(1,1) = idx;

% branch metric and path metric for state 1

34
bm1Hard = pmHard(3,1) + hammingDist(3);
bm2Hard = pmHard(4,1) + hammingDist(2);
[pmHard_n(2,1) idx] = min([bm1Hard,bm2Hard]);
svHard(2,1) = idx+2;
bm1Soft = pmSoft(3,1) + euclideanDist(3);
bm2Soft = pmSoft(4,1) + euclideanDist(2);
[pmSoft_n(2,1) idx] = min([bm1Soft,bm2Soft]);
svSoft(2,1) = idx+2;

% branch metric and path metric for state 2


bm1Hard = pmHard(1,1) + hammingDist(4);
bm2Hard = pmHard(2,1) + hammingDist(1);
[pmHard_n(3,1) idx] = min([bm1Hard,bm2Hard]);
svHard(3,1) = idx;
bm1Soft = pmSoft(1,1) + euclideanDist(4);
bm2Soft = pmSoft(2,1) + euclideanDist(1);
[pmSoft_n(3,1) idx] = min([bm1Soft,bm2Soft]);
svSoft(3,1) = idx;

% branch metric and path metric for state 3


bm1Hard = pmHard(3,1) + hammingDist(2);
bm2Hard = pmHard(4,1) + hammingDist(3);
[pmHard_n(4,1) idx] = min([bm1Hard,bm2Hard]);
svHard(4,1) = idx+2;
bm1Soft = pmSoft(3,1) + euclideanDist(2);
bm2Soft = pmSoft(4,1) + euclideanDist(3);
[pmSoft_n(4,1) idx] = min([bm1Soft,bm2Soft]);
svSoft(4,1) = idx+2;

end

35
pmHard = pmHard_n;
svHard_v(:,ii) = svHard;
pmSoft = pmSoft_n;
svSoft_v(:,ii) = svSoft;

end

% trace back unit


currHardState = 1;
currSoftState = 1;
ipHatHard_v = zeros(1,length(y)/2);
ipHatSoft_v = zeros(1,length(y)/2);
for jj = length(y)/2:-1:1
prevHardState = svHard_v(currHardState,jj);
ipHatHard_v(jj) = ipLUT(currHardState,prevHardState);
currHardState = prevHardState;

prevSoftState = svSoft_v(currSoftState,jj);
ipHatSoft_v(jj) = ipLUT(currSoftState,prevSoftState);
currSoftState = prevSoftState;
end

% counting the errors


nErrHardViterbi(yy) = size(find([ip- ipHatHard_v(1:N)]),2);
nErrSoftViterbi(yy) = size(find([ip- ipHatSoft_v(1:N)]),2);

end

simBer_HardViterbi = nErrHardViterbi/N; % simulated ber - hard decision Viterbi decoding


BER
simBer_SoftViterbi = nErrSoftViterbi/N; % simulated ber - soft decision Viterbi decoding BER

36
theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber uncoded AWGN

close all
figure
semilogy(Eb_N0_dB,theoryBer,'bd-','LineWidth',2);
hold on
semilogy(Eb_N0_dB,simBer_HardViterbi,'mp-','LineWidth',2);
semilogy(Eb_N0_dB,simBer_SoftViterbi,'cd-','LineWidth',2);
axis([0 10 10^-5 0.5])
grid on
legend('theory - uncoded', 'simulation - hard Viterbi', 'simulation - soft Viterbi');
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('BER for BCC with Viterbi decoding for BPSK in AWGN');

Figure 11: BER plot for BPSK with AWGN in soft decision Viterbi decoding

37
Observation

 When compared with hard decision decoding, soft decision decoding provides around 2dB
of gain for bit error rate of 10-4.

38
CHAPTER FOUR
MULTIPLEXING
The term “Multiplexing” or “Muxing” is one kind of technique for combining multiple signals like
analog as well as digital into one signal over a channel or a shared medium. The aim is
to share a scarce resource. This technique is applicable in telecommunications as well as computer
networks. For instance, in telecommunications, one cable is used for carrying different telephone
calls. In the year 1870, the multiplexing technique is invented first in telegraphy, and at present, it
is extensively used in communications. The scientist “George Owen Squier” was recognized the
growth of multiplexing in telephony in the year 1910. The signal which is multiplexed will be
transmitted over a cable or channel and separates the channel into numerous logic channels.

The multiplexing divides the capacity of the communication channel into several logical channels,
one for each message signal or data stream to be transferred.

A reverse process, known as demultiplexing, extracts the original channels on the receiver end.

Fig1 multiplexing

Muxing (or) multiplexing can be defined as; it is a way of transmitting various signals over a media
or single line. A common kind of multiplexing merges a number of low-speed signals to send over
an only high-speed link, or it is used to transmit a medium as well as its link with the number of
devices. It provides both privacy & Efficiency. The entire process can be done using a device

39
namely MUX or multiplexer, and the main function of this device is to unite n-input lines for
generating a single output line. Thus, MUX has many inputs and single output.

A device is called DEMUX or demultiplexer is used at the receiving end which divides the signal
into its component signals. So, it has single input and number of outputs

4.1 TYPES OF MULTIPLEXING


Digital bit streams can be transferred over an analog channel by means of code-division
multiplexing techniques such as frequency-hopping spread spectrum (FHSS) and direct-sequence
spread spectrum (DSSS).

4.1.1 Space division multiplexing


In wired communication, space-division multiplexing, also known as Space-division multiple
access is the use of separate point-to-point electrical conductors for each transmitted channel.

Examples, include an analogue stereo audio cable, with one pair of wires for the left channel and
another for the right channel, and a multi-pair telephone cable, a switched star network such as a
telephone access network, a switched Ethernet network, and a mesh network.

In wireless communication, space-division multiplexing is achieved with multiple antenna


elements forming a phased array antenna. Examples are multiple-input and multiple-output
(MIMO), single-input and multiple-output (SIMO) and multiple-input and single-output (MISO)
multiplexing. An IEEE 802.ng wireless router with k antennas makes it in principle possible to
communicate with k multiplexed channels, each with a peak bit rate of 54 Mbit/s, thus increasing
the total peak bit rate by the factor k. Different antennas would give different multi-path
propagation (echo) signatures, making it possible for digital signal processing techniques to
separate different signals from each other. These techniques may also be utilized for space
diversity (improved robustness to fading) or beamforming (improved selectivity) rather than
multiplexing.

4.1.2 Frequency division multiplexing


Frequency-division multiplexing (FDM) is inherently an analog technology. FDM achieves the
combining of several signals into one medium by sending signals in several distinct frequency
ranges over a single medium. In FDM the signals are electrical signals. One of the most common

40
applications for FDM is traditional radio and television broadcasting from terrestrial, mobile or
satellite stations, or cable television.

Only one cable reaches a customer's residential area, but the service provider can send multiple
television channels or signals simultaneously over that cable to all subscribers without
interference rceivers must tune to the appropriate frequency (channel) to access the desired
signal.

Fig2 frequency multiplexing

FDM is used for analog signal transmission. It does not need synchronization between the
transmitter and receiver. Here a large number of signals can be transmitted simultaneously. It
suffers the problem of cross talk, and intermodulation distortion may take place. FDM is used in
amplitude modulation (AM) and FM broadcasting, public telephone networks, and cable TV
network systems.

Advantage of FDM multiplexing

 A large number of signals (channels) can be transmitted simultaneously.


 Demodulation of FDM is easy.
 FDM does not need synchronization between its transmitter and receiver for
proper operation.
 Due to slow narrowband fading, only a single channel gets affected.

Disadvantages of FDM

 The communication channel must have a very large bandwidth.


 Intermodulation distortion takes place.
 A large number of modulators and filters are required.

41
 FDM suffers from the problem of cross talk.
 All the FDM channels get affected due to wideband fading.

4.1.3 Wave division multiplexing


In fiber communications, the WDM (Wavelength Division Multiplexing) is one type of
technology. This is the most useful concept in high-capacity communication systems. At the end
of the transmitter section, the multiplexer is used to combine the signals as well as at the end of
receiver section, de-multiplexer for dividing the signals separately. The main function of WDM at
the multiplexer is for uniting various light sources into an only light source, and this light can be
changed into numerous light sources at the de-multiplexer.

Fig3 wavelength division multiplexing

A variant technology, called wavelength-division multiplexing (WDM) is used in optical


communications.

Advantages of WDM

 In WDM full-duplex transmission is possible.


 It is easier to reconfigure.
 Optical components are more reliable and provide higher bandwidth.
 Provide high security and faster access to new channel.
 Low cost and easy system expansion.
 Simultaneous transmission of various signals.

Disadvantages of WDM

42
 Scalability is a concern as optical line termination (OLT); optical line termination has to
have transmitter array with one transmitter for each optical network unit (ONU). Adding
a new ONU could be a problem unless transmitters were provisioned in advance. Each
ONU must have a wavelength-specific laser.
 The cost of the system increases with addition of optical components.
 Inefficiency in BW utilization, difficulty in wavelength tuning, and difficulty in cascaded
topology.

4.1.4 Polarization division multiplexing


Polarization-division multiplexing uses the polarization of electromagnetic radiation to separate
orthogonal channels. It is in practical use in both radio and optical communications, particularly
in too Gbit/s per channel fiber optic transmission systems.

4.1.5 Code division multiplexing


Code division multiplexing (CDM), Code division multiple access (CDMA) or spread spectrum is
a class of techniques where several channels simultaneously share the same frequency spectrum,
and this spectral bandwidth is much higher than the bit rate or symbol rate. One form is frequency
hopping, another is direct sequence spread spectrum. In the latter case, each channel transmits its
bits as a coded channel-specific sequence of pulses called chips. Number of chips per bit, or chips
per symbol, is the spreading factor. This coded transmission typically is accomplished by
transmitting a unique time-dependent series of short pulses, which are placed within chip times
within the larger bit time. All channels, each with a different code, can be transmitted on the same
fiber or radio channel or other medium, and asynchronously demultiplexed. Advantages over
conventional techniques are that variable bandwidth is possible (just as in statistical multiplexing),
that the wide bandwidth allows poor signal-to-noise ratio according to Shannon-Hartley theorem,
and that multi-path propagation in wireless communication can be combated by rake receivers. A
significant application of CDMA is the Global Positioning System (GPS)

Advantage of CDM

 The CDM does not require any synchronization.


 In CDM a greater number of users can share the same bandwidth.
 It is scalable.
 It is well-matched with other cellular technologies.

43
 Interference is reduced because different code words are allocated to
each user.
 Efficient utilization of fixed frequency spectrum.

Disadvantages

 The system is more complicated.


 As the number of users increases, the overall quality of services decreases.
 More complex system and primarily it is used in wireless transmission

4.1.6 Time division multiplexing


Time-division multiplexing (TDM) is a digital (or in rare cases, analog) technology which uses
time, instead of space or frequency, to separate the different data streams. TDM involves
sequencing groups of a few bits or bytes from each individual input stream, one after the other,
and in such a way that they can be associated with the appropriate receiver. If done sufficiently
quickly, the receiving devices will not detect that some of the circuit time was used to serve another
logical communication path.

It is a digital technique. In Frequency Division Multiplexing Technique, all signals operate at the
same time with different frequency, but in case of Time Division Multiplexing technique, all
signals operate at the same frequency with different time. In Time Division Multiplexing
technique, the total time available in the channel is distributed among different users. Therefore,
each user is allocated with different time interval known as a Time slot at which data is to be
transmitted by the sender.

A user takes control of the channel for a fixed amount of time. In Time Division Multiplexing
technique, data is not transmitted simultaneously rather the data is transmitted one-by-one.
In TDM, the signal is transmitted in the form of frames. Frames contain a cycle of time
slots in which each frame contains one or more slots dedicated to each user.
It can be used to multiplex both digital and analog signals but mainly used to multiplex
digital signals.

There are two types of TDM:

 Synchronous TDM
 Asynchronous TDM
44
Synchronous TDM

A Synchronous TDM is a technique in which time slot is preassigned to every device. In


Synchronous TDM, each device is given some time slot irrespective of the fact that the device
contains the data or not.

If the device does not have any data, then the slot will remain empty. In Synchronous TDM, signals
are sent in the form of frames. Time slots are organized in the form of frames. If the device does
not have data for a particular time slot, then the empty slot will be transmitted.

The most popular Synchronous TDM are T-l multiplexing, ISDN multiplexing, and SONET
multiplexing. If there are n devices, then there are n slots.

The time slots are pre-assigned and fixed. This slot is even given if the source is not ready with
data at this time. In this case the slot is transmitted empty. It is used for multiplexing digitized
voice stream

Fig4 synchronous TDM

Disadvantages

 The channel capacity cannot be fully utilized when some source do not want to
send the data.
 The capacity of the transmission link must be higher than the total capacity of
input lines.
 It is very complex to implement.

Asynchronous TDM

45
An asynchronous TDM is also known as Statistical TDM. An asynchronous TDM is a technique
in which time slots are not fixed as in the case of Synchronous TDM. Time slots are allocated to
only those devices which have the data to send. Therefore, we can say that Asynchronous Time
Division multiplexor transmits only the data from active workstations. An asynchronous TDM
technique dynamically allocates the time slots to the devices. In Asynchronous TDM, total speed
of the input lines can be greater than the capacity of the channel.

Asynchronous Time Division multiplexor accepts the incoming data streams and creates
a frame that contains only data with no empty slots. In Asynchronous TDM, each slot contains an
address part that identifies the source of the data.

The difference between Asynchronous TDM and Synchronous TDM is that many slots in
Synchronous TDM are unutilized, but in Asynchronous TDM, slots are fully utilized. This
leads to the smaller transmission time and efficient utilization of the capacity of the
channel.
In Synchronous TDM, if there are n sending devices, then there are n time slots. In
Asynchronous TDM, if there are n sending devices, then there are m time slots where m
is less than n (men).

The number of slots in a frame depends on the statistical analysis of the number of
input lines. The slots are allocated dynamically depending on the speed of source or their ready
state. It dynamically allocates the time slots according to different input channel’s needs, thus
saving the channel capacity.

Fig5 asynchronous TDM

46
In the above diagram, there are 4 devices, but only two devices are sending the data, i.e., A
and C. Therefore, the data of A and C are only transmitted through the transmission line.

Disadvantages

 Frames have different sizes.


 An output slot in synchronous TDM is totally occupied by data, in statistical
TDM; a slot needs to carry data as well as the address of the destination.
 It requires buffer, and address information is needed as there is no separate
slots assigned for each user.

4.2 DEMULTIPLEXING
Demultiplexing (Demuxing) is a term relative to multiplexing. It is the reverse of the multiplexing
process. Demultiplex is a process reconverting a signal containing multiple analog or digital signal
streams back into the original separate and unrelated signals. Although demultiplexing is the
reverse of the multiplexing process, it is not the opposite of multiplexing. The opposite of
multiplexing is inverse multiplexing (iMuxing), which breaks one data stream into several related
data streams. Thus, the difference between demultiplexing and inverse multiplexing is that the
output streams of demultiplexing are unrelated, while the output streams of inverse multiplexing
are related.

In Communication System demultiplexer receives the output signals from the multiplexer and
converts them back to the original form at the receiver end. Multiplexing and demultiplexing are
the reverse process of each other and can be applied to many occasions. Demultiplexer (Demux)
is a device that performs the reverse process of multiplexer.

Matlab code of TDM

function [y]=TDM_nik(x)
% x contains all the signals to be multiplexed
% y is multiplexed signal
[r c]=size(x);

47
k=0;
% Multiplexing
for i=1:c
for j=1:r
k=k+1;
y(k)=x(j,i);
end
end
% Ploting
color='ybrgmkc';
figure(1)
sig='x1';
for i=1:r
sig(2)=i+48;
j=mod(i,7)+1;
subplot(r,1,i)
stem(x(i,:),color(j),'linewidth',2)
title(sig)
ylabel('Amplitude')
grid
end
xlabel('Time')
t=1/r:1/r:c;
figure(2)
for i=1:r
j=mod(i,7)+1;
stem(t(i:r:r*c),y(i:r:r*c),color(j),'linewidth',2)
hold on
grid
end
hold off

48
title('Time Division Multiplexed Sequence')
xlabel('Time')
ylabel('Amplitude')

Matlab code for FDM

% Design and simulation of Frequency Division Multiplexing in MATLAB


clc;
clear all
close all
samples=1000;

49
% number of users
nos=8;
% modulating signal frequency in Hz
mfreq=[30 40 50 60 70 80 90 100];
% carrier frequency allocated to the different users in Hz
cfreq=[300 600 900 12000 1500 1800 2100 2400];
% choose frequency deviation
freqdev=10;
% generate modulating signal
t=linspace(0,1000,samples);
parfor i=1:nos
m(i,:)=sin(2*pi*mfreq(1,i)*t)+2*sin(pi*8*t);
end
% Generate the modulated signal
parfor i=1:nos
y(i,:)=fmmod(m(i,:),cfreq(1,i),10*cfreq(1,i),freqdev);
end
% pass the modulated signal through the channel
ch_op=awgn(sum(y),0,'measured');
% demodulate the received signal at the base station
parfor i=1:nos
z(i,:)=fmdemod(y(i,:),cfreq(1,i),10*cfreq(1,i),freqdev);
end
% display the transmitted signal and received signal at the base station
% figure
C = {'k','b','r','g','y',[.5 .6 .7],[.8 .2 .6],[.3 .2 .2]}; % Cell array of colros.
for i=1:nos
figure (1)
hold on
plot(y(i,:),'color',C{i});

50
xlabel('time index'); ylabel('amplitude'); title('Signal from different users combined in the
channel');
figure
subplot(3,1,1)
plot(m(i,:)) % modulating signal
xlabel('time index'); ylabel('amplitude'); title('modulating Signal from user');
subplot(3,1,2)
plot(y(i,:),'color',C{i}); % modulated signal
xlabel('time index'); ylabel('amplitude'); title('modulated Signal from user');
subplot(3,1,3)
plot(z(i,:),'color',C{i}); % demodulated signal
xlabel('time index'); ylabel('amplitude'); title('demodulated Signal from user at the base
station');
end
figure
plot(ch_op) % combination of all modulated signals passed through the channel
xlabel('time index'); ylabel('amplitude'); title('Signal after passing through the channel');

51
52
CHAPTER FIVE
DIGITAL MODULATIONS
There are three basic types of modulation methods for transmission of digital signal. The methods
are based on three attributes of a sinusoidal signal, amplitude, frequency and phase. The
corresponding digital modulation methods are: amplitude shift keying (ASK), frequency shift
keying (FSK) and phase shift keying (PSK).

5.1 BPSK digital modulation and Demodulation:


BPSK modulator

Binary Phase Shift Keying (BPSK) is a type of digital modulation technique in which we are
sending one bit per symbol i.e., ‘0’ or a ‘1’. Hence, the bit rate and symbol rate are the same.
Depending upon the message bit, we can have a phase shift of 0o or 180o with respect to a reference
carrier.

For example, we can have the following transmitted band-pass symbols:

𝑠1 = √(2𝐸/𝑇)cos⁡(𝜔t) represents ‘1’ Where 𝜔 = 2𝜋𝑓

53
𝑠2 = √(2𝐸/𝑇)cos⁡(𝜔t+𝜋) represents ‘0’ or

𝑠1 = −√(2𝐸/𝑇)cos⁡(𝜔t) represents ‘0’

Where ‘E’ is the symbol energy, ‘T’ is the symbol time period; f is the frequency of the carrier,
Using gram Schmidt orthogonalization we get a single orthonormal basis function, given as:

𝜓1 = √(2/𝑇)cos⁡(⁡𝜔𝑡)

Figure 1. BPSK modulator

First the NRZ encoder converts these digital bits into impulses to add a notion of time into them.
Then NRZ waveform is generated by up-sampling these impulses. Afterwards, multiplication with
the carrier (orthonormal basis function) is carried out to generate the modulated BPSK waveform.

BPSK Demodulator

For BPSK demodulator, a coherent demodulator is taken as an example. In coherent detection


technique the knowledge of the carrier frequency and phase must be known to the receiver. This
can be achieved by using a Costas loop or a Phase Lock Loop (PLL) at the receiver. A PLL
essentially locks to the incoming carrier frequency and tracks the variations in frequency and
phase. For the following simulation, neither a PLL nor a Costas loop is used but instead the output
of the PLL or Costas loop is used. For demonstration purposes we simply assume that the carrier
phase recovery is done and directly use the generated reference frequency at the receiver cos(ωt).
In the demodulator the received signal is multiplied by a reference frequency generator (assuming
the PLL/Costas loop is present). The multiplied output is integrated over one bit period using an
integrator. A threshold detector makes a decision on each integrated bit based on a threshold. Since

54
an NRZ signaling format is used with equal amplitudes in positive and negative direction, the
threshold for this case would be ’0′.

Figure 2. BPSK Demodulator

Simulation of BPSK modulation and demodulation

The Matlab simulation code is given below. Here for the sake of simplicity, the bit rate is fixed to
1 bit/s (i.e., T=1 second). It is also assumed that Phased Locked Loop (PLL) has already achieved
exact phase synchronization.

55
56
BER vs. Eb/N0 for BPSK modulation over AWGN

For BPSK modulation the channel can be modeled as

𝑦 = 𝑎𝑥 + 𝑛

Where, y is the received signal at the input of the BPSK receiver, x is the modulated signal
transmitted through the channel, ‘a’ is the channel amplitude scaling factor for the transmitted
signal usually assumed as unity. ‘n’ is the Additive Gaussian White Noise random variable with
zero mean and variance δ2 .
For an AWGN channel, the noise variance in terms of noise power spectral density (No) is given
by
δ2 = No/2
For M-ARY modulation schemes like M-PSK including BPSK, the symbol energy is given by
E𝑠 = 𝑅𝑚. 𝑅𝑐. 𝐸𝑏
Where; E𝑠 = is symbol energy per modulated bit,
𝑅𝑚 = log 2 𝑀 (For BPSK M=2, QPSK M=4, 16 QAM M=16 etc..,)
𝑅𝑐 = is the code rate of the system if a coding scheme is used. 𝑅𝑐 = 1 Since no coding is used
𝑅𝑏 = is energy per information bit.
Assuming E𝑠 =1 for BPSK (Symbol energy normalized to 1) Eb/N0 can be represented as (using
above equations),

57
𝐸𝑏 E𝑠 E𝑠 1
= = 2
=
No 𝑅𝑚. 𝑅𝑐. No 𝑅𝑚. 𝑅𝑐. 2δ 2𝑅𝑚. 𝑅𝑐. δ2
From the above equation the noise variance for the given Eb/N0 can be calculated as
1
δ2 =
𝐸𝑏
2𝑅𝑚. 𝑅𝑐. No

For the channel model “randn” function in Matlab is used to generate the noise term. This function
generates noise with unit variance and zero mean. In order to generate a noise with sigma for the
given Eb/N0 ratio, use the above equation, find⁡δ, and multiply the “randn” generated noise with
this sigma, add this final noise term with the transmitted signal to get the received signal.
Simulation of BER vs. Eb/N0 for BPSK modulation over AWGN

5.2 QPSK Modulation and Demodulation


QPSK modulation

In Quadrature Phase Shift Keying (QPSK) two sinusoids (sin and cos functions) are taken as basis
functions for modulation. Modulation is achieved by varying the phase of the basis functions
depending on the message symbols. In QPSK, modulation is symbol based, where one symbol
contains 2 bits. The following equation outlines QPSK modulation technique.
2𝐸𝑠
S𝑖(t) = √( )cos⁡[𝜔𝑐𝑡 + (2𝑛 − 1)𝜋/4⁡] ; 𝑛 = 1,2,3,4
𝑇

This gives four possible phases: π/4, 3π/4, 5π/4, and 7π/4. The constellation diagram of QPSK will
show the constellation points lying on both x and y axes. This means that the QPSK modulated
signal will have an in-phase component (I) and also a quadrature component (Q).
A QPSK modulator can be implemented as follows. A de-multiplexer (or serial to parallel
converter) is used to separate odd and even bits from the generated information bits. Each of the
58
odd bits (quadrature arm) and even bits (in-phase arm) are converted to NRZ format in a parallel
manner. The signal on the in-phase arm is multiplied by cosine component and the signal on the
quadrature arm is multiplied by sine component. QPSK modulated signal is obtained by adding
the signal from both in phase and quadrature arm.

Figure 3. QPSK modulator

QPSK Demodulation:
For QPSK demodulator, a coherent demodulator is taken as an example. In coherent detection
technique, the knowledge of the carrier frequency and phase must be known to the receiver. This
can be achieved by using a PLL (phase lock loop) at the receiver. A PLL essentially locks to the
incoming carrier frequency and tracks the variations in frequency and phase. For the following
simulation, a PLL is not used but instead we simply assume that the receiver is in perfect
synchronization. For demonstration purposes we simply assume that the carrier phase recovery is
done and simply use the generated reference frequencies at the receiver (cos(2πfct) and
(sin(2πftc)).
In the demodulator the received signal is multiplied by a reference frequency generator
(cos(2πfCt)) and (sin(2πfCt)) on separate arms (in-phase and quadrature arms). The multiplied
output on each arm is integrated over one bit period using an integrator. A threshold detector makes
a decision on each integrated bit based on a threshold. Finally the bits on the in-phase arm (even

59
bits) and on the quadrature arm (odd bits) are remapped to form the detected information stream.

Figure 4. QPSK demodulator

Simulation of QPSK modulation and demodulation

60
BER vs. Eb/N0 for QPSK modulation over AWGN
For BPSK modulation the channel can be modeled as

𝑦 = 𝑎𝑥 + 𝑛

Where, y is the received signal at the input of the QPSK receiver, x is the modulated signal
transmitted through the channel, ‘a’ is the channel amplitude scaling factor for the transmitted
signal usually assumed as unity. ‘n’ is the Additive Gaussian White Noise random variable with
zero mean and variance δ2 .

61
For an AWGN channel, the noise variance in terms of noise power spectral density (No) is given
by
δ2 = No/2
For M-ARY modulation schemes like M-PSK including QPSK, the symbol energy is given by
E𝑠 = 𝑅𝑚. 𝑅𝑐. 𝐸𝑏
Where; E𝑠 = is symbol energy per modulated bit,
𝑅𝑚 = log 2 𝑀 (For BPSK M=2, QPSK M=4, 16 QAM M=16 etc..,)
𝑅𝑐 = is the code rate of the system if a coding scheme is used. 𝑅𝑐 = 1 Since no coding is used
𝑅𝑏 = is energy per information bit.
Assuming E𝑠 =1 for QPSK (Symbol energy normalized to 1) Eb/N0 can be represented as (using
above equations),
𝐸𝑏 E𝑠 E𝑠 1
= = 2
=
No 𝑅𝑚. 𝑅𝑐. No 𝑅𝑚. 𝑅𝑐. 2δ 2𝑅𝑚. 𝑅𝑐. δ2
From the above equation the noise variance for the given Eb/N0 can be calculated as
1
δ2 =
𝐸𝑏
2𝑅𝑚. 𝑅𝑐. No

For the channel model “randn” function in Matlab is used to generate the noise term. This function
generates noise with unit variance and zero mean. In order to generate a noise with standard
deviation - σ for the given Eb/N0 ratio, use the above equation, find σ, multiply the “randn”
generated noise with this σ, add this final noise term with the transmitted signal to get the received
signal. For a /4 rotated QPSK system, since the modulated signal is in complex form (due to sine
and cosine basis functions), the noise should also be in complex form.

Simulation of BER vs. Eb/N0 for QPSK modulation over AWGN

62
Symbol Error Rate vs. SNR performance curve simulation for QPSK
5.3 M-QAM Modulation
In M-ASK modulation the information symbols (each k=log2 (M) bit wide) are encoded into the
amplitude of the sinusoidal carrier. In M-PSK modulation the information is encoded into the
phase of the sinusoidal carrier. M-QAM is a generic modulation technique where the information
is encoded in both the amplitude and phase of the sinusoidal carrier. It combines both M-ASK and
M-PSK modulation techniques.
M-QAM modulation technique is a two dimensional modulation technique and it requires two
orthonormal basis functions.
𝜓1(𝑡) = √(2/𝑇𝑠)⁡cos⁡(2𝜋𝑓𝑐𝑡) , 0≤t≤Ts

𝜓2(𝑡) = √(2/𝑇𝑠)⁡sin⁡(2𝜋𝑓𝑐𝑡) , 0≤t≤Ts


The M-QAM modulated signal is represented as
𝑆𝑖(𝑡) = 𝑉𝐼, 𝑖√(2/𝑇𝑠)⁡cos⁡(2𝜋𝑓𝑐𝑡) + 𝑉𝑄, 𝑖√(2/𝑇𝑠)⁡sin⁡(2𝜋𝑓𝑐𝑡) , 0≤t≤Ts i=1, 2,…, M
Here VI,i and VQ,i are the amplitudes of the quadrature carriers amplitude modulated by the
information symbols.
Baseband Rectangular M-QAM modulator
There exist other constellation shapes that are more efficient (in terms of energy required to
achieve same error probability) than the standard rectangular constellation. But due to its
simplicity in modulation and demodulation rectangular constellations are preferred for
implementation.
In practice, the information symbols are gray coded in-order to restrict the erroneous symbol

63
decisions to single bit error, i.e., the adjacent symbols in the transmitter constellation should not
differ more than one bit. Usually the gray coded symbols are separated into in-phase and
quadrature bits and then mapped to M-QAM constellation. The rectangular configuration of QAM
makes it easier to consolidate the previously mentioned steps into a simplified Look-Up-Table
(LUT) approach.
16-QAM Modulation Scaling Factor
In order to get a fair comparison across all other modulations, the energy transmitted signal has to
be normalized. In general, the constellation points for M-QAM modulation can be generated as
𝑀𝑄𝐴𝑀 = 𝑎 + 𝑗𝑏 , where 𝑎, 𝑏 ∈ {±1, ±, … , ±[√𝑀] − 1}
The energy of a single constellation point is calculated as 𝐸 = V 2 𝐼, 𝑖 + V 2 𝑄, 𝑖 where VI,i and VQ,i
are I and Q components of the signaling point respectively. For a set of n constellation points, the
total energy is calculated as
n

𝐸 = ∑ V 2 𝐼, 𝑖 + V 2 𝑄, 𝑖
𝑖=1

In 16-QAM, there are 16 signal points in the constellation that are equally divided into four
quadrants (each with four constellation points). Since the constellation is divided equally into four
quadrants, normalizing the energy in a single quadrant will simplify things.
Calculating the total energy in any one of the quadrants
𝐸 = (12 + 12 ) + (12 + 32 ) + (32 + 12 ) + (32 + 32 ) = 40
The average energy is Eavg=E/4=40/4=10 and the normalization factor will be
1 1
𝑁𝑜𝑟𝑚⁡𝑓𝑎𝑐𝑡𝑜𝑟 = =
√𝐸𝑎𝑣𝑔 √10
The values in the LUT (where the reference constellation is stored) are normalized by the above
mentioned normalization factor and then the 16-QAM signal is generated.

64
Figure 5. Block diagram of M-QAM

The simulation model for M-QAM modulation is given in the next figure. The receiver uses
Euclidean distance as a metric to decide on the received symbols.

Figure 6. Simulation model of M-QAM

2
𝐸𝑢𝑐𝑙𝑖𝑑𝑒𝑎𝑛⁡𝑑𝑖𝑠𝑡𝑎𝑛𝑐𝑒𝑠 = √(𝑟𝐼 − 𝐼𝑟𝑒𝑓𝐼 )2 + (𝑟𝑄 − 𝑄𝑟𝑒𝑓𝑄 )

Theoretical Symbol Error Rate:


The theoretical symbol error rate for M-QAM modulation technique in AWGN when
k = log 2 𝑀⁡is even, is given by

1 3𝑘𝐸𝑏
𝑝𝑠 ≤ 1 − [1 − 2 (1 − ) . 𝑄 (√ )]2
√𝑀 (𝑀 − 1)𝑁𝑜

65
5.4 Frequency shift key (FSK) modulation and demodulation
Frequency Shift Keying is analogous to Frequency Modulation (FM) in analog domain, where the
slope of the time varying angle of the signal, i.e., instantaneous frequency of the carrier signal
varies with respect to the baseband signal. In unipolar or bipolar formatting of the digital symbol,
there exist two amplitude levels defined for two logic values one and zero.

66
Therefore, two sinusoidal carrier waves of the same amplitude Ac but different frequencies fH and
fL are used to represent the two symbols.
Table 1. FSK waveform definition
Data to be transmitted [d(t)] FSK
Binary 1 𝐴𝐶 𝑐𝑜𝑠𝜔𝐻 𝑡
Binary 0 𝐴𝐶 𝑐𝑜𝑠𝜔𝐿 𝑡

Mathematically,
𝜓(𝑡) = 𝐴𝐶 𝑐𝑜𝑠𝜔𝐻 𝑡 If d(t)=logic 1
𝜓(𝑡) = 𝐴𝐶 𝑐𝑜𝑠𝜔𝐻 𝑡 If d(t)=logic 0
BFSK Modulator
From the mathematical model of binary FSK (BFSK), it’s clear that, BFSK can be generated using
two ASK modulators with inverted baseband and two carriers with frequencies fH and fL
Two ASK signals must have the same bandwidth in order to generate a proper binary FSK signal.

Figure 7. BFSK modulator


BFSK Demodulator
FSK signal can be detected using both coherent and non-coherent arrangements. As the binary
FSK signal is generated using two carrier frequencies, the coherent detector consists of two
correlators that are individually turned to two different carrier frequencies to represent symbol 1
and 0. A correlator is the combination of a multiplier followed by an integrator (LPF). The same
BFSK signal is multiplied by two different carrier signals and the passed separately through the
LPF.
The outputs of the LPF must be inverted type, i.e., if one is upper going, the other must be

67
lower going. Next, the outputs are fed to the decision deice which is essentially a comparator. If
the output produced in the upper path is more than the output produced in the lower path, the
magnitude comparator will decide in favor of symbol 1. Similarly, if the output of the upper path
is less than that of the lower path, the comparator will decide in favor of symbol 0.

Figure 8. BFSK demodulator


Simulation of FSK modulation and demodulation

Performance comparison of Digital Modulation techniques

68
Let’s take up some bandwidth-efficient linear digital modulation techniques (BPSK, QPSK and
QAM) and compare its performance based on their theoretical BER over AWGN.

69
Matlab code

A) BPSK modulation and demodulation


clear all;
close all;
%Nb is the number of bits to be transmitted
T=1;%Bit rate is assumed to be 1 bit/s;
%bits to be transmitted
b=[1 0 1 0 1]
%Rb is the bit rate in bits/second
NRZ_out=[];
%Vp is the peak voltage +v of the NRZ waveform
Vp=1;
%Here we encode input bitstream as Bipolar NRZ-L waveform
for index=1:size(b,2)
if b(index)==1
NRZ_out=[NRZ_out ones(1,200)*Vp];
elseif b(index)==0
NRZ_out=[NRZ_out ones(1,200)*(-Vp)];
end
end

%Generated bit stream impulses


figure(1);
stem(b);
xlabel('Time (seconds)-->')
ylabel('Amplitude (volts)-->')
title('Impulses of bits to be transmitted');
figure(2);
plot(NRZ_out);
xlabel('Time (seconds)-->');
ylabel('Amplitude (volts)-->');

70
title('Generated NRZ signal');
t=0.005:0.005:5;
%Frequency of the carrier
f=5;
%Here we generate the modulated signal by multiplying it with
%carrier (basis function)
Modulated=NRZ_out.*(sqrt(2/T)*cos(2*pi*f*t));
figure;
plot(Modulated);
xlabel('Time (seconds)-->');
ylabel('Amplitude (volts)-->');
title('BPSK Modulated signal');
y=[];
%We begin demodulation by multiplying the received signal again with
%the carrier (basis function)
demodulated=Modulated.*(sqrt(2/T)*cos(2*pi*f*t));
%Here we perform the integration over time period T using trapz
%Integrator is an important part of correlator receiver used here
for i=1:200:size(demodulated,2)
y=[y trapz(t(i:i+199),demodulated(i:i+199))];
end
received=y>0;
figure;
stem(received)
title('Impulses of Received bits');
xlabel('Time (seconds)-->');
ylabel('Amplitude (volts)')
B) BER vs. Eb/N0 for BPSK modulation over AWGN
% Demonstration of Eb/N0 Vs BER for BPSK modulation scheme
clear;
clc;

71
%---------Input Fields------------------------
N=10000000; %Number of input bits
EbN0dB = -6:2:10; % Eb/N0 range in dB for simulation
%---------------------------------------------
data=randn(1,N)>=0; %Generating a uniformly distributed random 1s and 0s
bpskModulated = 2*data-1; %Mapping 0->-1 and 1->1
M=2; %Number of Constellation points M=2^k for BPSK k=1
Rm=log2(M); %Rm=log2(M) for BPSK M=2
Rc=1; %Rc = code rate for a coded system. Since no coding is used Rc=1
BER = zeros(1,length(EbN0dB)); %Place holder for BER values for each Eb/N0
index=1;
for k=EbN0dB,
%-------------------------------------------
%Channel Noise for various Eb/N0
%-------------------------------------------
%Adding noise with variance according to the required Eb/N0
EbN0 = 10.^(k/10); %Converting Eb/N0 dB value to linear scale
noiseSigma = sqrt(1./(2*Rm*Rc*EbN0)); %Standard deviation for AWGN Noise
noise = noiseSigma*randn(1,length(bpskModulated));
received = bpskModulated + noise;
%-------------------------------------------
%Threshold Detector
estimatedBits=(received>=0);
%------------------------------------------
%Bit Error rate Calculation
BER(index) = sum(xor(data,estimatedBits))/length(data);
index=index+1;
end
%Plot commands follows
plotHandle=plot(EbN0dB,log10(BER),'r--');
set(plotHandle,'LineWidth',1.5);

72
title('SNR per bit (Eb/N0) Vs BER Curve for BPSK Modulation Scheme');
xlabel('SNR per bit (Eb/N0) in dB');
ylabel('Bit Error Rate (BER) in dB');
grid on;
hold on;
theoreticalBER = 0.5*erfc(sqrt(10.^(EbN0dB/10)));
plotHandle=plot(EbN0dB,log10(theoreticalBER),'k*');
set(plotHandle,'LineWidth',1.5);
legend('Simulated','Theoretical');
grid on;
C) QPSK Modulation and Demodulation

% QPSK Modulation and Demodulation without consideration of noise


clc;
clear all;
close all;
data=[0 1 0 1 1 1 0 0 1 1]; % information
%Number_of_bit=1024;
%data=randint(Number_of_bit,1);
figure(1)
stem(data, 'linewidth',3), grid on;
title(' Information before Transmitting ');
axis([ 0 11 0 1.5]);
data_NZR=2*data-1; % Data Represented at NZR form for QPSK modulation
s_p_data=reshape(data_NZR,2,length(data)/2); % S/P convertion of data
br=10.^6; %Let us transmission bit rate 1000000
f=br; % minimum carrier frequency
T=1/br; % bit duration
t=T/99:T/99:T; % Time vector for one bit information
% QPSK modulation
y=[];

73
y_in=[];
y_qd=[];
for(i=1:length(data)/2)
y1=s_p_data(1,i)*cos(2*pi*f*t); % inphase component
y2=s_p_data(2,i)*sin(2*pi*f*t) ;% Quadrature component
y_in=[y_in y1]; % inphase signal vector
y_qd=[y_qd y2]; %quadrature signal vector
y=[y y1+y2]; % modulated signal vector
end
Tx_sig=y; % transmitting signal after modulation
tt=T/99:T/99:(T*length(data))/2;
figure(2)
subplot(3,1,1);
plot(tt,y_in,'linewidth',3), grid on;
title(' wave form for inphase component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,2);
plot(tt,y_qd,'linewidth',3), grid on;
title(' wave form for Quadrature component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,3);
plot(tt,Tx_sig,'r','linewidth',3), grid on;
title('QPSK modulated signal (sum of inphase and Quadrature phase signal)');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
% QPSK demodulation
Rx_data=[];
Rx_sig=Tx_sig; % Received signal
for(i=1:1:length(data)/2)

74
%% inphase coherent dector
Z_in=Rx_sig((i-1)*length(t)+1:i*length(t)).*cos(2*pi*f*t);
% above line indicat multiplication of received & inphase carred signal
Z_in_intg=(trapz(t,Z_in))*(2/T);% integration using trapizodial rull
if(Z_in_intg>0) % Decession Maker
Rx_in_data=1;
else
Rx_in_data=0;
end
%% Quadrature coherent dector
Z_qd=Rx_sig((i-1)*length(t)+1:i*length(t)).*sin(2*pi*f*t);
%above line indicat multiplication ofreceived & Quadphase carred signal
Z_qd_intg=(trapz(t,Z_qd))*(2/T);%integration using trapizodial rull
if (Z_qd_intg>0)% Decession Maker
Rx_qd_data=1;
else
Rx_qd_data=0;
end
Rx_data=[Rx_data Rx_in_data Rx_qd_data]; % Received Data vector
end
figure(3)
stem(Rx_data,'linewidth',3)
title('Information after Receiving ');
axis([ 0 11 0 1.5]), grid on;

D) BER vs. Eb/N0 for QPSK modulation over AWGN


% Demonstration of Eb/N0 Vs BER for BPSK modulation scheme
clear;
clc;
%---------Input Fields------------------------
N=10000000; %Number of input bits

75
EbN0dB = -6:2:10; % Eb/N0 range in dB for simulation
%---------------------------------------------
data=randn(1,N)>=0; %Generating a uniformly distributed random 1s and 0s
bpskModulated = 2*data-1; %Mapping 0->-1 and 1->1
M=2; %Number of Constellation points M=2^k for BPSK k=1
Rm=log2(M); %Rm=log2(M) for BPSK M=2
Rc=1; %Rc = code rate for a coded system. Since no coding is used Rc=1
BER = zeros(1,length(EbN0dB)); %Place holder for BER values for each Eb/N0
index=1;
for k=EbN0dB,
%-------------------------------------------
%Channel Noise for various Eb/N0
%-------------------------------------------
%Adding noise with variance according to the required Eb/N0
EbN0 = 10.^(k/10); %Converting Eb/N0 dB value to linear scale
noiseSigma = sqrt(1./(2*Rm*Rc*EbN0)); %Standard deviation for AWGN Noise
noise = noiseSigma*randn(1,length(bpskModulated));
received = bpskModulated + noise;
%-------------------------------------------
%Threshold Detector
estimatedBits=(received>=0);
%------------------------------------------
%Bit Error rate Calculation
BER(index) = sum(xor(data,estimatedBits))/length(data);
index=index+1;
end
%Plot commands follows
plotHandle=plot(EbN0dB,log10(BER),'r--');
set(plotHandle,'LineWidth',1.5);
title('SNR per bit (Eb/N0) Vs BER Curve for BPSK Modulation Scheme');
xlabel('SNR per bit (Eb/N0) in dB');

76
ylabel('Bit Error Rate (BER) in dB');
grid on;
hold on;
theoreticalBER = 0.5*erfc(sqrt(10.^(EbN0dB/10)));
plotHandle=plot(EbN0dB,log10(theoreticalBER),'k*');
set(plotHandle,'LineWidth',1.5);
legend('Simulated','Theoretical');
grid on;
E) Symbol Error Rate vs. SNR performance curve simulation for 16-QAM
% Demonstration of Eb/N0 Vs SER for M-QAM modulation scheme
clear;clc;
%---------Input Fields------------------------
N=10000; %Number of input symbols
EbN0dB = -6:2:12; %Define EbN0dB range for simulation
M=16; %for 16-QAM modulation.
%---------------------------------------------
refArray =1/sqrt(10)*[-3-3j,-3-1j,-3+3j,-3+1j,-1-3j,-1-1j,-1+3j,-1+1j,3-3j,3-1j,3+3j,3+1j,1-3j,1-
1j,1+3j,1+1j];
symErrSimulated = zeros(1,length(EbN0dB));
k=log2(M);
EsN0dB = EbN0dB + 10*log10(k);
%---Generating a uniformly distributed random numbers in the set [0,1,2,..,M-1]
data=ceil(M.*rand(N,1))-1;
s=refArray(data+1); %16-QAM Constellation mapping with Gray coding
%--- Reference Constellation for demodulation and Error rate computation--
refI = real(refArray);
refQ = imag(refArray);
%---Place holder for Symbol Error values for each Es/N0 for particular M value--
index=1;
figure(1);
subplot(1,2,1);

77
plot(real(s),imag(s),'r*');
title('Constellation diagram for Transmitted Symbols');
xlabel('Inphase component');
ylabel('Quadrature component');
subplot(1,2,2);
for x=EsN0dB,
%-------------------------------------------
%Channel Noise for various Es/N0
%-------------------------------------------
%Adding noise with variance according to the required Es/N0
noiseVariance = 1/(10.^(x/10));%Standard deviation for AWGN Noise
noiseSigma = sqrt(noiseVariance/2);
%Creating a complex noise for adding with M-QAM modulated signal
%Noise is complex since M-QAM is in complex representation
noise = noiseSigma*(randn(size(s))+1i*randn(size(s)));
received = s + noise;
%-------------I-Q Branching---------------
r_i = real(received);
r_q = imag(received);
%---Decision Maker-Compute (r_i-s_i)^2+(r_q-s_q)^2 and choose the smallest
r_i_repmat = repmat(r_i,M,1);
r_q_repmat = repmat(r_q,M,1);
plot(r_i,r_q,'*');
title(['Constellation diagram for Received Symbols Eb/N0=' num2str(x-10*log10(k)) 'dB']);
xlabel('Inphase component');
ylabel('Quadrature component');
pause;
distance = zeros(M,N); %place holder for distance metric
minDistIndex=zeros(N,1);
for j=1:N
%---Distance computation - (r_i-s_i)^2+(r_q-s_q)^2 --------------

78
distance(:,j) = (r_i_repmat(:,j)-refI').^2+(r_q_repmat(:,j)-refQ').^2;
%---capture the index in the array where the minimum distance occurs
[dummy,minDistIndex(j)]=min(distance(:,j));
end
y = minDistIndex - 1;%The index becomes the decoded symbol
%--------------Symbol Error Rate Calculation-------------------------------
dataCap = y;
symErrSimulated(1,index) = sum(dataCap~=data)/N;
index=index+1;
end
%----- Compute Theoretical Symbol Error Rates ---------------------
%EsN0lin = 10.^(EsN0dB/10);
EbN0lin = 10.^(EbN0dB/10);
symErrTheory = 2*(1-1/sqrt(M))*erfc(sqrt(3/2*k*EbN0lin/(M-1)));
%---------------Plotting commands-----------------------
figure(2);
semilogy(EbN0dB,symErrTheory,'r-');hold on;
semilogy(EbN0dB,symErrSimulated,'b*');
legend('16QAM-Theory','16QAM-Simulated');
xlabel('Eb/N0(dB)');
ylabel('Symbol Error Rate (Ps)');
grid on;
F) FSK Modulation and demodulation
%>>>>>>>>> MATLAB code for binary FSK modulation and de-modulation >>>>>>>%
clc;
clear all;
close all;
x=[ 1 0 0 1 1 0 1]; % Binary Information
bp=.000001; % bit period
disp(' Binary information at Trans mitter :');
disp(x);

79
% representation of transmitting binary information as digital signal
bit=[];
for n=1:1:length(x)
if x(n)==1;
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t1=bp/100:bp/100:100*length(x)*(bp/100);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(v)');
xlabel(' time(sec)');
title('transmitting information as digital signal');
%Binary-FSK modulation %
A=5; % Amplitude of carrier signal
br=1/bp; % bit rate
f1=br*8; % carrier frequency for information as 1
f2=br*2; % carrier frequency for information as 0
t2=bp/99:bp/99:bp;
ss=length(t2);
m=[];
for (i=1:1:length(x))
if (x(i)==1)
y=A*cos(2*pi*f1*t2);
else
y=A*cos(2*pi*f2*t2);
end

80
m=[m y];
end
t3=bp/99:bp/99:bp*length(x);
subplot(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(v)');
title('waveform for binary FSK modulation coresponding binary information');
% Binary FSK demodulation
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y1=cos(2*pi*f1*t); % carrier siignal for information 1
y2=cos(2*pi*f2*t); % carrier siignal for information 0
mm=y1.*m((n-(ss-1)):n);
mmm=y2.*m((n-(ss-1)):n);
t4=bp/99:bp/99:bp;
z1=trapz(t4,mm) % intregation
z2=trapz(t4,mmm) % intregation
zz1=round(2*z1/bp)
zz2= round(2*z2/bp)
if(zz1>A/2) % logic lavel= (0+A)/2 or (A+0)/2 or 2.5 ( in this case)
a=1;
else(zz2>A/2)
a=0;
end
mn=[mn a];
end
disp(' Binary information at Reciver :');
disp(mn);
% Representation of binary information as digital signal which achived

81
%after demodulation
bit=[];
for n=1:length(mn);
if mn(n)==1;
se=ones(1,100);
else mn(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('amplitude(v)');
xlabel(' time(sec)');
title('recived information as digital signal after binary FSK demodulation');

ASK
%>>>>>>>>> MATLAB code for binary ASK modulation and de-modulation >>>>>>>%
clc;
clear all;
close all;
x=[ 1 0 0 1 1 0 1]; % Binary Information
bp=.000001; % bit period
disp(' Binary information at Trans mitter :');
disp(x);
%XX representation of transmitting binary information as digital signal XXX
bit=[];
for n=1:1:length(x)
if x(n)==1;

82
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t1=bp/100:bp/100:100*length(x)*(bp/100);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('transmitting information as digital signal');
%XXXXXXXXXXXXXXXXXXXXXXX Binary-ASK modulation
XXXXXXXXXXXXXXXXXXXXXXXXXXX%
A1=10; % Amplitude of carrier signal for information 1
A2=5; % Amplitude of carrier signal for information 0
br=1/bp; % bit rate
f=br*10; % carrier frequency
t2=bp/99:bp/99:bp;
ss=length(t2);
m=[];
for (i=1:1:length(x))
if (x(i)==1)
y=A1*cos(2*pi*f*t2);
else
y=A2*cos(2*pi*f*t2);
end
m=[m y];
end
t3=bp/99:bp/99:bp*length(x);

83
subplot(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('waveform for binary ASK modulation coresponding binary information');
%XXXXXXXXXXXXXXXXXXXX Binary ASK demodulation
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y=cos(2*pi*f*t); % carrier siignal
mm=y.*m((n-(ss-1)):n);
t4=bp/99:bp/99:bp;
z=trapz(t4,mm) % intregation
zz=round((2*z/bp))
if(zz>7.5) % logic level = (A1+A2)/2=7.5
a=1;
else
a=0;
end
mn=[mn a];
end
disp(' Binary information at Reciver :');
disp(mn);
%XXXXX Representation of binary information as digital signal which achived
%after ASK demodulation
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bit=[];
for n=1:length(mn);
if mn(n)==1;
se=ones(1,100);

84
else mn(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('recived information as digital signal after binary ASK demodulation');
%>>>>>>>>>>>>>>>>>>>>>>>>>> end of program
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>%
%>>>>>>>>> MATLAB code for binary FSK modulation and de-modulation >>>>>>>%
clc;
clear all;
close all;
x=[ 1 0 0 1 1 0 1]; % Binary Information
bp=.000001; % bit period
disp(' Binary information at Trans mitter :');
disp(x);
%XX representation of transmitting binary information as digital signal XXX
bit=[];
for n=1:1:length(x)
if x(n)==1;
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
bit=[bit se];

85
end
t1=bp/100:bp/100:100*length(x)*(bp/100);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('transmitting information as digital signal');
%XXXXXXXXXXXXXXXXXXXXXXX Binary-FSK modulation
XXXXXXXXXXXXXXXXXXXXXXXXXXX%
A=5; % Amplitude of carrier signal
br=1/bp; % bit rate
f1=br*8; % carrier frequency for information as 1
f2=br*2; % carrier frequency for information as 0
t2=bp/99:bp/99:bp;
ss=length(t2);
m=[];
for (i=1:1:length(x))
if (x(i)==1)
y=A*cos(2*pi*f1*t2);
else
y=A*cos(2*pi*f2*t2);
end
m=[m y];
end
t3=bp/99:bp/99:bp*length(x);
subplot(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('waveform for binary FSK modulation coresponding binary information');

86
%XXXXXXXXXXXXXXXXXXXX Binary FSK demodulation
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y1=cos(2*pi*f1*t); % carrier siignal for information 1
y2=cos(2*pi*f2*t); % carrier siignal for information 0
mm=y1.*m((n-(ss-1)):n);
mmm=y2.*m((n-(ss-1)):n);
t4=bp/99:bp/99:bp;
z1=trapz(t4,mm) % intregation
z2=trapz(t4,mmm) % intregation
zz1=round(2*z1/bp)
zz2= round(2*z2/bp)
if(zz1>A/2) % logic lavel= (0+A)/2 or (A+0)/2 or 2.5 ( in this case)
a=1;
else(zz2>A/2)
a=0;
end
mn=[mn a];
end
disp(' Binary information at Reciver :');
disp(mn);
%XXXXX Representation of binary information as digital signal which achived
%after demodulation
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X
bit=[];
for n=1:length(mn);
if mn(n)==1;
se=ones(1,100);

87
else mn(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('recived information as digital signal after binary FSK demodulation');

ASK
%>>>>>>>>> MATLAB code for binary ASK modulation and de-modulation >>>>>>>%
clc;
clear all;
close all;
x=[ 1 0 0 1 1 0 1]; % Binary Information
bp=.000001; % bit period
disp(' Binary information at Trans mitter :');
disp(x);
%XX representation of transmitting binary information as digital signal XXX
bit=[];
for n=1:1:length(x)
if x(n)==1;
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
bit=[bit se];

88
end
t1=bp/100:bp/100:100*length(x)*(bp/100);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('transmitting information as digital signal');
% Binary-ASK modulation %
A1=10; % Amplitude of carrier signal for information 1
A2=5; % Amplitude of carrier signal for information 0
br=1/bp; % bit rate
f=br*10; % carrier frequency
t2=bp/99:bp/99:bp;
ss=length(t2);
m=[];
for (i=1:1:length(x))
if (x(i)==1)
y=A1*cos(2*pi*f*t2);
else
y=A2*cos(2*pi*f*t2);
end
m=[m y];
end
t3=bp/99:bp/99:bp*length(x);
subplot(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('waveform for binary ASK modulation coresponding binary information');
% Binary ASK demodulation

89
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y=cos(2*pi*f*t); % carrier siignal
mm=y.*m((n-(ss-1)):n);
t4=bp/99:bp/99:bp;
z=trapz(t4,mm) % intregation
zz=round((2*z/bp))
if(zz>7.5) % logic level = (A1+A2)/2=7.5
a=1;
else
a=0;
end
mn=[mn a];
end
disp(' Binary information at Reciver :');
disp(mn);
% Representation of binary information as digital signal which achived
%after ASK demodulation
bit=[];
for n=1:length(mn);
if mn(n)==1;
se=ones(1,100);
else mn(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;

90
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('recived information as digital signal after binary ASK demodulation');

G) Performance comparison of Digital Modulation techniques


EbN0dB=-4:1:24;
EbN0lin=10.^(EbN0dB/10);
colors={'b-*','g-o','r-h','c-s','m-d','y-*','k-p','b-->','g:<','r-.d'};
index=1;
%BPSK
BPSK = 0.5*erfc(sqrt(EbN0lin));
plotHandle=plot(EbN0dB,log10(BPSK),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
hold on;
index=index+1;
%M-PSK
m=2:1:5;
M=2.^m;
for i=M,
k=log2(i);
berErr = 1/k*erfc(sqrt(EbN0lin*k)*sin(pi/i));
plotHandle=plot(EbN0dB,log10(berErr),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
index=index+1;
end
%Binary DPSK
Pb = 0.5*exp(-EbN0lin);
plotHandle = plot(EbN0dB,log10(Pb),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
index=index+1;

91
%Differential QPSK
a=sqrt(2*EbN0lin*(1-sqrt(1/2)));
b=sqrt(2*EbN0lin*(1+sqrt(1/2)));
Pb = marcumq(a,b,1)-1/2.*besseli(0,a.*b).*exp(-1/2*(a.^2+b.^2));
plotHandle = plot(EbN0dB,log10(Pb),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
index=index+1;
%M-QAM
m=2:2:6;
M=2.^m;
for i=M,
k=log2(i);
berErr = 2/k*(1-1/sqrt(i))*erfc(sqrt(3*EbN0lin*k/(2*(i-1))));
plotHandle=plot(EbN0dB,log10(berErr),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
index=index+1;
end
legend('BPSK','QPSK','8-PSK','16-PSK','32-PSK','D-BPSK','D-QPSK','4-QAM','16-QAM','64-
QAM');
axis([-4 24 -8 0]);
set(gca,'XTick',-4:2:24); %re-name axis accordingly
ylabel('Probability of BER Error - log10(Pb)');
xlabel('Eb/N0 (dB)');
title('Probability of BER Error log10(Pb) Vs Eb/N0');
grid on;

92
CHAPTER SIX
FREQUENCY-HOPPED SPREAD-SPECTRUM
In this chapter we discuss frequency-hopped spread-spectrum. Frequency-hopped spread-
spectrum works by pseudorandomly changing the center frequency of the carrier over a set of
frequencies. The sequence of frequencies used is called the frequency hopping pattern. Frequency
hopping communication system is a typical spectrum communication system, it is in military
communication, mobile communication, computer wireless data transmission and wireless LAN
and other fields have a very wide range of applications, has become the current short wave
communication is one of the important development directions.

Spread spectrum communication has very strong anti-interference ability and security, first
appeared in the military field. In recent years, spread spectrum communication is also widely used
in the field of civil. There are two ways of Spread Spectrum Communication System those are:

93
1) Direct sequence spread spectrum(DSSS)
2) Frequency hopping spread spectrum (FHSS).

The Working Principle and Characteristics of Spread Spectrum Communication

In the information theory, the channel capacity formula which is this is the Shannon’s capacity
formula. C is the channel capacity (limit speed data transmission) W is the signal bandwidth and
SNR is the signal to noise ratio.

𝐶 = 𝑊 log 2 (1 + 𝑆𝑁𝑅)

The formula shows that the signal to noise ratio and the signal bandwidth can be the same as the
transmission rate can be changed. We can improve the signal bandwidth to reduce the signal to
noise ratio requirements, thus enhancing the ability to resist interference. By expanding the
signal bandwidth, the ability to resist interference is also improved. As mentioned above, spread
spectrum communication through the expansion of signal bandwidth, in exchange for a strong anti-
interference ability, which is the biggest characteristic of the spread spectrum communication.

One of the important parameters of spread spectrum communication is spread spectrum gain,
which reflects the system's ability to resist interference. It is a measure to improve the SNR.

𝑆𝑁𝑅𝑜𝑢𝑡 𝑅𝑆 𝐵𝑠
𝐺 =⁡ ⁡ = ⁡ ⁡ = ⁡⁡
𝑆𝑁𝑅𝑖𝑛 𝑅𝑑 𝐵𝑑

Where, Rs is transmission rate of spread spectrum code

Rd is transmission rate of information data.

Bs is the bandwidth of spread spectrum code

Bd is the bandwidth of information data.

Frequency Hopping Communication System

Frequency hopping is to control the frequency synthesizer by using the pseudo code sequence to
form the frequency synthesizer. The transmitted information code and the pseudo random

94
sequence mode two (or the waveform multiplication) constitute the hopping instruction (i.e., the
frequency hopping pattern), and by which the transmission frequency is randomly selected.

Figure 1: Block Diagram of Frequency Hopped Spread-Spectrum System.

The simplified block diagram of the frequency hopping communication system is shown in Figure
1. After modulation, the sender's information code sequence and the pseudo random sequence are
controlled by different frequency hopping pattern. At the receiving end, the signal and noise
received by the filter is sent to the mixer. The receiver's local oscillator signal is a frequency
hopping signal, the same as the transmission end is the same, the frequency of the two frequency
synthesizer is relatively, but the corresponding frequency has a frequency difference, just as the
receiver of the intermediate frequency. As long as the sender and receiver of the pseudo-random
code synchronization, it can make both the frequency hopping frequency synthesizer and the
frequency synthesizer to generate the frequency synchronization, after mixing, you can get a
constant frequency signal, and then the signal demodulation, you can recover the transmitted
information. In the case of interference signal, the frequency of the frequency synthesizer is not
related to the frequency of the frequency synthesizer. Therefore, it cannot enter into the

95
intermediate frequency channel, which cannot interfere with the formation of the frequency
hopping system.

Matlab Simulation of Frequency Hopping Spread Spectrum

Part in the MATLAB simulation procedures can be broadly divided into the majority of 6,
respectively, the main function, sending module, receiver module, AWNG channel, Walsh
function and error counters. In this chapter, a simple simulation is made on the source code of a
frequency hopping communication, and the time domain waveform and spectrum of the signal are
analyzed. Procedures are mainly composed of the following steps: first, through the rand function
to generate a data signal carrier and a fixed frequency carrier signal, and then the two BPSK
modulation, the modulation output is modulated signal BPSK. Frequency signal spread is
generated by the stitch function. We choose 6 kinds of frequency (we consider 6 kinds of jump
frequency to meet the requirements of the working process and the effect of frequency hopping).
Finally, signal BPSK and modulated signal spread frequency hopping modulation, frequency
hopping spread spectrum signal.

Simulation Result

The original bit sequence is a randomly generated binary sequence as the data signal to be
transmitted. After BPSK modulation, the BPSK modulated signal is obtained.

96
Spread signal with 6 frequencies is a randomly generated FM signal. There are six kinds of
frequency in the picture, frequency hopped spread spectrum signal is the output signal after
frequency hopping modulation.

The bandwidth is broadened, and the frequency components are increased and the frequency
components are increased, so that the receiver is not aware of the original data. Generally the
frequency hopping spread spectrum modelling and simulation using Matlab code and result are:

97
98
Matlab code for only Frequency hopping Spread Spectrum

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
% Using matlab 2018a may the code is incompatable for
% matlab below 2018a because in matlab 2018a the function
% randint is incompatable so its compatable by using randi implace of
% randint in 2018a
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
% Frequency Hopping Spread Spectrum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear

99
% Generation of bit pattern
s=round(rand(1,25)); % Generating 20 bits
signal=[];
carrier=[];
t=[0:2*pi/119:2*pi]; % Creating 60 samples for one cosine
for k=1:25
if s(1,k)==0
sig=-ones(1,120); % 120 minus ones for bit 0
else
sig=ones(1,120); % 120 ones for bit 1
end
c=cos(t);
carrier=[carrier c];
signal=[signal sig];
end
subplot(4,1,1);
plot(signal);
axis([-100 3100 -1.5 1.5]);
title('\bf\it Original Bit Sequence');

% BPSK Modulation of the signal


bpsk_sig=signal.*carrier; % Modulating the signal
subplot(4,1,2);
plot(bpsk_sig)
axis([-100 3100 -1.5 1.5]);
title('\bf\it BPSK Modulated Signal');

% Preparation of 6 new carrier frequencies


t1=[0:2*pi/9:2*pi];
t2=[0:2*pi/19:2*pi];
t3=[0:2*pi/29:2*pi];

100
t4=[0:2*pi/39:2*pi];
t5=[0:2*pi/59:2*pi];
t6=[0:2*pi/119:2*pi];
c1=cos(t1);
c1=[c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1];
c2=cos(t2);
c2=[c2 c2 c2 c2 c2 c2];
c3=cos(t3);
c3=[c3 c3 c3 c3];
c4=cos(t4);
c4=[c4 c4 c4];
c5=cos(t5);
c5=[c5 c5];
c6=cos(t6);

% Random frequency hopps to form a spread signal


spread_signal=[];
for n=1:25
c=randi([1 6],1,1);
switch(c)
case(1)
spread_signal=[spread_signal c1];
case(2)
spread_signal=[spread_signal c2];
case(3)
spread_signal=[spread_signal c3];
case(4)
spread_signal=[spread_signal c4];
case(5)
spread_signal=[spread_signal c5];
case(6)

101
spread_signal=[spread_signal c6];
end
end
subplot(4,1,3)
plot([1:3000],spread_signal);
axis([-100 3100 -1.5 1.5]);
title('\bf\it Spread Signal with 6 frequencies');

% Spreading BPSK Signal into wider band with total of 12 frequencies


freq_hopped_sig=bpsk_sig.*spread_signal;
subplot(4,1,4)
plot([1:3000],freq_hopped_sig);
axis([-100 3100 -1.5 1.5]);
title('\bf\it Frequency Hopped Spread Spectrum Signal');

% Expressing the FFTs


figure,subplot(2,1,1)
plot([1:3000],freq_hopped_sig);
axis([-100 3100 -1.5 1.5]);
title('\bf\it Frequency Hopped Spread Spectrum signal and its FFT');
subplot(2,1,2);
plot([1:3000],abs(fft(freq_hopped_sig)));

102
103
CHAPTER SEVEN
MULTIPLE ACCESS

Multiple access is the way of allowing many mobile users to share simultaneously a finite amount
of radio spectrum. So, Multiplexing deals with allocation/accommodation of users
on the available resource. As the spectrum is limited, so the sharing is required to increase the
capacity of cell or over a geographical area by allowing the available bandwidth to be used at the
same time by different users.
A cellular system divides any given area into cells where a mobile unit in each cell communicates
with a base station. So, it is possible to talk and listen simultaneously, and this effect, called
duplexing, is generally required in wireless telephone systems. The main aim in the cellular system
design is to be able to increase the capacity of the channel, i.e., to handle as many calls as possible
in a given bandwidth with a sufficient level of quality of service.

Duplexing may be done using frequency or time domain techniques.


 Frequency division duplexing (FDD)
 Time division duplexing (TDD) is effective for fixed wireless access when all users are
stationary so that propagation delays do not vary in time among the users.
The major access techniques used to share the available bandwidth in a wireless communication
system are:

 Time division multiple-access (TDMA)

 Frequency division multiple-access (FDMA)

 Space division multiple access (SDMA)

 Code division multiple-access (CDMA)

These techniques can be grouped as narrowband and wideband systems, depending upon how the
available bandwidth is allocated to the users. In a narrowband multiple access system, the available
radio spectrum is divided into a large number of narrowband channels. And in wideband systems,
the transmission bandwidth of a single channel is much larger than the coherence bandwidth of

104
the channel. So, a large number of transmitters are allowed to transmit on the same channel.
Particularly for 4G-LTE OFDM is used, is a special case of Frequency Division Multiplexing.

7.1 Time division multiple-access (TDMA)


Each user is allowed to transmit only within specified time intervals (Time Slots). Different users
transmit in different Time Slots. When users transmit, they occupy the whole frequency bandwidth
(separation among users is performed in the time domain). it requires a centralized control node,
whose primary function is to transmit a periodic reference burst that defines a frame and forces a
measure of synchronization of all the users. The frame so-defined is divided into time slots, and
each user is assigned a Time Slot in which to transmit its information. If we have a digital signal
of user i Sequence of equally spaced binary antipodal symbols X(i)(t) given as
X(i)(t)= ∑k ak(i) ẟ(t-kT)

Xic(t)= ∑m∑k a ik+mNbpsẟ(t-kTc-mTf)

Where aki : k-th binary antipodal symbol generated by user i


T: time period between symbols
TC: time interval between symbols after compression

Then the TDMA Coded Signal becomes:


Where the position in time of each group is modified according to the TDMA code, which is
assigned to the user. In other words, the TDMA code indicates which slot inside each frame must
be occupied by the user.

XiTDMA(t) = ∑m∑k a ik+mNbpsẟ(t- kTc-Cm(i) Ts -mTf)

Cm(i) : TDMA code assigned to user i for the m-th frame

let us consider the simple case of BPSK (in phase carrier modulation) then the transmitted signal
become:

105
X(i)TX(t) = √2PTX (XiTDMA(t)*g0(t))sin(2∏fPt + φ(i))

Where
g0(t) : energy-normalized impulse response of the Pulse Shaper.
. PTX : transmitted power
fP: carrier frequency
φ(i): instantaneous phase

Block diagram of TDMA Transmitter

Xi(t) Slow in FastXic(t) i


TDMAX TDMA(t) Pulse XiTX(t)
Modulator
Out Coder Shaper

Code Carrier
generator generator

Figure:1 Block Diagram of TDMA Transmitter

7. 2. Code division multiple-access (CDMA)


In CDMA each user is assigned a unique code sequence (spreading code), which it uses to encode
its data signal. The receiver, knowing the code sequence of the user, decodes the received signal
and recovers the original data. The bandwidth of the coded data signal is chosen to be much larger
than the bandwidth of the original data signal, that is, the encoding process enlarges (spreads) the
spectrum of the data signal. CDMA is based on spread-spectrum modulation. If multiple users
transmit a spread-spectrum signal at the same time, the receiver will still be able to distinguish
between users, provided that each user has a unique code that has a sufficiently low cross
correlation with the other codes. CDMA system capacity is thus typically limited by the
interference from other users, rather than by thermal noise.
7. 3. Frequency division multiple-access (FDMA)
Each user transmits with no limitations in time, but using only a portion of the whole available
frequency bandwidth. Different users are separated in the frequency domain. Frequency division

106
is very simple: all transmitters sharing the medium have output power spectra in non-overlapping
bands.
The major disadvantage of FDMA is the relatively expensive and complicated band pass filters
required. TDMA is realized primarily with much cheaper logic functions. Another disadvantage
of FDMA is the rather strict linearity requirement of the medium. If we have a digital binary signal
of user i given as
X(i)(t)= ∑k ak(i) ẟ(t-kT)
Then its output FDMA-coded signal becomes
X(i) TX(t) = √2PTX (X(i)(t)*g0(t))sin(2∏(fP+c(i) (t)∆f) + φ(i))

Where
Δf : frequency spacing between adjacent users
c(i) : FDMA code assigned to user i

Transmitter of FDMA

Xi(t) Pulse Xic(t) i


X TX(t)
Modulator
Shaper

Code Carrier
generator generator

Figure:2 Block Diagram of FDMA Transmitter

In FDM, the given bandwidth is subdivided among a set of carriers. There is no relationship
between the carrier frequencies in FDM. If the carriers are harmonics, integral multiples of
fundamental component then they become orthogonal. In this technique, the given resource
(bandwidth) is shared among individual modulated data sources. So is a multicarrier modulation
technique, which employs several carriers, within the allocated bandwidth, to convey the
information from source to destination. Each carrier may employ one of the several available

107
digital modulation techniques (BPSK, QPSK, QAM etc..,), effective for communication over
channels with frequency selective fading (different frequency components of the signal experience
different fading), it mitigates the problem by converting the entire frequency selective fading
channel into small flat fading channels that is easier to combat by employing simple error
correction and equalization schemes.

7.3.1 Design of OFDM


In this part we design and simulate OFDM to study the performance of the OFDM system at BPSK
modulation schemes. It is very important to evaluate performance of the communication system,
to test the efficiency and quality of the service it can provide. We use Matlab program to design
the functionality of OFDM, then BER, is a combination of modulation and multiplexing. In the
designing of OFDM Transmitter there are steps we have to follow:
Step I:
Determine the number of subcarriers required to send the given data. let’s assume
that we have N subcarriers. Each subcarrier is centered at frequencies that are orthogonal to each
other, let assume for instant at fundamental frequency F0 = B/ N which can be written as
...... -2F0, -F0 ,0, F0,2F0....... total of N subcarrier. Therefore, Kth subcarrier will be defined as.
kF0 =kB/ N. and Kth subcarrier is given e j kF02π. Let the Kth symbol is given by xk then the
transmitted signal on Kth subcarrier will be
Stk = xk e j kF02π...................................................1
Net transmitted multi carrier modulated signal will be sum of transmit signals across all N
subcarrier and will be defined as: -
∑k xk e j kF02π ...........................................................2

Step II:
Determine the modulation format that we wish to use. An OFDM signal can be
constructed using anyone of the following digital modulation techniques namely BPSK, QPSK,
QAM etc.., in our design we used the simplest modulation technique that is BPSK.
Step III:
Determine the constellation mapper and serial to parallel convertor, depending on the
number of sub-carriers (N), that takes the serial stream of input bits and outputs N parallel streams

108
(indexed from 0 to N-1). These parallel streams are individually converted into the required digital
modulation format (BPSK, QPSK, QAM etc..,). Let’s call this output S0, S1, SN. The conversion
of parallel data (D) into the digitally modulated data (S) is usually achieved by a constellation
mapper, which is essentially a look up table (LUT).
Step IV:
Then use the N size IFFT/FFT, the Fourier transform breaks a signal into different
frequency bins by multiplying the signal with a series of sinusoids. This essentially translates the
signal from time domain to frequency domain. And depending on specifications specify the length
of the cyclic prefix in terms of its duration. At transmitter we have X(0), X(1)....X(N-1) Symbols.
Serial to parallel convertor also known as demultiplexing (DEMUX) is used at transmitter to load
to the symbols onto the subcarrier. Then take N pt. IFFT of these symbols to generate transmit
samples. Now add the cyclic prefix (CP) of defined length at the start of the samples. Finally, the
resultant output from the N parallel arms are summed up together to produce the OFDM signal.
the transmitted signal after IFFT transform is
X(t)= 1/N∑k xk e j2π k Δft
Where
Δf=1/NT
Δf = sub carrier spacing
T = Signal Period
NT = OFDM symbol period
Xn = nth frequency domain complex symbol, n=0,1,2….N-1.

whereas its dual, FFT is given by


X(k)= ∑k xne j2π k Δfn

Step V:
Then using parallel to serial convertor transmit through the designed channel, in our case
AWGN channel is used.
OFDM signal=c(t)= ∑n sne j2π nft

109
Block diagram of Transmitter

Cyclic prefix X(N-L)


X(N-L) ... X(N-1) X(0), X(1)....X(N-1) Parallel to
: Serial
convertor
X(N-1)
x0
d0 Constellation X0 x1 c(t)
Serial to
parallel d1 Mapper (BPSK) X1
N_IFFT
d0, d1......dN-1 convertor : : : : : :
dN-1 XN-1 xN-1

Figure:3 Block Diagram Of OFDMA Transmitter

Serial to
Parallel to d`0 X`0 R0 r0 parallel
Serial Frequency Delete
d`0, d d`1 Constellation X`1 R1
N_FFT r1
cyclic
convertor
convertor de_Mapper Domain
: : Equalizer : : prefix :
(BPSK)
d`N*1 X`N-1 RN-1 rN-1

Figure:4 Block Diagram Of OFDMA Reciever

110
Matlab implementation of OFDM

%Follows IEEE 802.11 specification


%IEEE 802.11 standard [IEEE80211] parameters for its OFDM physical layer.
FFT/IFFT size = 64 (implies 64 subcarriers in total = used + unused =
NFFT)
Number of data subcarriers = 48 (Nd)
Number of pilot subcarriers = 4 (Np)
Number of total USED subcarriers = 52 (Nu = Nd+ Np)
Number of total UNUSED subcarriers = 12 (Nun = NFFT – Nu).

%Simulation of OFDM system in an AWGN environment

N=64; %FFT size or total number of subcarriers (used + unused) 64


Nsd = 48; %Number of data subcarriers 48
Nsp = 4 ; %Number of pilot subcarriers 4
ofdmBW = 20 * 10^6 ; % OFDM bandwidth
nSym=10^4; %Number of OFDM Symbols to transmit
EbN0dB = -20:2:8; % bit to noise rati
deltaF = ofdmBW/N; %=20 MHz/64 = 0.3125 MHz
Tfft = 1/deltaF; % IFFT/FFT period = 3.2us
Tgi = Tfft/4;%Guard interval duration - duration of cyclic
Tsignal = Tgi+Tfft; %duration of BPSK-OFDM symbol
Ncp = N*Tgi/Tfft; %Number of symbols allocated to cyclic
Nst = Nsd + Nsp; %Number of total used subcarriers
nBitsPerSym=Nst; %For BPSK the number of Bits per Symbol is
EsN0dB = EbN0dB + 10*log10(Nst/N) + 10*log10(N/(Ncp+N)); % converting to
symbol to nois
errors= zeros(1,length(EsN0dB));
%theoreticalBER = zeros(1,length(EsN0dB));
%Monte Carlo Simulation

111
for i=1:length(EsN0dB)
for j=1:nSym

%-----------------Transmitter--------------------
s=2*round(rand(1,Nst))-1; %Generating Random Data with BPSK modulation
%IFFT block

X_Freq=[zeros(1,1) s(1:Nst/2) zeros(1,11) s(Nst/2+1:end)];


% converting to time domain
x_Time=N/sqrt(Nst)*ifft(X_Freq);

%Adding Cyclic Prefix


ofdm_signal=[x_Time(N-Ncp+1:N) x_Time];
%--------------Channel Modeling ----------------
noise=1/sqrt(2)*(randn(1,length(ofdm_signal))+1i*randn(1,length(ofdm_signal)));
r= sqrt((N+Ncp)/N)*ofdm_signal + 10^(-EsN0dB(i)/20)*noise;
%-----------------Receiver----------------------
%Removing cyclic prefix
r_Parallel=r(Ncp+1:(N+Ncp));
%FFT Block
r_Time=sqrt(Nst)/N*(fft(r_Parallel));
%Extracting the data carriers from the FFT output
R_Freq=r_Time([(2:Nst/2+1) (Nst/2+13:Nst+12)]);
%BPSK demodulation / Constellation Demapper.Force +ve value --> 1, -ve value --> -1
R_Freq(R_Freq>0) = +1;
R_Freq(R_Freq<0) = -1;
s_cap=R_Freq;
numErrors = sum(abs(s_cap-s)/2); %Count number of errors
%Accumulate bit errors for all symbols transmitted
errors(i)=errors(i)+numErrors;
end

112
theoreticalBER(i)=(1/2)*erfc(sqrt(10.^(EbN0dB(i)/10))); %Same as BER for BPSK
over AWGN
end
simulatedBER = errors/(nSym*Nst);
plot(EbN0dB,log10(simulatedBER),'r-o');
hold on;
plot(EbN0dB,log10(theoreticalBER),'k*');
grid on;
title('BER Vs EbNodB for OFDM with BPSK modulation over AWGN');
xlabel('Eb/N0 (dB)');ylabel('BER');legend('simulated','theoretical');

Simulation Result

BER is widely used as performance measurement tool, it tells number of bits destroyed while the
data is travelling from source to the destination, AWGN (Additive White Gaussian Noise) is

113
used as transmission channel. From the simulated result above, it can be seen that the OFDM-
BPSK modulation has no advantage over a normal BPSK system in AWGN.

114
CHAPTER EIGHT
CHANNEL MODEL
Channel is the most important issue for digital communication system. In this section, it has
described the modeling and simulation result for different channels namely: AWGN and Fading
channels which is divided in to Rayleigh and Rician as following:

8.1 AWGN Model


Communication channel performance depends on noise. Additive white Gaussian Noise comes
from many natural sources such as vibration of atoms in conductor, shot noise, radiation from earth
and other warm object and from celestial sources such as the Sun. There are various kinds of
communication channel. AWGN channel is the simplest model of a channel and is well suited for
wired communication. This channel is linear and time-invariant (LTI). AWGN channel adds white
Gaussian noise to the signal when signal passes through it. This channel’s amplitude frequency
response is flat and phase response is linear for all frequencies. The modulated signals pass through
it without any amplitude loss and phase distortion. So in such case, fading does not exist but the
only distortion that exists is introduced by the AWGN.

An AWGN channel can be used for imitation noise and its capacity can express in equation below

1 𝑃
𝐶 = ⁡ log⁡(1 + )
2 𝑁

Where P represents the maximum channel power.

The theoretical BER of BPSK is well known and can be compared with the simulated results for
specific energy contrast ratios denoted as γ𝑏 =Eb/No. Pb, the probability of bit error for BPSK in
AWGN, is given by the relation:

1
𝑃𝑏 =2erfc(√γ𝑏 ) where γ𝑏 = Eb/No

In the study of communication systems, the classical (ideal) additive white Gaussian noise
(AWGN) channel, with statistically independent Gaussian noise samples corrupting data samples
free of inter-symbol interference (ISI), is the usual starting point for understanding basic
performance relationships.

Simulation for AWGN Channel

115
%This program simulates BER of BPSK in AWGN channel
clear all; close all; clc;
num_bit=100000; %Signal length
max_run=20; %Maximum number of iterations for a single SNR
Eb=1; %Bit energy
SNRdB=0:1:10; %Signal to Noise Ratio (in dB)
SNR=12.^(SNRdB/12);
hand=waitbar(0,'Please Wait....');
for count=1:length(SNR) %Beginning of loop for different SNR
avgError=0;
No=Eb/SNR(count); %Calculate noise power from SNR

for run_time=1:max_run %Beginning of loop for different runs


waitbar((((count-1)*max_run)+run_time-1)/(length(SNRdB)*max_run));
Error=0;

data=randint(1,num_bit); %Generate binary data source


s=2*data-1; %Baseband BPSK modulation

N=sqrt(No/2)*randn(1,num_bit); %Generate AWGN

Y=s+N; %Received Signal

for k=1:num_bit %Decision device taking hard decision and deciding error
if ((Y(k)>0 && data(k)==0)||(Y(k)<0 && data(k)==1))
Error=Error+1;
end
end

Error=Error/num_bit; %Calculate error/bit


avgError=avgError+Error; %Calculate error/bit for different runs

116
end %Termination of loop for different runs
BER_sim(count)=avgError/max_run; %Calculate BER for a particular SNR
end %Termination of loop for different SNR
BER_th=(1/2)*erfc(sqrt(SNR)); %Calculate analytical BER
close(hand);

semilogy(SNRdB,BER_th,'m-<', 'linewidth' ,2.0);grid on; %Plot BER


hold on
semilogy(SNRdB,BER_sim,'b-','linewidth',2.0);grid on
xlabel('SNR in dB');ylabel('BER');
legend('Theoretical BER','Simulation BER');
axis([min(SNRdB) max(SNRdB) 10^(-5) 1]);
title('BPSK Simulation for AWGN Channel');
hold off

As shown in figure above, the BER performance of simulation result is closely identical to
theoretical BER.
8.2 Fading Channel
Fading assumed as the attenuation produced by spread media or considered as the perversion
in wireless communications. In a radio propagation channel, there are two types of fading;
large scale and small scale. The large scale fading refers to the degradation of the signal strength

117
due to the path loss as a function of the distance between the transmitter and the receiver and
shadowing effects caused by the surrounding environmental clutter. Small scale fading occurs in
the range of the signal wavelength and is much more random as compared to large scale fading.
Small scale fading is mainly a result of multiple multipath components undergoing
constructive/destructive interference at any point. Most of the time Small scale models are used
to predict the fading characteristics, i.e. the fluctuation of the field strengths in the near vicinity
of the receiver for very short distances.

Rayleigh and Rician fading channels are useful models of real-world phenomena in wireless
communications. These phenomena include multipath scattering effects, time dispersion, and
Doppler shifts that arises from relative motion between the transmitter and receiver. Note that a
digital communication system involving a fading channel usually requires components that
compensate for the fading response. Typical approach to compensate for fading include:

 Differential modulation or a one-tap equalizer helps compensate for a frequency-flat fading


channel.
 An equalizer with multiple taps helps to compensate for a frequency-selective fading channel

8.2.1 Rayleigh Channel


Many wireless communications channels do not have a line-of-sight (LOS) signal path. The lack
of a LOS signal path entails transmitting a signal to the receiver by a phenomenon known as
multipath. Multipath occurs when there are multiple paths from the transmitter to the receiver due
to the reflection of the original signal off of buildings, terrain (features) or the ionosphere. A
signal that goes through a multipath fading channel will arrive at the receiver multiple
times with different amplitudes, phases and arrival times. Since multipath channels can vary
significantly in terms of characteristics in an unpredictable manner, they must be modeled
as a random process. The most common model for a multipath fading channel is the Rayleigh
model, where the amplitude of the received signal is modeled as a Rayleigh random variable.

In a heavily built -up urban or where there is non-line-of-sight communication between the
transmitter and receiver, the objects in the environment attenuate, reflect, refract, and diffract
the signal before it arrives at the receiver. This propagation environment is known as Rayleigh
fading, and the Rayleigh distribution model is a specialized stochastic fading model for this
type of fading environment. The channel fading depends on moving speed of the receiver

118
and/or transmitter. The amplitude gain of this fading channel is characterized by the Rayleigh
distribution. When there are different signal paths among the receiver and transmitter, A Rayleigh
constrains the total signal at the recipient and can change the probability intensity Function
of Rayleigh fading channel.

The error probability for BPSK in Rayleigh fading is given by:

1 Ῡ𝑏
𝑃𝑏 = [1 − √ ]
2 1 + Ῡ𝑏

Where Ῡ𝑏 is the average SNR/bit.

BER for BPSK in Rayleigh Channel


% Script for computing the BER for BPSK modulation in a
% Rayleigh fading channel
clear
N = 10^6 % number of bits or symbols
% Transmitter
ip = rand(1,N)>0.5; % generating 0,1 with equal probability
s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0

Eb_N0_dB = [-3:35]; % multiple Eb/N0 values


for ii = 1:length(Eb_N0_dB)

n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise, 0dB variance


h = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % Rayleigh channel

% Channel and noise addition


y = h.*s + 10^(-Eb_N0_dB(ii)/20)*n;
% equalization
yHat = y./h;
% receiver - hard decision decoding
ipHat = real(yHat)>0;
% counting the errors
119
nErr(ii) = size(find([ip- ipHat]),2);
end
simBer = nErr/N; % simulated ber
theoryBerAWGN = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber
EbN0Lin = 10.^(Eb_N0_dB/10);
theoryBer = 0.5.*(1-sqrt(EbN0Lin./(EbN0Lin+1)));
% plot
close all
figure
semilogy(Eb_N0_dB,theoryBer,'bp-','LineWidth',2);
hold on
semilogy(Eb_N0_dB,simBer,'mx-','LineWidth',2);
axis([-3 35 10^-5 0.5])
grid on
legend('Rayleigh-Theory', 'Rayleigh-Simulation');
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('BER for BPSK modulation in Rayleigh channel');

Power of Faded Signal

120
The code below plots a faded signal’s power (versus sample number). The code also illustrates
the syntax of the filter and rayleighchan functions and the state retention of the channel object.
Notice from the output that NumSamplesProcessed equals the number of elements in the signal.

c = rayleighchan(1/10000,100);
sig = 1i*ones(2000,1);
y = filter(c,sig);
c
plot(20*log10(abs(y)))
xlabel('Sample Number');
ylabel('Power of Faded Signal');
title('Power of a Faded signal in Rayleigh Channel');

c=

ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-04
DopplerSpectrum: [1x1 doppler.jakes]
MaxDopplerShift: 100
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: 0.0994 - 0.1056i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 2000

121
Fig. Power of a faded signal in Rayleigh channel

8.2.2 Rician Fading Channel


The recipient signal is a mixing of multipath fading and a line of line seeing among a recipient and
sender. The LOS (line of sight) path is the portents signal path that leaves immediately from the
sender to recipient. The action of Rayleigh fading on the sender signal will be more than in the
Rician fading.

When there is line-of-sight, direct path is normally the strongest component goes into deeper fade
compared to the multipath components. This kind of signal is approximated by Rician distribution.
As the dominating component run into more fade the signal characteristic goes from Rician to
Rayleigh distribution.

Rician fading is suitable for characterizing satellite communications or in some urban


environments. Rician fading is also a small-scale fading. In this case, the probability of deep fades
is much smaller than that in the Rayleigh-fading case.

Simulation Results for Rician Channel

The followings are the plots which depicts Rician channel impulse response, baseband IQ vector
without channel, baseband IQ vector with Rician channel and channel response with baseband IQ
vector consisting all ones in the packet.
122
%MATLAB model of 3-path Rician channel model
clc;
clear all;
close all;
load file_ldacstxpkt; % baseband IQ vector of LDAC-1 system
Tx_Packet=Tx_Packet.';
KFactor = 3; % Rician K-factor
Ts=1e-4; % sampling time in second
Fd=100; % doppler frequency in Hz
Tau=[0 1.5e-4 2.5e-4]; % delay for the three paths
PdB=[0, -2, -6]; % power in each of the three paths
pkt_allones=ones(1,480)+i*ones(1,480);
% rician channel model
h = ricianchan(Ts, Fd, KFactor, Tau, PdB);
h.StoreHistory = true;
Rx_pkt_allones = filter(h, pkt_allones);
Rx_Packet = filter(h, Tx_Packet); % passing baseband IQ vector through rician channel
figure;plot(h);
figure;plot(abs(Tx_Packet)); title('baseband IQ packet without rician channel');
figure;plot(abs(Rx_Packet)); title('baseband IQ packet with rician channel');
figure;plot(abs(Rx_pkt_allones)); title('baseband IQ of all ones after passing through rician
channel');

123
124
Bit Error Rate
In a digital transmission, BER is the number of bits with errors divided by the total number of bits
that have been transmitted, received or processed over a given time period. That is:

𝑁𝑢𝑚𝑏𝑒𝑟⁡𝑜𝑓⁡𝑏𝑖𝑡𝑠⁡𝑤𝑖𝑡ℎ⁡𝑒𝑟𝑟𝑜𝑟
𝐵𝐸𝑅 = ⁡
𝑡𝑜𝑡𝑎𝑙⁡𝑛𝑢𝑚𝑏𝑒𝑟⁡𝑜𝑓⁡𝑏𝑖𝑡𝑠⁡𝑠𝑒𝑛𝑡

Bit error rate is a key parameter that is used in assessing the systems performance that transmits
digital data from one location to another. When data is transmitted over a data link, there is a
possibility of errors being introduced into the system. As a result, it is necessary to assess the
performance of the system, and BER provides an ideal way in which this can be achieved. BER
assesses performance of a system including the transmitter, receiver and the medium between the
two. The bit-error rate is the main performance parameter of a digital communication system. The
performance of channel can be evaluated from bit error rate (BER) versus signal to noise ratio
(SNR) curve.

Best Performance Channel (AWGN)


The amount of Pb (probability of error in AWGN channel) minimizes exponentially while Pb
(probability of mistakes in FADING channel) reduces linearity and the BER decreases for AWGN
channel and increases for fading channel (Rayleigh and Rician). Observing from the obtained
results for all channels; the AWGN channel will be better realization than Rayleigh fading channel
because the BER value lower than the BER value. Typically, the number of symbols should be
selected to be an order of magnitude larger than the inverse of the BER. Note that the accuracy of
the simulated result improves with an increasing number of demodulated symbols. Therefore,
performance of AWGN channel is the best of all channels as it has the lowest bit error rate (BER).

CONCLUSION
Generally, the growing of demand for the huge data transmission made the digital communication
systems increasingly attractive, greatest of communications have become digital due to the
advantages of digital communication over analog communication. In these projects we mainly use
Huffman as source coding, convolutional encoder and Viterbi decoder as channel encoder and

125
decoder, multiplexer, modulator (mainly BPSK), Frequency Hopping Spread Spectrum as
frequency spread, OFDM as multiple access and AWGN as wireless channel. For each of digital
communication system components we investigate their perspectives performance analysis mainly
in terms of BER.

126
127

You might also like