Download as pdf or txt
Download as pdf or txt
You are on page 1of 62

Bahir Dar University

Bahir Dar Institute of Technology


Faculty of Electrical and Computer Engineering
Performance Evaluation of Error Correcting Techniques for OFDM System

By
Name ID
1. Yeshambel Ayenew 0905417

2. Yordanos Dessie 0905494

3. Yordanos Girma 0906074

4. Zelalem Mulat 0905516


Advisor
Ms. Edom T.

A Project Submitted to the Faculty of Electrical and Computer Engineering of Bahir Dar
University in Partial Fulfillment of the Requirements for the Degree of Bachelor of Science in
Electrical Engineering, Electronics and Communication Engineering

July, 2021
Bahir Dar, Ethiopia
BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Declaration
We, the undersigned, declare that this Project is our original work, has not been presented for a
degree in this or any other universities, and all sources of materials used for the Project have been
fully acknowledged.
Name Signature

1. _______________________ _________

2._______________________ _________

3._______________________ _________

4._______________________ _________

Date of Submission: __________

This Project has been submitted for examination with my approval as a university advisor.

_____________________ _________

Project Advisor Signature

Semester Project Page i


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Acknowledgment
First of all, we are grateful to the help of Almighty God for enabling us to complete this semester
project work. We would like to take this opportunity to express our heartfelt gratitude to our
advisor Ms. Edom T. for her advice, valuable guidance and encouragement. We are thankful for
her aspiring guidance, invaluably constructive criticism during the project work. Finally, we
would like to express our gratitude to Bahir Dar Institute of Technology, Faculty of Electrical and
Computer Engineering staff members for their help to complete the project successfully

Semester Project Page ii


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Table of Content
Declaration........................................................................................................................................ i
Acknowledgment ............................................................................................................................. ii
Table of Content ............................................................................................................................. iii
List of Figures .................................................................................................................................. v
List of Table ................................................................................................................................... vi
List of Acronyms ........................................................................................................................... vii
Abstract ......................................................................................................................................... viii
Chapter One ..................................................................................................................................... 1
Introduction ..................................................................................................................................... 1
1.1 Background Information ........................................................................................................... 1
1.2 Statement of the Problem .......................................................................................................... 3
1.3 Objectives ................................................................................................................................. 3
1.3.1 General Objective ................................................................................................................... 3
1.3.2 Specific Objectives ................................................................................................................. 3
1.4 Methodology.............................................................................................................................. 3
1.4.1 Software Used ......................................................................................................................... 4
1.5 Major Assumptions Made for the Work .................................................................................... 4
1.6 Significance of the Project ......................................................................................................... 4
1.7 Scope of the Project ................................................................................................................... 5
1.8 Organization of the Project ........................................................................................................ 5
Chapter Two .................................................................................................................................... 6
Literature Review ............................................................................................................................ 6
Chapter Three .................................................................................................................................. 7
OFDM System and Error Correcting Techniques ........................................................................... 7
3.1 Orthogonal Frequency Division Multiplexing (OFDM) Systems ............................................. 7
3.1.1 Orthogonality of OFDM Signal .............................................................................................. 8
3.2 Efficient Multi Carrier Modulation Techniques ........................................................................ 9
3.2.1 Interpretation of FFT .............................................................................................................. 9
3.2.2 OFDM Modulation Using IFFT ............................................................................................. 9
3.3 Designing of an OFDM System .............................................................................................. 10

Semester Project Page iii


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

3.3.1 Guard Time and Cyclic Extension ........................................................................................ 10


3.3.2 Number of Sub-Carriers........................................................................................................ 11
3.3.3 Modulation and Coding Schemes ......................................................................................... 11
3.4 Channel Coding ....................................................................................................................... 12
3.4.1 Linear Block Codes .............................................................................................................. 12
3.4.2 Convolutional Codes............................................................................................................. 17
3.4.3 Reed-Solomon Codes ........................................................................................................... 20
3.5 Common Uses and Error detection and correction capabilities .............................................. 23
3.6 Error Correcting Techniques Evaluation ................................................................................. 24
3.6.1 Implementation ..................................................................................................................... 24
3.6.2 MATLAB Function for the Three Error Correcting Techniques ......................................... 25
Chapter Four .................................................................................................................................. 26
Simulation Result and Discussion ................................................................................................. 26
4.1 Simulation Setup ..................................................................................................................... 26
4.2 Results for Linear Block Codes ............................................................................................... 27
4.3 Results of Convolutional Codes .............................................................................................. 28
4.3 Results of Reed-Solomon Codes ............................................................................................. 29
Chapter Five .................................................................................................................................. 35
5.1 Conclusion ............................................................................................................................... 35
5.2 Future Work............................................................................................................................. 35
Reference ....................................................................................................................................... 36

Semester Project Page iv


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

List of Figures
Figure 1. 1: Block diagram of channel coding ................................................................................ 2
Figure 3. 1: Single carriers, multicarrier and orthogonal multi carrier modulation ........................ 7
Figure 3. 2: OFDM signal in frequency domain ............................................................................. 8
Figure 3. 3: OFDM symbol time structure, cyclic prefix .............................................................. 11
Figure 3. 4: Code word for linear block code ................................................................................ 13
Figure 3. 5: Standard Array of the (5, 2) systematic code ............................................................. 16
Figure 3. 6: Convolutional encoder with length 7 & rate ½. ......................................................... 18
Figure 3. 7: Block diagram convolution encoder and viterbi decoder .......................................... 18
Figure 3. 8: convolutional encoder with k = 1, n = 2 and K = 3. .................................................. 19
Figure 3. 9: Block diagram of the Viterbi decoder ........................................................................ 20
Figure 4. 1: BER for Linear Block Codes with different code rates ............................................. 27
Figure 4. 2: BER for Convolutional Codes with different code rates ........................................... 29
Figure 4. 3: BER for Reed-Solomon Codes with different code rates .......................................... 30
Figure 4. 4: Comparison of uncoded OFDM and three coding schemes Rc1/3. ............................. 31
Figure 4. 5: Comparison of uncoded OFDM and three coding schemes for code rate ½ ............. 32
Figure 4. 6: Comparison of uncoded OFDM and three coding schemes for code rate 2/3 ........... 33

Semester Project Page v


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

List of Table
Table 4. 1: Performance comparison different channel coding techniques ................................. 34

Semester Project Page vi


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

List of Acronyms

ACS Add Compare and Select unit


ATM Asynchronous Transfer Mode
AWGN Additive White Gaussian Noise
BER Bit Error Rate
BMU Branch Metric Unit
CD Compact Disc
CP Cyclic Prefix
DAB Digital Audio Broadcasting
DSL Digital Subscriber Line
DVD Digital Versatile Disc
FEC Forward Error Correcting
FFT Fast Fourier Transfer
ICI Inter Carrier Interference
INET Integrated Network Enhanced Telemetry
ISI Inter Symbol Interference
OFDM Orthogonal Frequency Division Multiplexing
PAPER Peak to Average Power Ratio
QPSK Quadrature Phase Shift Keying
RS Reed Solomon
SNR Signal to Noise Ratio
TBU Trace Back Unit

Semester Project Page vii


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Abstract
Transmission of valid data from transmitter to the receiver is the main issue in a communication
system. In order to receive valid information which is the same as the transmitted data, coding of
a channel is necessary. Channel coding is a process of detecting and correcting bit errors in
digital communication systems which is performed both at the transmitter and at the receiver. At
the receive side, channel coding is referred to as the decoder which enables the receiver to detect
and correct errors, if the errors occur during transmission due to noise, interference and fading.

In this paper, Error correcting techniques (linear block code, convolution code and reed Solomon
code) for a random generator matrix done the simulations of each Error correcting techniques are
performed to evaluate the performance of each techniques for different channel conditions at
different code rate and By comparing the three techniques, the results show that Reed-Solomon
codes performs the best for all error rates due to its consistency in performance at both low and
high code rates which verified by results. During error correcting techniques adding of redundant
bits is necessary, due to this bandwidth is increase. In order to use the bandwidth effectively
orthogonal frequency division multiplexing is used.

Semester Project Page viii


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Chapter One
Introduction
1.1 Background Information
Recently wireless communication is the leading communication system due to global coverage
and flexibility properties. As the name suggests wireless communication is a means of
transmitting information from one place to another wirelessly and it replaces most of the worlds
wired transmission system. Due to this reason, performing a research in the field of wireless
communication is still a hot topic to discover new possibilities. The goal of every research in this
topic is to find more effective communication methods. Hence to achieve this effective
communication environmental, noise error is being as minimum as possible by using channel
coding techniques. When a certain digital information transmitted through a channel the noise is
added to the data from different sources that degrades the source information. So discussing
about channel coding is necessary and also comparing the performance of different types of
channel coding.

Channel coding is a process of detecting and correcting bit errors in digital communication
systems which is performed both at the transmitter and at the receiver. At the transmit side,
channel coding is referred to as encoder, where redundant bits (parity bits) are added with the raw
data before modulation. At the receive side, channel coding is referred to as the decoder. This
enables the receiver to detect and correct errors, if they occur during transmission due to noise,
interference and fading. Since error control coding adds extra bits to detect and correct errors,
transmission of coded information requires more bandwidth; so in order to utilization channel
bandwidth efficiently orthogonal frequency division multiplexing techniques are used.

Semester Project Page 1


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Figure 1. 1: Block diagram of channel coding

Channel coding attempts to utilize redundancy bit to minimize the effect of various channel
impairments, such as noise and fading, and therefore can increase performance of the
communication system. There are two basic ways of implementing redundancy to control errors.
These are two types those are automatic repeat request and forward error control coding.

In a system which utilizes forward error control coding, the data are encoded with the redundant
bits to allow the receiver to not only detect errors, but to correct them as well. In this system, a
sequence of data signals is transformed into a longer sequence that contains enough redundancy
to protect the data. This type of error control is also classified as channel coding, because these
methods are often used to correct errors that are caused by channel noise.

The goal of all forward error control coding techniques is to detect and correct as many errors as
possible without greatly increasing the data rate or the bandwidth. FECC codes are generally
classified in two broad categories: block codes and convolutional codes. Of course, there are also
codes, such as concatenated codes, that employ both block codes and convolutional codes in
tandem so as to considerably improve the bit error rate performance. Block and convolutional
codes are different not only in their structures and thus complexities, but in their performances
and applications. The comparison between these two categories of codes may not be simple, as
each has its own merits and demerits.

Semester Project Page 2


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

1.2 Statement of the Problem


When an information is transmitted from the transmitter to the receiver, the transmitted data
behave an error due to channel noise interference with the transmitted message data. That results
received data being error. So, in order to avoid such errors it is preferable to design best channel.
The designed channel must include channel encoder and channel decoder (i.e. channel coding)
for the purpose of detecting and correcting errors which is happened due to channel interference.
Selecting appropriate and efficient types of channel coding is the choice of the channel designers
based on the designer’s requirements.

So in this project we compare and contrast the three types of channel coding techniques (i.e.
linear block codes, convolutional codes and reed Solomon codes) performance in order to select
the best types of channel coding techniques based on the design requirement.

1.3 Objectives
1.3.1 General Objective

To evaluate the performance of error correcting techniques for orthogonal frequency division
multiplexing (OFDM) Systems.

1.3.2 Specific Objectives

 To analyze the error correcting capability of linear block codes, convolutional codes and
Reed Solomon codes in following.
 To analyze the encoding and decoding of those, the three channel coding techniques.
 To analyze the bit error rate and signal to noise ratio capability of linear block codes,
convolutional codes and Reed Solomon codes using Matlab software.
 To review literatures that has a relation with this project.
 To familiarize with Matlab, since the analysis graph is done with this software.

1.4 Methodology

This section covers the detail explanation of methodology that is being used to do this project
complete well. At the beginning the methodology of every project is selecting of a project title, so
we did that. Then reviewing of literatures related to channel coding and decoding, OFDM system
and Matlab coding. After reviewing literatures we prepared the project document and simulate

Semester Project Page 3


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

the channel coding techniques using Matlab software and analyze the error correction capability
of the channel coding, here we deal about linear block coding, convolutional coding and Reed
Solomon channel coding system.

Then compare and conclude which channel coding is preferred by the channel designers based on
bit error rate (BER) and signal to noise ratio (SNR). The assessment will help us to analyze the
performance of the three coding techniques in combination with OFDM. The finding of this work
may help the OFDM system designers to choose the error correcting codes that match their
requirements.

Selecting project title

Literature Review

System Modeling

Software Simulation

Giving Conclusion

Figure 1. 2: Methodology for the project work

1.4.1 Software Used


 MATLAB.
1.5 Major Assumptions Made for the Work
In this project the measure assumptions are the generator matrix of each individual error
correcting techniques are specified if someone changes the generator matrix the result of this
project being changed. The message size is fixed which is specified in the simulation setup.

1.6 Significance of the Project

