Lab 07 To Perform Interleaving in Simulink

You might also like

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

Mobile Communication Lab

Lab 07

To Perform Block Interleaving in Simulink

Prepared by Engr Ali M Durrani


1
(CECOS University) ali@cecos.edu.pk
Block Coding
• An interleaver permutes symbols according to a
mapping.

• A corresponding deinterleaver uses the inverse


mapping to restore the original sequence of
symbols.

• Interleaving and deinterleaving can be useful for


reducing errors caused by burst errors in a
communication system.

Prepared by Engr Ali M Durrani


2
(CECOS University) ali@cecos.edu.pk
Interleaving Features of the Blockset
• This blockset provides interleavers in two broad
categories:

• Block interleavers.
This category includes matrix, random, algebraic,
and helical scan interleavers as special cases.

• Convolutional interleavers.
This category includes a helical interleaver as a
special case, as well as a general multiplexed
interleaver.
Prepared by Engr Ali M Durrani
3
(CECOS University) ali@cecos.edu.pk
Block Interleavers
• A block interleaver accepts a set of symbols and
rearranges them, without repeating or omitting
any of the symbols in the set.

• The number of symbols in each set is fixed for a


given interleaver.

• The interleaver’s operation on a set of symbols is


independent of its operation on all other sets of
symbols.
Prepared by Engr Ali M Durrani
4
(CECOS University) ali@cecos.edu.pk
Example 7a
The following example shows how to use an interleaver to
improve the error rate when the channel produces bursts of
errors

Prepared by Engr Ali M Durrani


5
(CECOS University) ali@cecos.edu.pk
Creating the Vector of Errors
• Before running the model, use the following
code to create a binary vector in the MATLAB
workspace.

Prepared by Engr Ali M Durrani


6
(CECOS University) ali@cecos.edu.pk
• To determine the ratio of the number of 1s to
the total number of symbols in the vector
errors, type

Prepared by Engr Ali M Durrani


7
(CECOS University) ali@cecos.edu.pk
Building the Model
• To start building the model, follow these steps:

• Type commlib at the MATLAB prompt.


This opens the Communications Blockset main library.

• Type dsplib at the MATLAB prompt.


This opens the DSP Blockset main library.

• Type simulink3 at the MATLAB prompt.


This opens the Main Simulink Library.

• From the library's File menu, select New and then select Model.
Prepared by Engr Ali M Durrani
8
(CECOS University) ali@cecos.edu.pk
Bernoulli Binary Generator
• Check the frame based data box
• Set Samples per frame to 4.
• Set output data type to Boolean

Prepared by Engr Ali M Durrani


9
(CECOS University) ali@cecos.edu.pk
• Signal From Workspace
- Set Signal to errors.
- Set Sample time to 4/7.
- Set Samples per frame to 84

Prepared by Engr Ali M Durrani


10
(CECOS University) ali@cecos.edu.pk
Hamming Encoder
Hamming Decoder,
<with default parameter values>

Prepared by Engr Ali M Durrani


11
(CECOS University) ali@cecos.edu.pk
Buffer (2 copies)
(1) Set Output buffer size (per channel)to 84
(2) Set Output buffer size (per channel)to 7

Prepared by Engr Ali M Durrani


12
(CECOS University) ali@cecos.edu.pk
Random Interleaver
Random Deinterleaver
- Set Number of elements to 84.

Prepared by Engr Ali M Durrani


13
(CECOS University) ali@cecos.edu.pk
Logical Operator
- Set Operator to XOR

Prepared by Engr Ali M Durrani


14
(CECOS University) ali@cecos.edu.pk
• Error Rate Calculation
Set Receive delay to (4/7)*84.
- Set Computation delay to 100.
- Set Output data to Port.

Prepared by Engr Ali M Durrani


15
(CECOS University) ali@cecos.edu.pk
• Display

Prepared by Engr Ali M Durrani


16
(CECOS University) ali@cecos.edu.pk
Running Simulation
• Connect the blocks as shown
• Set Stop time to length(errors)

Prepared by Engr Ali M Durrani


17
(CECOS University) ali@cecos.edu.pk
Lab Task 7a
Implement the convolutional interleaving and
deinterleaving using a sequence of consecutive integers

• Ramp, in the Simulink Sources library

• Zero-Order Hold, in the Simulink Discrete library

• Convolutional Interleaver –
Set Rows of shift registers to 3 ,- Set Initial conditions to [-1 -2 -3].

• Convolutional Deinterleaver
• - Set Rows of shift registers to 3 , Set Initial conditions to [-1 -2 -3].
Prepared by Engr Ali M Durrani
18
(CECOS University) ali@cecos.edu.pk
Lab task 7a continue
• Save the two copies of To Workspace with Variable name to
interleaved and restored, respectively.

• Set Save format to Array in each of the two copies of this block.

• Now set Stop time to 20. Run the simulation, then execute the
following command.

comparison = [[0:20]', interleaved, restored]

• In this output, the first column contains the original symbol


sequence. The second column contains the interleaved sequence,
while the third column contains the restored sequence.

Prepared by Engr Ali M Durrani


19
(CECOS University) ali@cecos.edu.pk
Lab Task 7b
• What is the difference between the first and
last column of the comparison matrix in
Lab task 6a do you see the original data ?

Prepared by Engr Ali M Durrani


20
(CECOS University) ali@cecos.edu.pk

You might also like