Professional Documents
Culture Documents
4 5933693294486751968
4 5933693294486751968
By
Name ID
1. Yeshambel Ayenew 0905417
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._______________________ _________
This Project has been submitted for examination with my approval as a university advisor.
_____________________ _________
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
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
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
List of Table
Table 4. 1: Performance comparison different channel coding techniques ................................. 34
List of Acronyms
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.
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.
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.
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.
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
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.
Literature Review
System Modeling
Software Simulation
Giving Conclusion
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
of three codes (i.e. linear block codes, convolutional codes and reed Solomon codes) under
various channel conditions.
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.
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.
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.
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
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:
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.
𝑇 𝑐, 𝑖 = 𝑗
∫0 𝑠𝑖 (𝑡) 𝑠𝑗 (𝑡)𝑑𝑡 = {0, 𝑖 ≠ 𝑗 , … … … … … … … … … (3.2)
When using these complex exponentials, orthogonality is achieved by fulfilling the condition
1, 𝑎=𝑏
∑ 𝑊𝑁𝑘𝑎 𝑊𝑁𝑘𝑏 = { 𝑎, 𝑏 = {0, 1, … , 𝑁 − 1} ⋯ ⋯ ⋯ (3.4)
0, 𝑎≠ 𝑏
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
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 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.
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.
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.
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
designed based on this. On the other hand, if the modulation and coding schemes are specified,
then the number of subcarriers can be determined.
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
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:
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:
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.
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)
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
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.
The Standard Array of the (5 , 2) systematic code besed on the above properties
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,
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.
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.
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 𝑅 = 𝑘⁄𝑛.
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.
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)
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.
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
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)
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
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.
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:
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:
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.
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].
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.
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.
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]:
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.
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)
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
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:
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.
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
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.
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
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.
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
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.
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.
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.
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.
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.
[9] Bahai, A., and B. Saltzberg. “Multicarrier Digital Communications: Theory and Applications
of OFDM”. New York: Kluwer Academic/Plenum Publishers, 1999.
[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.
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
par_data1 = reshape(mod_data11,nbitpersym,nsym1).';
par_data2 = reshape(mod_data12,nbitpersym,nsym2).';
par_data3 = reshape(mod_data13,nbitpersym,nsym3).';
% 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
% 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
% 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_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].';
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;
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');
% 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)]');
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
par_data1 = reshape(mod_data11,nbitpersym,nsym1).';
par_data2 = reshape(mod_data12,nbitpersym,nsym2).';
par_data3 = reshape(mod_data13,nbitpersym,nsym3).';
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].';
% 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
%%
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');
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')