The main significance of this project is to select appropriate channel coding techniques for
orthogonal frequency division multiplexing system with respect of the user’s requirement when a
certain communication system is implemented in the real world life. Investigate the performance

Semester Project Page 4


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

of three codes (i.e. linear block codes, convolutional codes and reed Solomon codes) under
various channel conditions.

1.7 Scope of the Project


The scope of this project is analyzing and simulate the performance of error correcting techniques
of linear block coding, convolutional coding and Reed Solomon coding in orthogonal frequency
division multiplexing system.
1.8 Organization of the Project
The entire of this project organized in five chapters, each chapter covering is generalized as
bellow.

Chapter one: gives a brief introduction about the channel coding techniques, the reasons that
enforce to do this project. Objective, scope and significance of the project are explained in detail
in this chapter.

Chapter two: the second chapter of this project covers findings and limitation of related
literatures that have a relation with this project title.
Chapter three: gives a brief detail about OFDM Systems and describes the Channel Coding and
different procedures involve in the process of coding. This is the main parts of the project.

Chapter four: covers the simulation result and the discussion of simulation results. Analyzing the
simulation result is done in the fourth chapter.

Chapter five: covers the conclusion of the project and recommendations for future work is
discussed in this chapter.

Semester Project Page 5


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Chapter Two
Literature Review
In [1], the performance of OFDM system has been studied under various channels and
modulation techniques. Also, the channel capacity of different channels is compared to find out
that which channel is better for OFDM transmission. This finding does not analysis and compare
the three channel coding techniques that this project discusses.

Another related work is presented in [2]. It focuses on OFDM system’s shortcomings in terms of
high peak to-average power ratio (PAPR) that causes nonlinear distortion in the transmitted
signal, degrading the performance of the system.

Many related works are carried out on OFDM and error correcting techniques like [3], which was
based on Digital Audio Broadcasting (DAB) system in which coded OFDM technology was used
in making the receivers highly robust against the channel multipath effects to accomplish the
demand of high quality sound services in mobile environment. The limitation of this work is that
specify on digital audio broadcasting services only.

In [4] the improvement in performance for OFDM modulation on aeronautical channel with the
addition of Convolutional Coding OFDM is envisioned for use on the Integrated Network
Enhanced Telemetry (INET) the limitation of this work is that, the use of Convolutional Coding
as forward error correction because Convolutional Coding is computationally intensive, it is not
successful at fixed error without interleaved, and the transmission include power that is equal to
the encryption speed.

Another work [5] focuses on ATM cell oriented data transmission. This method enables accurate
comparison of coding and interleaving techniques and optimization of OFDM system parameters.
Other related works include, [6] focuses on the effect of various concatenated forward error
correction (FEC) codes on the performance of a wireless OFDM system. The study is done on a
recorded audio signal under additive white Gaussian noise (AWGN) channel. The results show
that the audio message was received effectively under noisy channel conditions.

Semester Project Page 6


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Chapter Three
OFDM System and Error Correcting Techniques
3.1 Orthogonal Frequency Division Multiplexing (OFDM) Systems
Orthogonal Frequency Division Multiplexing is a special type of multicarrier modulation in
which a single data stream is transmitted over a number of lower rate subcarriers. In OFDM a
high rate bit-stream is split into N parallel bit streams of lower rate and each of them is
modulated using one of N orthogonal sub-carriers. OFDM increases the immunity against
frequency selective fading or narrowband interference. A single fade causes the entire link to fail
in a single carrier system, while only few subcarriers will be disturbed in multicarrier system like
OFDM. Error correction coding can then be used to correct those few errors.

In parallel data system such as OFDM, the frequency band is divided into N non-overlapping
frequency sub-channels. To eliminate inter-channel interference we avoid spectral overlap of
channels, which results in inefficient use of available spectrum. Realize the overlapping
multicarrier technique is needed to reduce the crosstalk between subcarriers, which demands
orthogonality between the different modulated carriers. Figure 3.1 shows a comparison of single
carriers, non-overlapping multicarrier and overlapping orthogonal multi carrier modulation. In a
normal frequency-division multiplex system, by using conventional filters and demodulators, the
signal can be received. Guard bands result in lowering of spectrum efficiency, which are
introduced between different carriers in frequency domain.

Figure 3. 1: Single carriers, multicarrier and orthogonal multi carrier modulation

Some of the main advantages of OFDM are its multi-path delay spread tolerance, robustness
against frequency selective fading and efficient spectral usage by allowing overlapping of two or

Semester Project Page 7


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

more signals in the frequency domain and its robustness against frequency selective fading.
Additionally, for an OFDM system, the modulation and demodulation can be done using IFFT
and FFT operations, which are computationally efficient.
3.1.1 Orthogonality of OFDM Signal
The technique of OFDM and FDM are similar except that in OFDM the N number of sub-carriers
are made orthogonal to each other over the symbol (frame) duration Ts . Carriers are orthogonal
when the carrier frequencies satisfy the following condition:

𝑓𝑘 = 𝑓𝑜 + 𝑘⁄𝑇𝑠 , 𝑘 = 1,2, … 𝑁 − 1 … … … … … … … … … … … … (3.1)

Signals are orthogonal if they are mutually independent of each other [10]. Orthogonality is a
property that allows multiple information signals to be transmitted perfectly over a common
channel and detected, without interference. The subcarriers in an OFDM signal are spaced as
close as is theoretically possible while maintain orthogonality between them. An OFDM system
with four subcarriers is shown in Figure 3.2.

Figure 3. 2: OFDM signal in frequency domain

OFDM achieves orthogonality in the frequency domain by allocating different subcarriers to


information signals. OFDM signals are made up from a sum of sinusoids, with each
corresponding to a subcarrier, these sub-carriers in some of the OFDM symbols may carry pilot
signals for measurement of the channel conditions. If any two different functions within the set
are multiplied, and integrated over a symbol period, the result is zero, for orthogonal functions.
Sets of functions are orthogonal to each other if they match the following conditions.

Semester Project Page 8


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

𝑇 𝑐, 𝑖 = 𝑗
∫0 𝑠𝑖 (𝑡) 𝑠𝑗 (𝑡)𝑑𝑡 = {0, 𝑖 ≠ 𝑗 , … … … … … … … … … (3.2)

3.2 Efficient Multi Carrier Modulation Techniques


To implement a system such as OFDM we need ‘N’ modulators and ‘N’ demodulators at the
transmitter and the receiver, respectively. This is a spectrally inefficient method to send data bits
in parallel we use a bank of oscillators with center frequencies spaced so that the channels do not
overlap. Bits are feed to a serial to parallel converter whose parallel output modulates the
individual carriers. In the receiver, filters tuned to each sub channel decode the bits transmitted in
each band. The bits, which exit the filters in parallel, pass through a parallel to serial converter to
reconstruct the transmitted bit stream.
3.2.1 Interpretation of FFT
The FFT is an essential operation in OFDM transmission and reception. By definition, we need N
orthogonal vectors to define an OFDM symbol. We denote the exponential used in Fourier
transform as 𝑊𝑁𝑘𝑛 , where
2𝜋𝑛𝑘
𝑊𝑁𝑘𝑛 = ℯ 𝑗 𝑁 ; 𝑛 = 0, 1, … , 𝑁 − 1 … … … … … … . (3.3)

When using these complex exponentials, orthogonality is achieved by fulfilling the condition

1, 𝑎=𝑏
∑ 𝑊𝑁𝑘𝑎 𝑊𝑁𝑘𝑏 = { 𝑎, 𝑏 = {0, 1, … , 𝑁 − 1} ⋯ ⋯ ⋯ (3.4)
0, 𝑎≠ 𝑏

Now, the FFT analysis equation is given as:


2𝜋𝑛𝑘
𝐹𝐹𝑇: 𝑋(𝑘) = ∑𝑁−1
0 𝑥[𝑛]ℯ −𝑗 𝑁 ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.5)

Similarly, the FFT synthesis equation is given as;


𝑁−1
1 2𝜋𝑛𝑘
𝐼𝐹𝐹𝑇: 𝑥(𝑛) = ∑ 𝑋[𝑘]ℯ 𝑗 𝑁 ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.6)
𝑁
0

3.2.2 OFDM Modulation Using IFFT

The OFDM transmitter operates on sets of M bits at a time where groups of nk bits modulate
subcarrier k, where k = 0, 1,…, N-1. In general, the number of bits assigned to each subcarrier
vary among the subcarriers. We must choose each nk such that ∑𝑁−1
0 𝑛𝑘 = 𝑀. If the transmitter

Semester Project Page 9


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

uses 16-QAM on each channel, then nk = 4, k= 0…N - 1 and M = 2N since each transmitted
symbol carries four bits worth of information.

When using a two-dimensional signal format, the transmitted point in the signal constellation for
subcarrier k (which codes nk bits) is written d[k] = x[k] + j y[k], where x[k]represents the in-
phase component and y[k] is the quadrature component. The subcarriers are spaced in frequency
at the symbol rate to keep them orthogonal. Hence, an OFDM symbol duration of T seconds
results in a subcarrier spacing of 1/T Hz. Longer symbol durations allow to pack the subcarriers
closer together in frequency.
We can describe the band pass continuous time transmitted waveform D(t) during one symbol
interval as:

⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.7)
1
Where 𝑓0 is the base frequency, ∆t the serial symbol duration,Δ𝑓 = 𝑁Δ𝑡 the subcarrier spacing

and 𝑓𝑘 = 𝑓𝑜 + 𝑘⁄𝑇𝑠 the frequency of the kth subcarrier. Note that the individual subcarriers are
1 1
separated by Δ𝑓 = 𝑁Δ𝑡 = 𝑇, the correct amount to keep them orthogonal. Finally, in to achieve

OFDM modulation and demodulation we use IFFT and FFT operations.


3.3 Designing of an OFDM System
The design of an OFDM system requires a trade-off between various parameters like in all
communication system designs. Usually, the input parameters to the design are the bit rate,
available bandwidth and the maximum delay spread introduced by the channel. The design
involves calculation of symbol duration, guard time, number of subcarriers, and the modulation
and coding schemes among other factors.
3.3.1 Guard Time and Cyclic Extension

OFDM is immune to multi-path delay spread, which causes Inter-symbol Interference (ISI) in
wireless networks. Making the symbol duration larger reduces the effect of delay spread. It is
done by converting high rate data signal into lower rate data signal. ISI is eliminated by the
introduction of guard time. This is done by making the guard time duration larger than that of the
estimated delay spread in the channel. If the guard period is left empty, the orthogonality of the
sub-carriers no longer holds, i.e., Inter Carrier Interference (ICI) comes into picture.

Semester Project Page 10


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

In order to eliminate both the ISI as well as the ICI, part of the OFDM symbol called ‘cyclic
prefix (CP)’ is cyclically extended into the guard period. The orthogonality of the sub-carriers is
preserved within the FFT interval so that delayed versions of OFDM always have an integer
number of samples. The cyclic prefix is a copy of the last part of the OFDM symbol which
should be presented to the transmitted symbol and removed at the receiver before demodulation
and which is used for avoids ISI and also maintain subcarriers orthogonality results there is no
inter carrier interference (ICI).

By setting the guard time larger than the delay spread and cyclically spreading the OFDM signal
into guard period we can eliminate ISI and ICI. The guard time is made longer than the maximum
delay spread introduced by the channel, since no information bits are transmitted during the guard
time the guard time cannot be made very large. The symbol duration must be fixed in such a way
that the overhead associated with the guard time is minimal.

Figure 3. 3: OFDM symbol time structure, cyclic prefix

3.3.2 Number of Sub-Carriers

Once the symbol duration is fixed, the spacing between the subcarriers can be obtained as the
inverse of the symbol duration minus the guard time. The number of the subcarriers can then be
calculated as the ratio of the available bandwidth to the carrier spacing.

3.3.3 Modulation and Coding Schemes

The decision of which modulation and coding technique to use depends on various issues. The
decision significantly overlaps with the design of the number of subcarriers discussed above and
usually a back-and-forth approach is followed. For example, if the number of bits that are to be
assigned to each subcarrier is known, then the modulation and coding for each subcarrier can be

Semester Project Page 11


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

designed based on this. On the other hand, if the modulation and coding schemes are specified,
then the number of subcarriers can be determined.

3.4 Channel Coding


Channel coding is basically from the class of signal transformations designed to improve the
communication performance by enabling the transmitted signal to better resist the effects of
various channel impairments such as noise fading and jamming. The goal of channel coding is to
improve the bit error rate (BER) performance of power limited and/or band limited channels by
adding redundancy to the transmitted data [12].
Error-correcting codes are a sequence of numbers generated by specific algorithms for detecting
and removing errors in data that has been transmitted over noisy channels. Error correcting codes
ascertain the exact number of bits that has been corrupted and the location of the corrupted bits,
within the limitations in algorithm.
Although most subcarriers may be detected without errors and the overall BER will be largely
dominated by a few subcarriers with the smallest amplitudes. Forward-error correction coding is
essential to avoid this domination by the weakest subcarriers. By using coding across the
subcarriers, errors of the weak subcarriers can be corrected up to a certain limit that depends on
the error control code and the channel. Channel codes are a very important component of any
modern digital communication system and are used to improve the performance of a
communication system when other means of improvement such as increasing transmitter power
or using a more sophisticated demodulator are impractical. Now let’s discuss about the channel
coding techniques of digital communication systems; among the channel coding techniques we
deal about linear block codes, convolutional codes and Reed Solomon codes in the following.
3.4.1 Linear Block Codes

Linear block code is a type of error-correcting code in which the actual information bits are
linearly combined with the parity check bits so as to generate a linear codeword that is
transmitted through the channel. In the linear block code technique, the complete message is
divided into blocks and these blocks are combined with redundant bits so as to deal with error
detection and correction.

In block coding, the complete message bits are divided into blocks where each block holds the
same number of bits. Suppose each block contains k bits, and each k bits of a block defines

Semester Project Page 12


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

a dataword. Hence, the overall datawords will be 2k. At this particular point, we have not
considered any redundancies, thus, we only have the actual message bitstream converted into
datawords.
Now, in order to perform encoding, the datawords are encoded as codewords having n number of
bits. We have recently discussed that a block has k bits and after encoding there will be n bits in
each block (of course, 𝑛 > 𝑘) and those n bits will be transmitted across the channel. While the
additional n-k bits are not the message bits as these are named as parity bits but during
transmission, the parity bits act as they are a part of message bits. So, structurally, a codeword is
represented as:

Figure 3. 4: Code word for linear block code

Hence, the possible codewords will be 2n out of which 2k contains datawords. During
transmission, if errors are introduced then most probably, the permissible codewords will be
changed into redundant words which can be detected as an error by the receiver.

A. Encoding

Designing a generator matrix is necessary to encode a linear block coding. To start with we can
designate {g0, g1... gk-1} as the basis vectors. It means that we can represent the coding
operation as matrix multiplication. We can make a generator matrix as

g0
g1
G=[ ⋮ ]
g N−1
G is a k × n matrix. If m = (𝐦𝟎 , 𝐦𝟏 , … , 𝐦𝐤−𝟏 ) is the input sequence of dimension 1 × k, the
corresponding output is the codeword c:

Semester Project Page 13


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

c = mG = m0 g 0 + m1 g1 + ⋯ + mk−1 g k−1 ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.8)

Note that the all-zero sequence must be a codeword and therefore the minimum distance of the
code is the codeword of smallest weight. We have a vector space of dimension k embedded in a
vector space of dimension n, the set of all n-tuples. Associated with every linear block code
generator G is a matrix H called the parity check matrix whose rows span the null space of G.
Then if c is a codeword, then cH T = 0.

It means a codeword is orthogonal to each row of H. We can also deduce that GH T = 0. This
code has a dual code in which H is the generator matrix. If G is the generator for an (n, k) code
then H is the generator for an (n, n-k) code.
When we want to do the encoding, it is often convenient to have the original data explicitly
evident in the codeword. Coding of this sort is called systematic encoding. For the codes we
considered that it will always be possible to determine a generator matrix in such a way the
encoding is systematic, simply perform row reductions and column reordering on G until an
identity matrix is revealed. We can thus write G as: G = [P|Ik ]
Where Ik is the k × k identity matrix and P is k × (n-k) matrix. When G is systematic, it is easy to
determine the parity check matrix H. It has the following form:
H = [In−k |P T ] ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.9)
The parity check matrix can be used to get some useful information about the code.
Following theorem holds for linear block codes. “Let a linear block code C has a parity check
matrix H. The minimum distance of C is equal to the smallest positive number of columns of H
which are linearly dependent.” On the receiver side let r be the vector, and syndrome is defined
as: s = rH T . If the received vector r is a codeword the syndrome s is equal to zero and if it is not
a codeword the syndrome is non-zero. If received vector is an erroneous codeword corrupted with
error vector then
r = c + e; s = (c + e)H T ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.10)
A relation between transmitted and received codeword is written in a way that, cR = cT + e. This
means that the received codeword must be necessarily equal to the summation of the actually
transmitted codeword and the error vector.

Semester Project Page 14


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

B. Decoding
To understand the process of decoding we start with the concept of maximum likelihood
detection.
I. Maximum likelihood detection
The concept of maximum likelihood detection is the basic to understand the process of decoding.
For a linear block code, an maximum likelihood decoder takes n received bits as input and returns
the most likely k-bit message among the 2𝑘 possible messages.
First let as introduce probabilistic criterion for decoding, and show that it is equivalent to finding
the closest codeword. Given a received vector r, the decision rule that minimizes the probability
of error is to find that codeword 𝑐𝑖 which maximizes p(c = ci |r). This is called the maximum
p(c)p(r|c)
aposteriori decision rule. p(c|r) = . Since p(r) is independent of c, maximizing p(c|r)
p(r)

is equivalent to maximizing the term p(c)p(r|c) .

Assuming that each codeword is chosen with equal probability, then maximizing p(c)p(r|c) is
equivalent to maximizing p(r|c). A codeword selected on the basis of maximizing p(r|c) is said
to be selected according to the maximum likelihood criterion.

We define p(r|c) as
n

p(r|c) = ∏ p(ri |ci ) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.11)


i=1

Assuming a binary symmetric channel with crossover probability p, we have

1 − p if ci = ri
p(ri |ci ) = { ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.12)
p if ci ≠ ri
Then
n
p d(c,r)
𝑝(r|c) = ∏ p(ri |ci ) = (1 − p)n−d(ri ≠ci) pd(ri ≠ci ) = (1 − p)n ( ) ⋯ ⋯ ⋯ (3.13)
1−p
i=1

This example shows that if we want to maximize p(r|c). then select c, which is closest to ,r
since 0 ≤ (p⁄(1 − p)) ≤ 1. Considering our assumption, now we can say that the maximum
likelihood criterion is the minimum distance criterion, so we should choose the error vector of
lowest weight.

Semester Project Page 15


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

II. The standard array and syndrome table decoding


Suppose a transmitter transmits a symbol c and receiver receives 𝑟 = 𝑐 + 𝑒. We assume that error
sequences with lower weight are more probable than error sequences with higher weight. We
want to determine our decoded word 𝑐 ′ such that the error sequence 𝑒 ′ satisfying 𝑟 = 𝑐 ′ + 𝑒 ′ has
minimum weight.
One possible way of doing this is to create a standard array. We form the standard array by
writing down all possible list of codewords in a row with all-zero codeword being the first term.
From the remaining n-tuples which have not already been used in the standard array, select one of
smallest weight. Write this down as the coset leader under the all-zero codeword. On this row,
add the coset leader to each codeword at the top of the column. Select another small weight from
the remaining and repeat the same step until all the n-tuples are filled in the standard array.
The standard array satisfies the following properties:
 There are 2𝑘 columns and 2n−k rows, therefore, an (n, k) code is capable of correcting
2n−k error patterns (the coset leaders).
 The difference of any two vectors in the same row is a codeword in C, all vectors in the
same row have the same syndrome.
 No two vectors in the same row are identical.
 Every vector appears exactly once in the standard array.
Let us construct the standard array for the (5 , 2) systematic code with generator matrix given by

The Standard Array of the (5 , 2) systematic code besed on the above properties

Figure 3. 5: Standard Array of the (5, 2) systematic code

Now, suppose that 𝑒𝑖 is a coset leader and that 𝑐𝑚 was the transmitted codeword. Then the error
pattern 𝑒𝑖 would result in the received sequence 𝑟 = 𝑐𝑚 + 𝑒𝑖 . The syndrome is 𝑠 = 𝑟𝐻 𝑇 =
(𝑐𝑚 + 𝑒𝑖 )𝐻 𝑇 = 𝑒𝑖 𝐻 𝑇 Clearly, all received sequences in the same coset have the same syndrome,

Semester Project Page 16


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

since the latter depends only on the error pattern. Furthermore, each coset has a different
syndrome. This means that there exists a one-to-one correspondence between cosets (or coset
leaders) and syndromes. Since each syndrome s corresponds to a single coset, the error sequence
𝑒𝑖 is simply the lowest member of the coset, i.e. the coset leader. Therefore, after the syndrome is
found, it is sufficient to find the coset leader corresponding to the syndrome and add the coset
leader to 𝑟 to obtain the most likely transmitted codeword. Syndromes and Coset Leaders of the
above example is shown as following.

Each pattern shown syndrome decoding table is a coset leader in standard array. We can
summarize the decoding steps as follows:
 Compute the syndrome, 𝑠 = 𝑟𝐻 𝑇
 Look up the error pattern e using s in the syndrome decoding table.
 Then calculate decoded codeword using 𝑐 = 𝑟 + 𝑒
 The first k bits of the decoded codeword are the message signal.

3.4.2 Convolutional Codes


In block codes, the data comprises of a block of data of a definite length. However, in
convolutional codes, the input data bits are not divided into block but are instead fed as streams
of data bits, which convolve to output bits based upon the logic function of the encoder. Also,
unlike block codes, where the output codeword is dependent only on the present inputs, in
convolutional codes, output stream depends not only the present input bits but also only previous
input bits stored in memory.

Convolutional codes are different from the block codes since in convolutional coding the
information sequences are not grouped into distinct blocks and encoded so a continuous sequence
of information bits is mapped into a continuous sequence of encoder output bits. Convolutional
coding can achieve a larger coding gain than can be achieved using a block coding with the same
code rate [12]. Convolutional codes have their popularity due to good performance and flexibility
to achieve different coding rates.

Semester Project Page 17


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

An important characteristic of convolutional codes is that the encoder has memory. That is the n-
tuple output generated by the encoder is a function of not only the input k-tuple but also the
previous N-1 input k-tuples. The integer N is called the constraint length. The convolutional code
is generated by passing the information sequence through a finite state shift register. In general,
the shift register contains N stages and m linear algebraic function generators based on the
generator polynomials. The input data k bits is shifted into and along the shift register. The
number of output bits for each k input bits is n bits. The code rate is given as 𝑅 = 𝑘⁄𝑛.

Figure 3. 6: Convolutional encoder with length 7 & rate ½.

The function of the decoder is to estimate the encoded input information using a rule or method
that results in the minimum possible number of errors. There are a number of techniques for
decoding convolutional codes. The algorithms vary in complexity and performance. More
complexity means better performance. The most important of these methods is the Viterbi
algorithm, which performs the maximum likelihood decoding. The Viterbi algorithm uses trellis
diagrams to estimate the optimum path.

Figure 3. 7: Block diagram convolution encoder and viterbi decoder

A. Encoding
A convolutional code encoder accepts message bits as a continuous sequence and thereby
generates a continuous sequence of encoded bits. Additive white Gaussian noise (AWGN)

Semester Project Page 18


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

corrupts the signal that is transmitted. By using the convolutional channel coding significant
improvement in SNR can be achieved. Shift registers are used to perform modulo two additions
and combinational logic convolutionally encodes the data. (Chain of flip-flops is usually a shift
register where nth output of flip-flop is the input of the (𝑛 + 1)𝑡ℎ flip-flop. The data is shifted one
stage when the active edge of clock occurs). Convolutional encoder have the two basic
components (flip-flops comprising the shift register and XOR gates comprising the associated
modulo-two adders) defined.

For generating a convolutional code, the information is passed sequentially through a linear
finite-state shift register. The shift register comprises of (bit) stages and Boolean function
generators. A convolutional code can be represented as (n, k, K) where: k is the number of bits
shifted into the encoder at one time. Generally, k = 1. n is the number of encoder output bits
corresponding to k information bits. The code-rate, R c = k⁄n. The encoder memory, a shift
register of size k, is the constraint length. n is a function of the present input bits and the contents
of K. The state of the encoder is given by the value of (K - 1) bits.

The generator polynomials for the convolutional encoder can be defined as: c0 = (1 1 1)2= (7)8 ,
c1 = (1 0 1)2= (5)8. From this we conclude that the output of the convolutional encoder is
dependent on generator function.

Figure 3. 8: convolutional encoder with k = 1, n = 2 and K = 3.

B. Viterbi Decoding
A Viterbi decoder employs the Viterbi algorithm for decoding a bit stream as counter part of
forward error correction based on a convolutional code. The process of distinguishing original
data from the corrupted received one can be done using the diagram called "trellis". Decoder
examines the whole received sequence and suitable path with the smallest hamming distance is

Semester Project Page 19


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

discovered. Amongst various survival paths, the Viterbi algorithm utilizes maximum likelihood
principle to limit the differentiation.
Viterbi algorithm is used to decoding a bit stream that has been encoded using FEC code. Viterbi
algorithm can be explained by a trellis diagram it requires which comprises of minimum path and
minimum distance calculation and retracing the path. Figure 3.9 shows the block diagram of the
Viterbi decoder [12].
It consists of following blocks
a. Branch Metric Unit (BMU)
b. Path Metric Calculation
c. Add Compare and Select Unit (ACS)
d. Trace Back Unit (TBU)

Figure 3. 9: Block diagram of the Viterbi decoder

From the encoder output through the channel the BMU receives input data and computes a metric
for each state and each input bit. There are two types of methods to calculate the metric. The
metric which is used to calculate the Hard-decision encoded data is the Hamming distance and
the metric is the Euclidian distance for Soft-decision encoded data. The metric is calculated for
the entire path. The ACS unit is based on minimum distance calculations that are obtained from
the previous row values. The Trace-back unit restore maximum likelihood path from the
decisions made by BMU. This is the final stage of the Viterbi decoder where the input that was
transmitted by using the convolution encoder is once again retrieved.
3.4.3 Reed-Solomon Codes
These error correcting techniques are block-based and are used to correct errors in various
systems including storage devices, wireless or mobile communications, satellite communications
etc. The mechanism by which Reed-Solomon codes correct errors is that the encoder adds
redundant bits to the digital input data block. The decoder attempts to correct and restore the

Semester Project Page 20


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

original data by removing the errors that are introduced in transmission, due to many reasons that
might be the noise in the channel or the scratches on a CD. There are different families of Reed-
Solomon codes and each has its own abilities to correct the number and type of errors.
These codes are linear and a subsection of BCH codes [10] and can be denoted as RS(n,k) with s-
bit (where s are symbols represented as a bit) symbols. An n-symbol codeword is made by the k
data symbols of s bits each and the encoder adds parity bits. Errors in a codeword can be
corrected by the decoder up to 𝑡 symbols, where 2𝑡 = 𝑛 − 𝑘.
Generator Polynomial of Reed Solomon Code
In coding systems with block codes, valid code words consists of polynomials that are divisible
by another fixed polynomial of short length. This fixed polynomial is called generator
polynomial.

In Reed Solomon code, generator polynomial with factors is constructed where each root is a
consecutive element in the Galois field. The polynomial is of the form g(x) = (x - α) (x - α2) (x -
α3) ......(x - α2t) where α is a primitive element.

A. Encoding
To start an encoding process one needs to define the message polynomial. For a Reed-Solomon
[n, k] code, k information symbols form the message that is encoded as one block and can be
represented by the message polynomial m(x). This message polynomial m(x) is then of order
k−1,
m(x) = mk−1xk−1 + · · · + m1x + m0 ⋯ ⋯ ⋯ (3.14)
Reed-Solomon (RS) codes in terms of the parameters n, k, t, and any positive integer m>2;
(𝑛, 𝑘) = (2𝑚 − 1, 2𝑚 − 1 − 2𝑡) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.15)
Where n - k = 2t is the number of parity symbols, and t is the symbol-error correcting capability
of the code. The generating polynomial for an RS code takes the following form
𝑔(𝑋) = 𝑔0 + 𝑔1 𝑋 + 𝑔2 𝑋 + ⋯ + 𝑔2𝑡−1 𝑋 2𝑡−1 + 𝑋 2𝑡 . The degree of the generator polynomial is equal
to the number of parity symbols. RS codes are a subset of the Bose, Chaudhuri, and
Hocquenghem (BCH) codes. This relationship between the degree of the generator polynomial
and the number of parity symbols holds, just as for BCH codes. Since the generator polynomial is
of degree 2t, there must be precisely 2t successive powers of α that are roots of the polynomial.

Semester Project Page 21


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

We designate the roots of g(X) as α, α2, …, α2t. It is not necessary to start with the root α, starting
with any power of α is possible.
Consider as an example the (7, 3) double-symbol-error correcting RS code. We describe the
generator polynomial in terms of its 2t = n - k = 4 roots, as follows:
⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.17)
Reed-Solomon codes are cyclic codes, encoding in systematic form is analogous to the binary
encoding procedure. It can be related to shifting a message polynomial m(X) into the rightmost k
stages of a codeword register and then appending a parity polynomial, p(X), by placing it in the
leftmost n - k stages. Therefore we multiply m(X) by Xn-k, and by handling the message
polynomial algebraically so that it is right-shifted n-k positions. Next step is dividing Xn-k m(X)
by the generator polynomial g(X), which is written in the following form:
X n−k m(X) = q(X)g(X) + p(X) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.18)
where 𝑞(𝑋)and 𝑝(𝑋)are quotient and remainder polynomials respectively and the remainder
𝑝(𝑋) can be expressed as:
p(X) = X n−k m(X) ⊕ g(X) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (3.19) .

The resulting codeword polynomial, 𝑈(𝑋) can be written as: U(X) = p(X) + X n−k m(X). A valid
codeword is of the following form:

U(X) = g(X)m(X) … … … … … … … … … … … … … (3.20)


When the codeword is evaluated at any root of generator polynomial g(X), it should produce
zero.
B. Decoding
Reed-Solomon algebraic decoding procedures can correct errors within its error correcting
capability. A decoder can correct up to 𝑡 errors. When a codeword is decoded and the errors are
not more than the error correcting capability limit, then the original transmitted code word will
always be recovered. If this is not the case then there are two possibilities:
 The decoder will detect that it cannot recover the original code word and indicate this fact.
 The decoder will miss-decode and recover an incorrect code word without any indication.
The probability of any possibilities depends on the particular Reed-Solomon code and on the
number and distribution of errors. If there is an erroneous transmission, received corrupted

Semester Project Page 22


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

codeword polynomial r(X) is then represented by the sum of the transmitted-codeword


polynomial and the error-pattern polynomial that is r(X) = U(X) + e(X)
An important difference between the nonbinary decoding of r(X) and binary decoding is that in
binary decoding the decoder only needs to find the error locations. In binary decoding the error
location value is just flipped because it is either 0 or 1. While dealing with nonbinary symbols
like in this case we not only learn the error location but also determine the correct symbol values
at those locations.
Syndrome Decoding

The syndrome is the result of a parity check performed on r to determine whether r is a valid
member of the codeword set. We get the value 0 by the syndrome S, If r is a member of
codeword set. Any nonzero value of S indicates the presence of errors. Similar to the binary case,
the syndrome S is made up of n - k symbols, {Si} (i = 1, … ,n - k).

From equation (3.20) the root of the generator polynomial is the root of codeword polynomial.
We know that r(X) = U(X) + e(X) for a valid codeword r(X) become zero when evaluated at
the roots of the generator polynomial g(X); if not there is an error. The computation of a
syndrome symbol can be described as:

Si = r(X)|X=ai = r(ai ); i = 1,2, … , n − k

Each syndrome symbol Si will be equal to 0 if r(X) is a valid codeword. The syndrome value will
be same if it is obtained by evaluating e(X) or r(X) at the roots of g(X).
3.5 Common Uses and Error detection and correction capabilities
Linear block codes are commonly used in digital communication systems and data storage
systems. Similarly dmin is an important parameter to know the error correction capability of linear
block code. Erroneous codewords are at least a distance dmin away from the transmitted
𝑑𝑚𝑖𝑛 −1
codeword. If any error pattern of weight occurs, the Hamming distance between the
2

received vector and the transmitted codeword is less than the distance between the received
vector and other codewords. A linear block code with minimum distance d min can correct all error
𝑑𝑚𝑖𝑛 −1
patterns of weight less than or equal to denoted by t which is called the error-correction
2

capability of a code with minimum distance dmin. It is the upper bound on the weights of all error
patterns for which one can correct.

Semester Project Page 23


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Convolutional codes are used in digital video, mobile and satellite communication. In
Convolution codes it is difficult to tell the error correction capability due to its convolutional
structure.
Reed Solomon codes are used in CDs, DVDs and other applications are DSL, WiMAX, computer
applications. A Reed-Solomon decoder can detect d errors where𝑑 = 𝑛 − 𝑘 + 1 and can correct
up to 𝑑⁄2 errors [13].

3.6 Error Correcting Techniques Evaluation

Our main target was to test orthogonal frequency division multiplexing systems for channel
coding and evaluate the performance based on the improvement in BER. In this chapter we have
discussed the way this research was carried out and its implementation technique.

3.6.1 Implementation
From the building blocks of an orthogonal frequency division multiplexing system the channel
encoder and the channel decoder part will be discussed. Let as discuss a little about the building
block of orthogonal frequency division multiplexing system.

A. OFDM Transmitter: The OFDM transmitter includes the followings


1) QPSK modulation
2) Pilot Insertion.
3) IFFT modulation.
4) Cyclic Prefix addition.
QPSK modulation uses 4 distinct phased signals and is assigned to each two bit data. It is done
using two MATLAB functions ‘modem.pskmod()’ and ‘modulate function’ ‘modem.pskmod()’
generates a PSK modulator object which is used by ‘modulate()’ function to modulate the data
stream and which is used to provides high performance on bandwidth efficiency and bit error
rate. Pilot Insertion is done for the measurement of channel condition. In our work it is done by
adding zeros in the 12 unused channels out of the 64 channels of OFDM. Even if Discrete Fourier
Transform uses for the parallel transmission of data using frequency division multiplexing, we
used IFFT for the multiplexing of data for orthogonal frequency division multiplexing system.
Cyclic prefix addition is the prefixing of a symbol with repetition at the end. It acts as a guard
interval to eliminate the inter symbol interference from the previous symbol.

Semester Project Page 24


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

B. OFDM Receiver : which includes the followings:


1) Cyclic prefix removal.
2) FFT demodulation.
3) Pilot removal.
4) QPSK demodulation.

All modules in reverse order to the transmitter and do exactly the opposite job done by their
counterpart in the transmitter. But before all these parts, noise is added to the signal as per SNR
and there is a channel equalization part to counter the effects of channel fading that occurred in
the channel. The rest modules do the revers function of in the respect transmission function. To
perform QPSK demodulation we can use ‘modem.pskdemod()’ and ‘demodulate() functions.
3.6.2 MATLAB Function for the Three Error Correcting Techniques
A. Linear Block Coding
We used MATLAB function ‘encode()’ that includes linear block codes. We need to provide the
message length k, codeword length n and generator matrix for computing the codeword. The
encoder and decoder for linear block coding are given in appendix A
B. Convolutional Coding
The MATLAB function ‘poly2trellis()’ is used for computing the trellis from the polynomial and
‘convenc()’ is the convolutional encoder. At the decoder side the function ‘poly2trellis()’ is used
once again for the same purpose. After that Viterbi decoding is used for the convolutional
decoding. ‘vitdec()’ function is used and hard decoding is applied on the coded data. The encoder
and decoder function for convolutional code are given in appendix B.
C. Reed-Solomon Coding
For Reed-Solomon encoding we made some changes to the binary data. We first converted the
binary data to decimal symbols required to the Reed-Solomon encoder. ‘fec.rsenc()’ function is
used for generating Reed-Solomon encoder and ‘encode()’ function is used to encode the data.
The data after encoding is once again changed to binary. The Reed-Solomon encoder and decoder
functions are given in appendix C.
At the decoder side the data is once again converted from binary data to decimal symbols.
Function ‘fec.rsdec()’ is used for Reed-Solomon decoder and ‘decode()’ function is used to
decode the data. After that the data is once again converted to binary.

Semester Project Page 25


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Chapter Four
Simulation Result and Discussion
This chapter discusses the results of simulations performed to investigate the performance of the
considered error control codes for OFDM systems. On the basis of simulations we have tried to
explain the results and discussed the reasons leading to such results. Error performance analysis
is performed by plotting the bit error-rate versus signal to noise ratio for AWGN. Simulations
were run for different codes.
4.1 Simulation Setup
The necessary conditions that are the same for all the simulations i.e. the input data, the fading
channel and the noise is once generated and saved. The input data is kept same for testing of all
coding schemes. The total number of carriers chosen in our OFDM system is 64 and used is 52.
Eb/No is useful when comparing BER in digital modulation schemes without taking the
bandwidth into account. Rayleigh fading channel is once generated and saved. The same fading is
used for all the simulations. The fading is defined by the following MATLAB equation [14]:

rayleigh = sqrt (0.5 ∗ (randn(N, 1) + i ∗ randn(N, 1))) ----------------------(4.1)

Where ‘randn()’ generates values from the standard normal distribution function and ‘N’ defines
the length of fading signal.
The random noise is generated using the ‘randn()’ function and is also generated once and saved.
It is recalled in the receiver section and its power is adjusted according to the given Eb/No, after
that it is added to the received signal. This way same AWGN is added to the data for all the
simulations. Same fading and AWGN helps to get the same error patterns for all the coding
techniques.
The final Eb/No changes due to the following reasons:
1. The number of bits after channel coding is more than number of bits before, so it causes
decrease in Eb/No.
2. The number of modulated symbols is less than the total number of bits and this increases the
value of Eb/No. In our case QPSK was used, which means two bits now make one modulated
signal and total four types of modulated signals are there.
3. There are total 64 OFDM carriers in our simulation out of which 52 are used. The unused
carriers cause decrease in the effective Eb/No.

Semester Project Page 26


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

4. After cyclic prefix addition there are 16 bits that are repeated in the start of each symbol, so
now in each symbol the bits are increased from 64 to 80. This also decreases the value of
Eb/No.
Eb Eb
(adjusted) = + 10 log10 (code rate) + 10 log10 (log 2 M) +
No No
data rate
10 log10 (data rate+pilot bits+carrier bits) ------------------------------(4.2)

4.2 Results for Linear Block Codes


The simulation is done for code rates of 1/3, 1/2 and 2/3. The generator matrices used for the
code were:
100000110
01000001 1
100101
101010 001000101
𝐺1 = [ ], 𝐺1 = [0 1 0 1 1 0], 𝐺2 =
3 0 1 0 1 1 1 2 3 000100111
001111
000010001
[0 0 0 0 0 1 1 0 0]
The first generator matrix takes two bits as input and outputs six bits (i.e. (k, n) = (2,6)) so the
code rate becomes 1/3. Same is the case with other two generators to get desired code rate. These
generators are selected as simplest possible generator matrices. The results of Linear block codes
for all the three code rates are shown in Figure 4.1.

0
Bit error probability curve using Linear Block Coding and OFDM
10
Coderate=1/3
Coderate=1/2
Coderate=2/3
Uncoded OFDM
-1
10
BER

-2
10

-3
10

-4
10
-5 0 5 10 15 20
Eb/No

Figure 4. 1: BER for Linear Block Codes with different code rates

Semester Project Page 27


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

From the BER vs Eb/No graph in figure 4.1 it is possible to discuss at which code rate the linear
block code is efficient. When we compare bite error rates linear block coding at specified signal
to noise ratio; bit error rate of the coding at Rc1/3 less than to the others code rate and also the to
the uncoded channel. BER at Rc1/3 < BER at Rc1/2 < BER at Rc2/3 < BER of the uncoded. Then
from different code error rates we checked in this project, at Rc1/3 the linear block code is
efficient.
4.3 Results of Convolutional Codes
For convolutional coding we also used code rates of 1/3, 1/2 and 2/3. The three convolutional
encoders are shown below by generator polynomials. For code rate 1/3 the constraint length K is
3, one input bit and output bits are defined as:

Output 1 = (1 1 1)2= (7)8

Output 2 = (0 1 1)2= (3)8

Output 3 = (1 0 1)2= (5)8

MATLAB parameters can be defined as constraint length = [3], generator = [7 3 5]. For code rate
1/2 the constraint length K is 3, one input bit and output bits are defined as:
Output 1 = (1 1 1)2= (7)8
Output 2 = (1 0 1)2= (5)8
MATLAB parameters can be defined as constraint length = [3], generator = [7 5]. For code rate
2/3 the constraint length K is 3, two input bits and output bits are defined as:
Output 1 = (1 1 1)2 and (0 0 0)2= (7)8 and (0)8
Output 2 = (1 0 1)2 and (0 0 1)2= (5)8 and (1)8
Output 3 = (0 1 1)2 and (1 1 0)2= (3)8 and (6)8
MATLAB parameters can be defined as constraint length = [3, 3], generator = [7 5 3, 0 1 6]. The
results of the convolutional block coding with OFDM are shown in Figure 4.2.

Semester Project Page 28


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

0
Bit error probability curve using Convolutional Coding and OFDM
10
Uncoded OFDM
Code rate=1/3
Code rate=1/2
Code rate=2/3
-1
10

-2
10
BER

-3
10

-4
10

-5
10
-5 0 5 10 15 20
Eb/No

Figure 4. 2: BER for Convolutional Codes with different code rates

Analyzing BER vs Eb/No of the graph shown in figure 4.2; it is possible to discuss at which code
rate the linear block code is efficient. Convolutional code has better performance at 1/3 code
rate. Since when we see the BER at a specified signal to power ratio the bite error rate at Rc 1/3
<BER at Rc ½ < BER at Rc 2/3. From this we conclude that convolutional coding has efficient
performance at code rate 1/3 than the other assumed code rates in this project.
4.3 Results of Reed-Solomon Codes
The code rates of 1/3, 1/2 and 2/3 were also used for testing Reed-Solomon encoder of symbol
length 4 bits. The codes used were (15, 5) for code rate 1/3, (15, 7) for code rate ½
(approximately) and (15, 10) for code rate 2/3. The results of Reed-Solomon coding with OFDM
are shown in Figure 4.3.

Semester Project Page 29


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

0
Bit error probability curve using RS Block Coding and OFDM
10
BER Uncoded OFDM
Code rate=2/3
Code rate=1/2
Code rate=1/3

-1
10
BER

-2
10

-3
10

-4
10
-5 0 5 10 15 20
Eb/No

Figure 4. 3: BER for Reed-Solomon Codes with different code rates

From figure 4.3 above we can analyze BER vs Eb/No performance of Reed Solomon codes at
different code rate. As we can see from the graph, Reed Solomon code has best performance at
code rate of 1/3 that means when we encoding five bite data into fifteen bite of a block code.
When we compare bite error rate of the channel coding at different code rate within a specified
signal to noise ratio; BER at Rc1/3 < BER at Rc1/2 < BER at Rc2/3. So from the tested code rates
Reed Solomon code has best performance at one third code rate
4.4 Comparison of the Three Coding Schemes

After evaluating each technique for different code rates we will now compare all techniques for
same code rates.

Semester Project Page 30


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

0
Comparison of uncoded OFDM and three coding schemes for code rate 1/3
10
Uncoded OFDM
Convolutional code
Linear block code
Reed Solomon code
-1
10
BER

-2
10

-3
10

-4
10
-5 0 5 10 15 20
Eb/No

Figure 4. 4: Comparison of uncoded OFDM and three coding schemes Rc1/3.

The comparisons of the three channel coding (i.e. linear block code, convolutional code and reed
Solomon code) are shown in figure 4.4 at code rate Rc =1/3. Figure 4.4 shows that Convolutional
code has the best performance at a specified signal to noise ratio (Eb/No). For example at 5dB
signal to noise ratio we can compare the bite error rate of linear block code, convolutional code
and reed Solomon codes.
The bite error rate of convolutional code is less than Reed Solomon less than linear block code
less than the uncoded channel. The improvement of RS code is almost the same as Convolutional
code while Linear Block code showed less improvement. The codes start with the best BER for
Convolutional at 0 dB among the three and all the codes tends to improve its performance as the
Eb/No increases. Overall we see that Convolutional codes show best performance.

Semester Project Page 31


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

0
Comparison of uncoded OFDM and three coding schemes at Rc = 1/2
10
Uncoded OFDM
Convolutional code
Linear block code
-1
10 Reed Solomon code

-2
10
BER

-3
10

-4
10

-5
10
-5 0 5 10 15 20
Eb/No

Figure 4. 5: Comparison of uncoded OFDM and three coding schemes for code rate ½

In Figure 4.5 we have a code rate of 1/2 and here we see that performance of linear block again
shows the same low performance compared to the other two techniques. The RS code and
convolutional code start performing better at a higher SNR as compared to that their performance
for code rate of 1/3. The RS code performs the best among all with a SNR improvement. The
performance of convolutional is also better than linear block codes.

So at half code rate (i.e. Rc1/2) the performance of reed Solomon code is good than the others.
The overall performance comparison of the three channel coding techniques are: Performance of
Reed Solomon is greater than convolutional code greater than linear block code.

Semester Project Page 32


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

0
Comparison of uncoded OFDM and three coding schemes at Rc = 2/3
10
Uncoded OFDM
Convolutional code
-1 Linear block code
10
Reed Solomon code

-2
10
BER

-3
10

-4
10

-5
10
-2 0 2 4 6 8 10 12 14 16 18
Eb/No

Figure 4. 6: Comparison of uncoded OFDM and three coding schemes for code rate 2/3
In Figure 4.6 the code rate was 2/3. The performance of linear block code is almost the same
compared to other two techniques, but at a small signal to noise ratio the performance of linear
block code is relatively similar to that of reed Solomon. As the Eb/No increase further the
performance of reed Solomon is increased but not for linear block code.
The performance of convolutional code is also good and close but RS shows consistency in its
performance and performed well than others at high code rates. The performance of
convolutional code is being improved dramatically and at higher Eb/No the performance of Reed
Solomon and convolutional coding are nearly similar. Generally at code rate of 2/3, Reed
Solomon code has best performance than the other channel coding techniques we considered in
this project.

Semester Project Page 33


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Table 4. 1: Performance comparison different channel coding techniques

Types of channel coding Comparison of channel coding techniques at different


code rate (Rc)

At Rc=1/3 At Rc=1/2 At Rc=2/3

Linear block code Low Low Low

Convolutional code High Intermediate Intermediate

Reed Solomon code Intermediate High High

Semester Project Page 34


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Chapter Five
Conclusion and Recommendations for Future Work

5.1 Conclusion
In this project work the types of channel coding techniques used depend on the code rate. The
performance of a certain channel coding techniques are different at different code rate. In this
work it is found that Convolutional codes are good in performance at lower code rates but due to
complex decoding structure they are difficult to implement. Linear block codes are very simple to
implement. Linear block code a good channel coding technique at lower code rates and highly
suitable for application with less complexity requirement and not so high performance
requirement.

Reed-Solomon codes in comparison to linear block codes are difficult to implement but their
performance is much better and consistent than linear block codes since they can handle long
bursts of errors. These codes showed good performance on all three tested code rates.

Lastly the performance of Reed Solomon code is better than the other two channel coding types.
Even if the complexity of implementation compered to linear block code it has an efficient
performance than linear block code and convolutional coding.
5.2 Future Work
The work of this project is done at a specified generator matrix and the transmitted data through a
channel is generated randomly. So when any one wants to do a project in this title do model a
channel coding that works on any random generator matrix.

The future work on this title must will do on other channel coding types rather than we discussed
in this project.

Semester Project Page 35


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Reference

[1] Ritika Kondal, Ravikant Sharma, Dr. Abhay Sharma “Performance Evaluation of OFDM
System-A Simulation Study” International Journal of Engineering Research & Technology
(IJERT), India, 2013

[2] M. R. Dey and M. S. Islam, “Performance Analysis of PAPR reduction for OFDM-BPSK,-
QPSK and -QAM using Forward Error Correcting Code”, 7th International Conference on
Electrical and Computer Engineering Dhaka.

[3] Arun Agarwal and S.K. Patra, “Performance Prediction of OFDM based DAB System using
Block coding technique”, Proceedings of ICETECT, India, 2011.

[4] Sileshi boru and Diptasree maitra “Performance analysis of INET using forward error
correction and OFDM” morgan state university

[5] Klaus Witrisal, Yong-Ha Kim, and Ramjee Prasad, “A Novel Approach for Performance
Evaluation of OFDM with Error Correction Coding and Interleaving”, Centre for Wireless
Personal Communications (CEWPC), IRCTR Delft University of Technology.

[6] Md. Dulal Haque, Shaikh Enayet Ullah, and Md.Razu Ahmed, “Performance evaluation of a
wireless Orthogonal Frequency Division Multiplexing system under various concatenated
FEC channel-coding schemes”, Proceedings of 11th International Conference on Computer
and Information Technology ICCIT.

[7] Website: http://science.opposingviews.com/advantages wireless communication.html.


Accessed date: June 21

[8] Y. Xiao, “Orthogonal Frequency Division Multiplexing Modulation and inter-carrier


interference cancellation” Louisiana State University.

[9] Bahai, A., and B. Saltzberg. “Multicarrier Digital Communications: Theory and Applications
of OFDM”. New York: Kluwer Academic/Plenum Publishers, 1999.

[10] A. Bovik: “The Essential guide to Image processing”, LondonWC1X 8RR, UK

[11] H. E. H. Ahmed, I. F. Elashry, M. H. Shaheen,"Image Encryption: A Communication


Perspective", CRC Press, 2010.

Semester Project Page 36


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

[12] Blahut, R. E, “Theory and Practice of Error Control Codes” (Reading, MA: Addison-
Wesley, 1983).

[13] HeauJo Kang, “Analysis of OFDM System using Adaptive FEC Code Control Technique for
Mobile Wireless Communication”, International Conference on Intelligent Pervasive
Computing, Korea, 2007

[14] Kanchana Katta “Design of Convolutional Encoder and Viterbi Decoder using MATLAB”,
New York: Kluwer Academic/Plenum Publishers, 1999.

Semester Project Page 37


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Appendices
Appendix A: Main Code for Linear Block Codes
clc; close all; clear all;
%Parameters
nbitpersym = 52; % number of bits per OFDM symbol (same as the number of subcarriers for
BPSK)
%nsym = 13500; % number of symbols
len_fft = 64; % fft size
sub_car = 52; % number of data subcarriers
EbNo = 0:16;
% Channel Coding setting
%For code rate = 1/3
n1=6; k1=2;
genmat_13 = [eye(2) [1 0 1 0;0 1 1 1]];
% %For code rate = 1/2
n2=6; k2=3;
genmat_12 = [1 0 0 1 0 1;0 1 0 1 1 0 ;0 0 1 1 1 1];
%For code rate = 2/3
n3=9; k3=6;
genmat_23 = [eye(6),[1 1 0; 0 1 1; 1 0 1; 1 1 1; 0 0 1; 1 0 0]];
% Data generation
load InputData.mat;
% Channel Coding
[t_data11] = LBlock_Encoder( t_data2,n1,k1,genmat_13 );
[t_data12] = LBlock_Encoder( t_data2,n2,k2,genmat_12 );
[t_data23] = LBlock_Encoder( t_data2,n3,k3,genmat_23 );
%OFDM Transmitter
nsym1 = length(t_data11)/104;
nsym2 = length(t_data12)/104;
nsym3 = length(t_data23)/104;
%[ser_data] = OFDM_transmitter(t_data1,nbitpersym,nsym); % ser_data is transmitted data
data_bits11=bi2de([reshape(t_data11,2, length(t_data11)/2)]');
data_bits12=bi2de([reshape(t_data12,2, length(t_data12)/2)]');
data_bits13=bi2de([reshape(t_data23,2, length(t_data23)/2)]');
M= modem.pskmod('M', 4, 'PHASEOFFSET', pi/4, 'SYMBOLORDER', 'GRAY'); % QPSK
Modulator with offset of pi/4 radian and gray code order

mod_data11 = modulate(M,data_bits11); % Modulating data


mod_data12 = modulate(M,data_bits12);
mod_data13 = modulate(M,data_bits13);

par_data1 = reshape(mod_data11,nbitpersym,nsym1).';
par_data2 = reshape(mod_data12,nbitpersym,nsym2).';
par_data3 = reshape(mod_data13,nbitpersym,nsym3).';

Semester Project Page 38


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

pilot_ins_data11=[zeros(nsym1,6) par_data1(:,1:nbitpersym/2) zeros(nsym1,1)


par_data1(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym1,5)] ;
pilot_ins_data12=[zeros(nsym2,6) par_data2(:,1:nbitpersym/2) zeros(nsym2,1)
par_data2(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym2,5)] ;
pilot_ins_data13=[zeros(nsym3,6) par_data3(:,1:nbitpersym/2) zeros(nsym3,1)
par_data3(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym3,5)] ;
IFFT_data1 = (64/sqrt(52))*ifft(fftshift(pilot_ins_data11.')).';
IFFT_data2 = (64/sqrt(52))*ifft(fftshift(pilot_ins_data12.')).';
IFFT_data3 = (64/sqrt(52))*ifft(fftshift(pilot_ins_data13.')).';
% addition cyclic prefix
cylic_add_data1 = [IFFT_data1(:,[49:64]) IFFT_data1].';
cylic_add_data2 = [IFFT_data2(:,[49:64]) IFFT_data2].';
cylic_add_data3 = [IFFT_data3(:,[49:64]) IFFT_data3].';

% parallel to serial coversion


ser_data1 = reshape(cylic_add_data1,80*nsym1,1);
ser_data2 = reshape(cylic_add_data2,80*nsym2,1);
ser_data3 = reshape(cylic_add_data3,80*nsym3,1);

% Passing through channel, applying fading.


load fading.mat; % using fixed(once generated and saved)fading data for all simulation
%fading = fading(1:size(ser_data)); % Fading signal length adjusted to match passing signal
size11=size(ser_data1);
size12=size(ser_data2);
size13=size(ser_data3);
fading1 = sqrt(0.5*(randn(size11) + 1i*randn(size11))); % Fading channel
fading2 = sqrt(0.5*(randn(size12) + 1i*randn(size12))); % Fading channel
fading3 = sqrt(0.5*(randn(size13) + 1i*randn(size13))); % Fading channel
chan_data1 = fading1.*ser_data1; % Applying Channel Fading
chan_data2 = fading2.*ser_data2; % Applying Channel Fading
chan_data3 = fading3.*ser_data3; % Applying Channel Fading

% Reciever end
no_of_error=[];
LB_BER=[];
for ii=1:length(EbNo)
ii
% OFDM Reciever
sigp_dB1 = 10*log10(norm(chan_data1,2)^2/numel(chan_data1)); % Signal Power in dB
sigp_dB2 = 10*log10(norm(chan_data2,2)^2/numel(chan_data2)); % Signal Power in dB
sigp_dB3 = 10*log10(norm(chan_data3,2)^2/numel(chan_data3)); % Signal Power in dB
noisep_dB1 = sigp_dB1-EbNo(ii); % Noise Power in dB
noisep_dB2 = sigp_dB2-EbNo(ii); % Noise Power in dB
noisep_dB3 = sigp_dB3-EbNo(ii); % Noise Power in dB
noisep1 = 10^(noisep_dB1/10); %Noise Poise in linear scale
noisep2 = 10^(noisep_dB2/10); %Noise Poise in linear scale

Semester Project Page 39


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

noisep3 = 10^(noisep_dB3/10); %Noise Poise in linear scale


load noise1.mat; % using fixed(once generated and saved)noise for all simulation
% Noise*standard deviation to achieve SNR, length is adjusted according to
% singal length
% noise = sqrt(noisep)*noise(1:length(chan_data),1);
noise1 =sqrt(noisep1)*(noise(1:length(chan_data1),1)+noise(1:length(chan_data1),1)*1i);
noise2 =sqrt(noisep2)*(noise(1:length(chan_data2),1)+noise(1:length(chan_data2),1)*1i);
noise3 =sqrt(noisep3)*(noise(1:length(chan_data3),1)+noise(1:length(chan_data3),1)*1i);

chan_awgn1= chan_data1+noise1; % Noise addition in signal


chan_awgn2= chan_data2+noise2; % Noise addition in signal
chan_awgn3= chan_data3+noise3; % Noise addition in signal

% to above code of Noise but Noise pattern is different for evrysimultion


Ray_est1 = fading1+0.01*(randn(size(fading1))+randn(size(fading1))*1i); % Fading Estimation
Ray_est2 = fading2+0.01*(randn(size(fading2))+randn(size(fading2))*1i); % Fading Estimation
Ray_est3 = fading3+0.01*(randn(size(fading3))+randn(size(fading3))*1i); % Fading Estimation

chan_ray1 = chan_awgn1./Ray_est1; %Rayleigh Channel Estimation and cancellation


chan_ray2 = chan_awgn2./Ray_est2; %Rayleigh Channel Estimation and cancellation
chan_ray3 = chan_awgn3./Ray_est3; %Rayleigh Channel Estimation and cancellation
% serial to parallel coversion
ser_to_para1 = reshape(chan_ray1,80,nsym1).';
ser_to_para2 = reshape(chan_ray2,80,nsym2).';
ser_to_para3 = reshape(chan_ray3,80,nsym3).';
%cyclic prefix removal
cyclic_pre_rem1 = ser_to_para1(:,[17:80]);
cyclic_pre_rem2 = ser_to_para2(:,[17:80]);
cyclic_pre_rem3 = ser_to_para3(:,[17:80]);
% freq domain transform
FFT_recdata1 =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem1.')).';
FFT_recdata2 =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem2.')).';
FFT_recdata3 =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem3.')).';
% Pilot Removal
rem_pilot1 = FFT_recdata1(:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);
rem_pilot2 = FFT_recdata2(:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);
rem_pilot3 = FFT_recdata3(:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);
%pilot removal
% Serial Conversion
ser_data_11 = reshape(rem_pilot1.',nbitpersym*nsym1,1);
ser_data_12 = reshape(rem_pilot2.',nbitpersym*nsym2,1);
ser_data_13 = reshape(rem_pilot3.',nbitpersym*nsym3,1);
% QPSK Demodualation
z= modem.pskdemod('M', 4, 'PHASEOFFSET', pi/4, 'SYMBOLORDER', 'GRAY');
demod_Data1 = demodulate(z,ser_data_11); %demodulating the data
demod_Data2 = demodulate(z,ser_data_12); %demodulating the data

Semester Project Page 40


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

demod_Data3 = demodulate(z,ser_data_13); %demodulating the data


out21=[de2bi(demod_Data1)]';
out22=[de2bi(demod_Data2)]';
out23=[de2bi(demod_Data3)]';
output1 =out21(:);
output2 =out22(:);
output3 =out23(:);

% Channel Decoding
%[decoded_data1,err1] = decode(output1,n1,k1,'linear',genmat_13);
%[decoded_data2,err2] = decode(output2,n2,k2,'linear',genmat_12);
%[decoded_data3,err3] = decode(output3,n3,k3,'linear',genmat_23);

% Error Calculation
[no_of_error1(ii),LB_BER1(ii)]=biterr(output1,t_data11) ; % error rate calculation ;
[no_of_error2(ii),LB_BER2(ii)]=biterr(output2,t_data12) ; % error rate calculation ;
[no_of_error3(ii),LB_BER3(ii)]=biterr(output3,t_data23) ; % error rate calculation ;
end

%% plotting the result


close all
load uncoded_OFDM.mat
EbNo_LB1=EbNo+10*log10(k1/n1)+10*log10(2)+10*log10(52/80);
EbNo_LB2=EbNo+10*log10(k2/n2)+10*log10(2)+10*log10(52/80);
EbNo_LB3=EbNo+10*log10(k3/n3)+10*log10(2)+10*log10(52/80);
figure, semilogy(EbNo_LB1,LB_BER1,'--or',EbNo_LB2,LB_BER2,'--
ob',EbNo_LB3,LB_BER3,'--og',EbNo_uncoded,OFDM_BER,'--.k');
grid on, xlabel('Eb/No'), ylabel('BER');
title('Bit error probability curve using Linear Block Coding and OFDM');
legend('Coderate=1/3','Coderate=1/2','Coderate=2/3', 'Uncoded OFDM')

% %For code rate =1/3


EbNo_LB1b1=EbNo_LB1;
LB_BER1b1=LB_BER1;
save('LBdata_1b1.mat','LB_BER1b1','EbNo_LB1b1');
%For code rate =1/2
EbNo_LB1b2=EbNo_LB2;
LB_BER1b2=LB_BER2;
save('LBdata_1b2.mat','LB_BER1b2','EbNo_LB1b2');
% %For code rate =2/3
EbNo_LB2b3=EbNo_LB3;
LB_BER2b3=LB_BER3;
save('LBdata_2b3.mat','LB_BER2b3','EbNo_LB2b3');

Semester Project Page 41


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

Appendix B: Main code for convolutional codes with OFDM


clc, close all, clear all;
% Parameters
nbitpersym = 52; % number of bits per OFDM symbol (same as the number of subcarriers for
BPSK)
% nsym = 13500; % number of symbols
len_fft = 64; % fft size
sub_car = 52; % number of data subcarriers
EbNo = 0:15;

% Channel Coding
% For Code rate = 1/3
k1=1;n1=3;t1=1;
const_length1=[3];
generator1=[7 3 5];
% For Code rate = 1/2
k2=1;n2=2;t2=1;
const_length2=[3];
generator2=[7 5];
%
% For Code rate = 2/3
k3=2;n3=3;t3=2;
const_length3=[3 3];
generator3=[7 5 3;0 1 6];

% Data generation
load InputData.mat;

% Channel Coding
[t_data13] = Conv_encoder(t_data2,const_length3,generator3);
[t_data12] = Conv_encoder(t_data2,const_length2,generator2);
[t_data11] = Conv_encoder(t_data2,const_length1,generator1);

% OFDM Transmitter
nsym3 = length(t_data13)/104;
nsym2 = length(t_data12)/104;
nsym1 = length(t_data11)/104;
%[ser_data] = OFDM_transmitter(t_data1,nbitpersym,nsym); % ser_data is transmitted data

data_bits11=bi2de([reshape(t_data11,2, length(t_data11)/2)]');
data_bits12=bi2de([reshape(t_data12,2, length(t_data12)/2)]');
data_bits13=bi2de([reshape(t_data13,2, length(t_data13)/2)]');
M= modem.pskmod('M', 4, 'PHASEOFFSET', pi/4, 'SYMBOLORDER', 'GRAY'); % QPSK
Modulator with offset of pi/4 radian and gray code order

mod_data11 = modulate(M,data_bits11); % Modulating data

Semester Project Page 42


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

mod_data12 = modulate(M,data_bits12);
mod_data13 = modulate(M,data_bits13);

par_data1 = reshape(mod_data11,nbitpersym,nsym1).';
par_data2 = reshape(mod_data12,nbitpersym,nsym2).';
par_data3 = reshape(mod_data13,nbitpersym,nsym3).';
pilot_ins_data11=[zeros(nsym1,6)par_data1(:,1:nbitpersym/2) zeros(nsym1,1)
par_data1(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym1,5)] ;
pilot_ins_data12=[zeros(nsym2,6) par_data2(:,1:nbitpersym/2) zeros(nsym2,1)
par_data2(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym2,5)] ;
pilot_ins_data13=[zeros(nsym3,6) par_data3(:,1:nbitpersym/2) zeros(nsym3,1)
par_data3(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym3,5)] ;

IFFT_data1 = (64/sqrt(52))*ifft(fftshift(pilot_ins_data11.')).';
IFFT_data2 = (64/sqrt(52))*ifft(fftshift(pilot_ins_data12.')).';
IFFT_data3 = (64/sqrt(52))*ifft(fftshift(pilot_ins_data13.')).';
% addition cyclic prefix
cylic_add_data1 = [IFFT_data1(:,[49:64]) IFFT_data1].';
cylic_add_data2 = [IFFT_data2(:,[49:64]) IFFT_data2].';
cylic_add_data3 = [IFFT_data3(:,[49:64]) IFFT_data3].';

% parallel to serial coversion


ser_data1 = reshape(cylic_add_data1,80*nsym1,1);
ser_data2 = reshape(cylic_add_data2,80*nsym2,1);
ser_data3 = reshape(cylic_add_data3,80*nsym3,1);

% Passing through channel


load Afading.mat; % using fixed(once generated and saved)fading data for all simulation
fading1 = Afading(1:size(ser_data1)); % Fading signal length adjusted to match passing signal
fading2 = Afading(1:size(ser_data2));
fading3 = Afading(1:size(ser_data3));
chan_data1 = fading1.*ser_data1; % Applying Channel Fading
chan_data2 = fading2.*ser_data2;
chan_data3 = fading3.*ser_data3;
%T_data2=reshape(t_data1,14040,1);
% Reciever end
no_of_error=[];
CONV_BER=[];
for ii=1:length(EbNo)
ii
% OFDM Reciever
sigp_dB1 = 10*log10(norm(chan_data1,2)^2/numel(chan_data1)); % Signal Power in dB
sigp_dB2 = 10*log10(norm(chan_data2,2)^2/numel(chan_data2)); % Signal Power in dB
sigp_dB3 = 10*log10(norm(chan_data3,2)^2/numel(chan_data3)); % Signal Power in dB

noisep_dB1 = sigp_dB1-EbNo(ii); % Noise Power in dB

Semester Project Page 43


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

noisep_dB2 = sigp_dB2-EbNo(ii); % Noise Power in dB


noisep_dB3 = sigp_dB3-EbNo(ii); % Noise Power in dB

noisep1 = 10^(noisep_dB1/10); %Noise Poise in linear scale


noisep2 = 10^(noisep_dB2/10); %Noise Poise in linear scale
noisep3 = 10^(noisep_dB3/10); %Noise Poise in linear scale
load noise1.mat; % using fixed(once generated and saved)noise for all simulation
% Noise*standard deviation to achieve SNR, length is adjusted according to
% noise = sqrt(noisep)*noise(1:length(chan_data),1);
noise1 =sqrt(noisep1)*(noise(1:length(chan_data1),1)+noise(1:length(chan_data1),1)*1i);
noise2 =sqrt(noisep2)*(noise(1:length(chan_data2),1)+noise(1:length(chan_data2),1)*1i);
noise3 =sqrt(noisep3)*(noise(1:length(chan_data3),1)+noise(1:length(chan_data3),1)*1i);

chan_awgn1= chan_data1+noise1; % Noise addition in signal


chan_awgn2= chan_data2+noise2; % Noise addition in signal
chan_awgn3= chan_data3+noise3; % Noise addition in signal

% chan_awgn = awgn(chan_data,EbNo,'measured'); % awgn addition equaivalent


% to above code of Noise but Noise pattern is different for evry simultion
Ray_est1 = fading1+0.01*(randn(size(fading1))+randn(size(fading1))*1i); % Fading Estimation
Ray_est2 = fading2+0.01*(randn(size(fading2))+randn(size(fading2))*1i); % Fading Estimation
Ray_est3 = fading3+0.01*(randn(size(fading3))+randn(size(fading3))*1i); % Fading Estimation

chan_ray1 = chan_awgn1./Ray_est1; %Rayleigh Channel Estimation and cancellation


chan_ray2 = chan_awgn2./Ray_est2; %Rayleigh Channel Estimation and cancellation
chan_ray3 = chan_awgn3./Ray_est3; %Rayleigh Channel Estimation and cancellation

% serial to parallel coversion


ser_to_para1 = reshape(chan_ray1,80,nsym1).';
ser_to_para2 = reshape(chan_ray2,80,nsym2).';
ser_to_para3 = reshape(chan_ray3,80,nsym3).';
%cyclic prefix removal
cyclic_pre_rem1 = ser_to_para1(:,[17:80]);
cyclic_pre_rem2 = ser_to_para2(:,[17:80]);
cyclic_pre_rem3 = ser_to_para3(:,[17:80]);
% freq domain transform
FFT_recdata1 =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem1.')).';
FFT_recdata2 =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem2.')).';
FFT_recdata3 =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem3.')).';
% Pilot Removal
rem_pilot1 = FFT_recdata1(:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);
rem_pilot2 = FFT_recdata2(:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);
rem_pilot3 = FFT_recdata3(:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);
% Serial Conversion
ser_data_11 = reshape(rem_pilot1.',nbitpersym*nsym1,1);
ser_data_12 = reshape(rem_pilot2.',nbitpersym*nsym2,1);

Semester Project Page 44


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

ser_data_13 = reshape(rem_pilot3.',nbitpersym*nsym3,1);

% QPSK Demodualation
z= modem.pskdemod('M', 4, 'PHASEOFFSET', pi/4, 'SYMBOLORDER', 'GRAY');
demod_Data1 = demodulate(z,ser_data_11); %demodulating the data
demod_Data2 = demodulate(z,ser_data_12); %demodulating the data
demod_Data3 = demodulate(z,ser_data_13); %demodulating the data
out21=[de2bi(demod_Data1)]';
out22=[de2bi(demod_Data2)]';
out23=[de2bi(demod_Data3)]';
output1 =out21(:);
output2 =out22(:);
output3 =out23(:);

% Channel Decoding
tblen = 48;
[demod_Data33] = Conv_decoder(output3,const_length3,generator3,tblen );
[demod_Data22] = Conv_decoder(output2,const_length2,generator2,tblen );
[demod_Data11] = Conv_decoder(output1,const_length1,generator1,tblen );

% Error Calculation
[no_of_error3(ii),CONV_BER3(ii)] = biterr(demod_Data33(tblen*t3+1:end),t_data2(1:end -
tblen*t3)); % error rate calculation
[no_of_error2(ii),CONV_BER2(ii)] = biterr(demod_Data22(tblen*t2+1:end),t_data2(1:end -
tblen*t2));
[no_of_error1(ii),CONV_BER1(ii)] = biterr(demod_Data11(tblen*t1+1:end),t_data2(1:end -
tblen*t1));
end
% plotting the result
close all
load uncoded_OFDM.mat
EbNo_CONV3=EbNo+10*log10(k3/n3)+10*log10(2)+10*log10(52/80);
EbNo_CONV2=EbNo+10*log10(k2/n2)+10*log10(2)+10*log10(52/80);
EbNo_CONV1=EbNo+10*log10(k1/n1)+10*log10(2)+10*log10(52/80);
figure, semilogy(EbNo_uncoded,OFDM_BER,'--.k',EbNo_CONV1,CONV_BER1,'--
og',EbNo_CONV2,CONV_BER2,'--ob',EbNo_CONV3,CONV_BER3,'--or');
grid on, xlabel('Eb/No'), ylabel('BER');
title('Bit error probability curve using Convolutional Coding and OFDM');
legend('Uncoded OFDM','Code rate=1/3','Code rate=1/2','Code rate=2/3')
% %For code rate =1/3
EbNo_CONV1b1=EbNo_CONV1;
CONV_BER1b1=CONV_BER1;
save('CONVdata_1b1.mat','CONV_BER1b1','EbNo_CONV1b1');
%For code rate =1/2
EbNo_CONV1b2=EbNo_CONV2;
CONV_BER1b2=CONV_BER2;

Semester Project Page 45


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

save('CONVdata_1b2.mat','CONV_BER1b2','EbNo_CONV1b2');
% %For code rate =2/3
EbNo_CONV2b3=EbNo_CONV3;
CONV_BER2b3=CONV_BER3;
save('CONVdata_2b3.mat','CONV_BER2b3','EbNo_CONV2b3');

Appendix C: Main Code for Reed Solomon Codes


clc, close all, clear all;
% Parameters
nbitpersym = 52; % number of bits per OFDM symbol (same as the number of subcarriers for
BPSK)
len_fft = 64; % fft size
sub_car = 52; % number of data subcarriers
EbNo = 0:15;
% Channel Coding setting
% For Code rate = 1/3
n3=15;
k3=5;
% For Code rate = 1/2
n2=15;
k2=7;
% For Code rate = 2/3
n1=15;
k1=10;
%% Data generation
load InputData.mat;
% These two steps are to match the exact input length required by
t_dataa1=t_data2(1:12480);
t_dataa2=t_data2(1:7488);
t_dataa3=t_data2(1:6240);

% Channel Coding
[t_data11] = RS_Encoder( t_data2,n1,k1);
[t_data12] = RS_Encoder( t_data2,n2,k2-1);
[t_data13] = RS_Encoder( t_data2,n3,k3);
%% OFDM Transmitter
nsym1 = length(t_data11)/104;
nsym2 = length(t_data12)/104;
nsym3 = length(t_data13)/104;

%data = randint(18720,1);
%nbitpersym = 52;
%nsym = length(data)/104;

data_bits11=bi2de([reshape(t_data11,2, length(t_data11)/2)]');
data_bits12=bi2de([reshape(t_data12,2, length(t_data12)/2)]');

Semester Project Page 46


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

data_bits13=bi2de([reshape(t_data13,2, length(t_data13)/2)]');
M= modem.pskmod('M', 4, 'PHASEOFFSET', pi/4, 'SYMBOLORDER', 'GRAY'); % QPSK
Modulator with offset of pi/4 radian and gray code order

mod_data11 = modulate(M,data_bits11); % Modulating data


mod_data12 = modulate(M,data_bits12);
mod_data13 = modulate(M,data_bits13);

par_data1 = reshape(mod_data11,nbitpersym,nsym1).';
par_data2 = reshape(mod_data12,nbitpersym,nsym2).';
par_data3 = reshape(mod_data13,nbitpersym,nsym3).';

pilot_ins_data11=[zeros(nsym1,6) par_data1(:,1:nbitpersym/2) zeros(nsym1,1)


par_data1(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym1,5)] ;
pilot_ins_data12=[zeros(nsym2,6) par_data2(:,1:nbitpersym/2) zeros(nsym2,1)
par_data2(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym2,5)] ;
pilot_ins_data13=[zeros(nsym3,6) par_data3(:,1:nbitpersym/2) zeros(nsym3,1)
par_data3(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym3,5)] ;

IFFT_data1 = (64/sqrt(52))*ifft(fftshift(pilot_ins_data11.')).';
IFFT_data2 = (64/sqrt(52))*ifft(fftshift(pilot_ins_data12.')).';
IFFT_data3 = (64/sqrt(52))*ifft(fftshift(pilot_ins_data13.')).';
% addition cyclic prefix
cylic_add_data1 = [IFFT_data1(:,[49:64]) IFFT_data1].';
cylic_add_data2 = [IFFT_data2(:,[49:64]) IFFT_data2].';
cylic_add_data3 = [IFFT_data3(:,[49:64]) IFFT_data3].';

% parallel to serial coversion


ser_data1 = reshape(cylic_add_data1,80*nsym1,1);
ser_data2 = reshape(cylic_add_data2,80*nsym2,1);
ser_data3 = reshape(cylic_add_data3,80*nsym3,1);

% Passing through channel, applying fading.


load Afading.mat; % using fixed(once generated and saved)fading data for all simulation
fading1 = Afading(1:size(ser_data1)); % Fading signal length adjusted to match passing signal
fading2 = Afading(1:size(ser_data2));
fading3 = Afading(1:size(ser_data3));
chan_data1 = fading1.*ser_data1; % Applying Channel Fading
chan_data2 = fading2.*ser_data2;
chan_data3 = fading3.*ser_data3;
%% Reciever end
no_of_error=[];
RS_BER=[];
for ii=1:length(EbNo)
ii;

Semester Project Page 47


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

% OFDM Reciever %[demod_Data] =


OFDM_reciever(chan_data,EbNo(ii),fading,nbitpersym,nsym );

sigp_dB1 = 10*log10(norm(chan_data1,2)^2/numel(chan_data1)); % Signal Power in dB


sigp_dB2 = 10*log10(norm(chan_data2,2)^2/numel(chan_data2)); % Signal Power in dB
sigp_dB3 = 10*log10(norm(chan_data3,2)^2/numel(chan_data3)); % Signal Power in dB

noisep_dB1 = sigp_dB1-EbNo(ii); % Noise Power in dB


noisep_dB2 = sigp_dB2-EbNo(ii); % Noise Power in dB
noisep_dB3 = sigp_dB3-EbNo(ii); % Noise Power in dB

noisep1 = 10^(noisep_dB1/10); %Noise Poise in linear scale


noisep2 = 10^(noisep_dB2/10); %Noise Poise in linear scale
noisep3 = 10^(noisep_dB3/10); %Noise Poise in linear scale
load noise1.mat; % using fixed(once generated and saved)noise for all simulation
% Noise*standard deviation to achieve SNR, length is adjusted according to
noise1 =sqrt(noisep1)*(noise(1:length(chan_data1),1)+noise(1:length(chan_data1),1)*1i);
noise2 =sqrt(noisep2)*(noise(1:length(chan_data2),1)+noise(1:length(chan_data2),1)*1i);
noise3 =sqrt(noisep3)*(noise(1:length(chan_data3),1)+noise(1:length(chan_data3),1)*1i);

chan_awgn1= chan_data1+noise1; % Noise addition in signal


chan_awgn2= chan_data2+noise2; % Noise addition in signal
chan_awgn3= chan_data3+noise3; % Noise addition in signal

% to above code of Noise but Noise pattern is different for evrysimultion


Ray_est1 = fading1+0.01*(randn(size(fading1))+randn(size(fading1))*1i); % Fading Estimation
Ray_est2 = fading2+0.01*(randn(size(fading2))+randn(size(fading2))*1i); % Fading Estimation
Ray_est3 = fading3+0.01*(randn(size(fading3))+randn(size(fading3))*1i); % Fading Estimation

chan_ray1 = chan_awgn1./Ray_est1; %Rayleigh Channel Estimation and cancellation


chan_ray2 = chan_awgn2./Ray_est2; %Rayleigh Channel Estimation and cancellation
chan_ray3 = chan_awgn3./Ray_est3; %Rayleigh Channel Estimation and cancellation
% serial to parallel coversion
ser_to_para1 = reshape(chan_ray1,80,nsym1).';
ser_to_para2 = reshape(chan_ray2,80,nsym2).';
ser_to_para3 = reshape(chan_ray3,80,nsym3).';
%cyclic prefix removal
cyclic_pre_rem1 = ser_to_para1(:,[17:80]);
cyclic_pre_rem2 = ser_to_para2(:,[17:80]);
cyclic_pre_rem3 = ser_to_para3(:,[17:80]);
% freq domain transform
FFT_recdata1 =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem1.')).';
FFT_recdata2 =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem2.')).';
FFT_recdata3 =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem3.')).';
% Pilot Removal
rem_pilot1 = FFT_recdata1(:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);

Semester Project Page 48


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

rem_pilot2 = FFT_recdata2(:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);


rem_pilot3 = FFT_recdata3(:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);
%pilot removal
% Serial Conversion
ser_data_11 = reshape(rem_pilot1.',nbitpersym*nsym1,1);
ser_data_12 = reshape(rem_pilot2.',nbitpersym*nsym2,1);
ser_data_13 = reshape(rem_pilot3.',nbitpersym*nsym3,1);
% QPSK Demodualation
z= modem.pskdemod('M', 4, 'PHASEOFFSET', pi/4, 'SYMBOLORDER', 'GRAY');
demod_Data1 = demodulate(z,ser_data_11); %demodulating the data
demod_Data2 = demodulate(z,ser_data_12); %demodulating the data
demod_Data3 = demodulate(z,ser_data_13); %demodulating the data
out21=[de2bi(demod_Data1)]';
out22=[de2bi(demod_Data2)]';
out23=[de2bi(demod_Data3)]';
output1 =out21(:);
output2 =out22(:);
output3 =out23(:);

% Channel Decoding
l=log2(n1+1);
code_data1=output1(1:18720);
code_data2=output2(1:18720);
code_data3=output3(1:18720);

r_code_data1=bi2de([reshape(code_data1,l, length(code_data1)/l)]');
r_code_data2=bi2de([reshape(code_data2,l, length(code_data2)/l)]');
r_code_data3=bi2de([reshape(code_data3,l, length(code_data3)/l)]');

decoder1 = fec.rsdec(n1,k1);
decoder2 = fec.rsdec(n2,(k2-1));
decoder3 = fec.rsdec(n3,k3);

[decoded1,cnumerr1,ccode1] = decode(decoder1,r_code_data1);
[decoded2,cnumerr2,ccode2] = decode(decoder2,r_code_data2);
[decoded3,cnumerr3,ccode3] = decode(decoder3,r_code_data3);

decoded_output1=reshape([de2bi(decoded1)]',length(decoded1)*l,1);
decoded_output2=reshape([de2bi(decoded2)]',length(decoded2)*l,1);
decoded_output3=reshape([de2bi(decoded3)]',length(decoded3)*l,1);

% Error Calculation
[no_of_error1(ii),RS_BER1(ii)]=biterr(decoded_output1,t_dataa1);
[no_of_error2(ii),RS_BER2(ii)]=biterr(decoded_output2,t_dataa2);
[no_of_error3(ii),RS_BER3(ii)]=biterr(decoded_output3,t_dataa3);
end

Semester Project Page 49


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

%%
load uncoded_OFDM.mat
EbNo_RS1=EbNo+10*log10(k1/n1)+10*log10(2)+10*log10(52/80);
EbNo_RS2=EbNo+10*log10((k2-1)/n2)+10*log10(2)+10*log10(52/80);
EbNo_RS3=EbNo+10*log10(k3/n3)+10*log10(2)+10*log10(52/80);
figure, semilogy(EbNo_uncoded,OFDM_BER,'--.k',EbNo_RS1,RS_BER1,'--
og',EbNo_RS2,RS_BER2,'--ob',EbNo_RS3,RS_BER3,'--or');
grid on, xlabel('Eb/No'), ylabel('BER');
title('Bit error probability curve using RS Block Coding and OFDM');
legend('BER Uncoded OFDM','Code rate=2/3', 'Code rate=1/2', 'Code rate=1/3')
% % %For code rate =1/3
EbNo_RS1b1=EbNo_RS1;
RS_BER1b1=RS_BER1;
save('RSdata_1b1.mat','RS_BER1b1','EbNo_RS1b1');
%For code rate =1/2
EbNo_RS1b2=EbNo_RS2;
RS_BER1b2=RS_BER2;
save('RSdata_1b2.mat','RS_BER1b2','EbNo_RS1b2');
% %For code rate =2/3
EbNo_RS2b3=EbNo_RS3;
RS_BER2b3=RS_BER3;
save('RSdata_2b3.mat','RS_BER2b3','EbNo_RS2b3');

Appendix D: Uncoded OFDM code


noise = randn(100000,1);
save('noise1.mat','noise');
t_data2 = randint(18720,1);
save('InputData.mat','t_data2');
fading = sqrt(0.5*(randn(10000,1) + 1i*randn(10000,1)));
save('fading.mat','fading');

Appendix E: Linear Block Encoder Function


function [ coded_output ] = LBlock_Encoder( data,n,k,genmat )
% Function for Liner Block encoding of data.
% Inputs: The function takes 'data' as the data to be encoded, 'k' is
% length of msg bits into the encoder, 'n' is the coded msg bits out of the
% encoder while 'genmat' defines the generator matrix required for coding.
% Outputs: The coded output from the Linear Block encoder
coded_output = encode(data,n,k,'linear',genmat);
end

Appendix F: Convolutional Encoder Function


function [ coded_data ] = Conv_encoder( data,length,generator )
% Function of convolution encoding of data. % Inputs: The function takes 'data' as the data to be
% the constraint length of the convolutional encoder, generator is the

Semester Project Page 50


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

trel = poly2trellis(length,generator); % Trellis designing from ploynomials


coded_data = convenc(data,trel); % Encode the message using the trellis.
end

Appendix G: Convolutional decoder Function


function [ decoded_data ] = Conv_decoder( code_data,length,generator,tblen )
% Function of convolution encoding of data. % Inputs: The function takes 'data' as the data to be
encoded, length is
% the constraint length of the convolutional encoder, generator is the % polynomial defining the
convolutional encoder, tblen is the trackback % length for viterbi decoder. % Outputs: The coded
output from convolutional encoder
trel = poly2trellis(length,generator);
qcode = quantiz(code_data,[0.001,.1,.3,.5,.7,.9,.999]);
decoded_data= vitdec(qcode,trel,tblen,'cont','soft',3);
end

Appendix H: Reed Solomon Encoder Function


function [ coded_output ] = RS_Encoder( data,n,k)
l=log2(n+1);
r_data=bi2de([reshape(data,l, length(data)/l)]');
enc = fec.rsenc(n,k);
code = encode(enc,r_data);
coded_output=[reshape([de2bi(code)]',length(code)*l,1)]';
end

Appendix I: Uncoded OFDM code


clc; clear all; close all;
data = randint(18720,1);
nbitpersym = 52;
nsym = length(data)/104;
data_bits=bi2de([reshape(data,2, length(data)/2)]');
M= modem.pskmod('M', 4, 'PHASEOFFSET', pi/4, 'SYMBOLORDER', 'GRAY'); % QPSK
Modulator with offset of pi/4 radian and gray code order
mod_data = modulate(M,data_bits); % Modulating data
par_data = reshape(mod_data,nbitpersym,nsym).';
pilot_ins_data=[zeros(nsym,6) par_data(:,1:nbitpersym/2) zeros(nsym,1)
par_data(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym,5)] ;
IFFT_data = (64/sqrt(52))*ifft(fftshift(pilot_ins_data.')).';
% addition cyclic prefix
cylic_add_data = [IFFT_data(:,[49:64]) IFFT_data].';
% parallel to serial coversion
ser_data = reshape(cylic_add_data,80*nsym,1);

len_fft = 64; % fft size


sub_car = 52; % number of data subcarriers

Semester Project Page 51


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

EbNo = 0:14;
k=1/3; % code rate of Encoder
% Data generation
size1=size(ser_data);
fading = sqrt(0.5*(randn(size1) + 1i*randn(size1))); % Fading channel
% fading=1;
chan_data = fading.*ser_data; % Applying Channel Fading
% Reciever end
no_of_error=[];
OFDM_BER=[];
for ii=1:length(EbNo)
ii;
% OFDM Reciever
sigp_dB = 10*log10(norm(chan_data,2)^2/numel(chan_data)); % Signal Power in dB
noisep_dB = sigp_dB-EbNo(ii); % Noise Power in dB
noisep = 10^(noisep_dB/10); %Noise Poise in linear scale
load noise1.mat; % using fixed(once generated and saved)noise for all simulation
% Noise*standard deviation to achieve SNR, length is adjusted according to
noise =sqrt(noisep)*(noise(1:length(chan_data),1)+noise(1:length(chan_data),1)*1i);
chan_awgn= chan_data+noise; % Noise addition in signal
% chan_awgn = awgn(chan_data,EbNo,'measured'); % awgn addition equaivalent
% to above code of Noise but Noise pattern is different for evrysimultion
Ray_est = fading+0.01*(randn(size(fading))+randn(size(fading))*1i); % Fading Estimation
chan_ray = chan_awgn./Ray_est; %Rayleigh Channel Estimation and cancellation
% serial to parallel coversion
ser_to_para = reshape(chan_ray,80,nsym).';
%cyclic prefix removal
cyclic_pre_rem = ser_to_para(:,[17:80]);
% freq domain transform
FFT_recdata =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem.')).';
% Pilot Removal
rem_pilot = FFT_recdata (:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);
%pilot removal
ser_data_1 = reshape(rem_pilot.',nbitpersym*nsym,1);
% QPSK Demodualation
z= modem.pskdemod('M', 4, 'PHASEOFFSET', pi/4, 'SYMBOLORDER', 'GRAY');
demod_Data = demodulate(z,ser_data_1); %demodulating the data
out2=[de2bi(demod_Data)]';
output =out2(:);
% Error Calculation
[no_of_error(ii),OFDM_BER(ii)]=biterr(output,data) ; % error rate calculation
end
% plotting the result
figure,
EbNo_uncoded=EbNo+ 10*log10(2)+10*log10(52/64);
semilogy(EbNo_uncoded,OFDM_BER,'--.k')

Semester Project Page 52


BiT-BDU, Faculty of Electrical and Computer Engineering 2021

grid on, xlabel('Eb/No'), ylabel('BER');


title('Bit error probability curve using uncoded OFDM');
save('uncoded_OFDM.mat','OFDM_BER','EbNo_uncoded');

Appendix J: Uncoded OFDM code


noise = randn(100000,1);
save('noise1.mat','noise');
t_data2 = randint(18720,1);
save('InputData.mat','t_data2');
fading = sqrt(0.5*(randn(10000,1) + 1i*randn(10000,1)));
save('fading.mat','fading');

Semester Project Page 53

You might also like