| Communications Blockset™ | ![]() |
| On this page… |
|---|
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.
Open the Interleaving library by double-clicking its icon in the main Communications Blockset library. Then open the interleaving sublibraries by double-clicking their icons in the Interleaving library.
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.
In typical usage of all interleaver/deinterleaver pairs in this blockset, the parameters of the deinterleaver match those of the interleaver.
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.
The set of block interleavers in this library includes a general interleaver/deinterleaver pair as well as several special cases. Each special-case block uses the same computational code that its more general counterpart uses, but provides an interface that is more suitable for the special case.
The Matrix Interleaver block accomplishes block interleaving by filling a matrix with the input symbols row by row and then sending the matrix contents to the output port column by column. For example, if the interleaver uses a 2-by-3 matrix to do its internal computations, then for an input of [1 2 3 4 5 6], the block produces an output of [1 4 2 5 3 6].
The Random Interleaver block chooses a permutation table randomly using the Initial seed parameter that you provide in the block mask. By using the same Initial seed value in the corresponding Random Deinterleaver block, you can restore the permuted symbols to their original ordering.
The Algebraic Interleaver block uses a permutation table that is algebraically derived. It supports Takeshita-Costello interleavers and Welch-Costas interleavers. These interleavers are described in [4].
The following example shows how to use an interleaver to improve the error rate when the channel produces bursts of errors.

Before running the model, you must create a binary vector that simulates bursts of errors, as described in Creating the Vector of Errors. The Signal From Workspace block imports this vector from the MATLAB workspace into the model, where the Logical Operator block performs an XOR of the vector with the signal.
To open the completed model, click here in the MATLAB Help browser. To build the model, gather and configure these blocks:
Bernoulli Binary Generator, in the Random Data Sources sublibrary of the Comm Sources library
Check the box next to Frame-based outputs.
Set Samples per frame to 4.
Hamming Encoder, in the Block sublibrary of the Error Detection and Correction library. Use default parameters
Buffer, in the Buffers sublibrary of the Signal Management library in Signal Processing Blockset
Set Output buffer size (per channel) to 84.
Random Interleaver, in the Block sublibrary of the Interleaving library in Communications Blockset
Set Number of elements to 84.
Logical Operator, in the Simulink Math Operations library
Set Operator to XOR.
Signal From Workspace, in the Signal Processing Sources library
Set Signal to errors.
Set Sample time to 4/7.
Set Samples per frame to 84.
Random Deinterleaver, in the Block sublibrary of the Interleaving library in Communications Blockset
Set Number of elements to 84.
Buffer, in the Buffers sublibrary of the Signal Management library in Signal Processing Blockset
Set Output buffer size (per channel) to 7.
Hamming Decoder, in the Block sublibrary of the Error Detection and Correction library. Use default parameters.
Error Rate Calculation, in the Comm Sinks library
Set Receive delay to (4/7)*84.
Set Computation delay to 100.
Set Output data to Port.
Display, in the Simulink Sinks library. Use default parameters.
Select Configuration parameters from the model's Simulation menu and set Stop time to length(errors).
Creating the Vector of Errors. Before running the model, use the following code to create a binary vector in the MATLAB workspace. The model uses this vector to simulate bursts of errors. The vector contains blocks of three 1s, representing bursts of errors, at random intervals. The distance between two consecutive blocks of 1s is a random integer between 1 and 80.
errors=zeros(1,10^4); n=1; while n<10^4-80; n=n+floor(79*rand(1))+3; errors(n:n+2)=[1 1 1]; end
To determine the ratio of the number of 1s to the total number of symbols in the vector errors, enter
sum(errors)/length(errors)
Your answer should be approximately 3/43, or .0698, since after each sequence of three 1s, the expected distance to the next sequence of 1s is 40. Consequently, you expect to see three 1s in 43 terms of the sequence. If there were no error correction in the model, the bit error rate would be approximately .0698.
When you run a simulation with the model, the error rate is approximately .019, which shows the improvement due to error correction and interleaving. You can see the effect of interleaving by deleting the Random Interleaver and Random Deinterleaver blocks from the model, connecting the lines, and running another simulation. The bit error rate is higher without interleaving because the Hamming code can only correct one error in each codeword.
A convolutional interleaver consists of a set of shift registers, each with a fixed delay. In a typical convolutional interleaver, the delays are nonnegative integer multiples of a fixed integer (although a general multiplexed interleaver allows arbitrary delay values). Each new symbol from the input signal feeds into the next shift register and the oldest symbol in that register becomes part of the output signal. The schematic below depicts the structure of a convolutional interleaver by showing the set of shift registers and their delay values D(1), D(2),..., D(N). The kth shift register holds D(k) symbols, where k = 1, 2,..., N. The blocks in this library have mask parameters that indicate the delay for each shift register. The delay is measured in samples.

This section discusses
The types of convolutional interleavers included in the library
The delay between the original sequence and the restored sequence
An example that uses a convolutional interleaver
The set of convolutional interleavers in this library includes a general interleaver/deinterleaver pair as well as several special cases. Each special-case block uses the same computational code that its more general counterpart uses, but provides an interface that is more suitable for the special case.
The most general block in this library is the General Multiplexed Interleaver block, which allows arbitrary delay values for the set of shift registers. To implement the preceding schematic using this block, use an Interleaver delay parameter of [D(1); D(2); ...; D(N)].
More specific is the Convolutional Interleaver block, in which the delay value for the kth shift register is (k-1) times the block's Register length step parameter. The number of shift registers in this block is the value of the Rows of shift registers parameter.
Finally, the Helical Interleaver block supports a special case of convolutional interleaving that fills an array with symbols in a helical fashion and empties the array row by row. To configure this interleaver, use the Number of columns of helical array parameter to set the width of the array, and use the Group size and Helical array step size parameters to determine how symbols are placed in the array. See the reference page for the Helical Interleaver block for more details and an example.
After a sequence of symbols passes through a convolutional interleaver and a corresponding convolutional deinterleaver, the restored sequence lags behind the original sequence. The delay, measured in symbols, between the original and restored sequences is
(Number of shift registers) * (Maximum delay among all shift registers)
for the most general multiplexed interleaver. If your model incurs an additional delay between the interleaver output and the deinterleaver input, the restored sequence lags behind the original sequence by the sum of the additional delay and the amount in the preceding formula.
Note For proper synchronization, the delay in your model between the interleaver output and the deinterleaver input must be an integer multiple of the number of shift registers. You can use the Delay block in Signal Processing Blockset to adjust delays manually, if necessary. |
Convolutional Interleaver block. In the special case implemented by the Convolutional Interleaver/Convolutional Deinterleaver pair, the number of shift registers is the Rows of shift registers parameter, while the maximum delay among all shift registers is
B * (N-1)
where B is the Register length step parameter and N is the Rows of shift registers parameter.
Helical Interleaver block. In the special case implemented by the Helical Interleaver/Helical Deinterleaver pair, the delay between the restored sequence and the original sequence is
![]()
where C is the Number of columns in helical array parameter, N is the Group size parameter, and s is the Helical array step size parameter.
The example below illustrates convolutional interleaving and deinterleaving using a sequence of consecutive integers. It also illustrates the inherent delay and the effect of the interleaving blocks' initial conditions.

To open the completed model, click here in the MATLAB Help browser. To build the model, gather and configure these blocks:
Ramp, in the Simulink Sources library. Use default parameters.
Zero-Order Hold, in the Simulink Discrete library. Use default parameters.
Set Rows of shift registers to 3.
Set Initial conditions to [-1 -2 -3]'.
Set Rows of shift registers to 3.
Set Initial conditions to [-1 -2 -3]'.
Two copies of To Workspace, in the Simulink Sinks library
Set Variable name to interleaved and restored, respectively, in the two copies of this block.
Set Save format to Array in each of the two copies of this block.
Connect the blocks as shown in the preceding diagram. From the model window's Simulation menu, select Configuration parameters. In the Configuration Parameters dialog box, set Stop time to 20. Run the simulation and execute the following command:
comparison = [[0:20]', interleaved, restored]
comparison =
0 0 -1
1 -2 -2
2 -3 -3
3 3 -1
4 -2 -2
5 -3 -3
6 6 -1
7 1 -2
8 -3 -3
9 9 -1
10 4 -2
11 -3 -3
12 12 0
13 7 1
14 2 2
15 15 3
16 10 4
17 5 5
18 18 6
19 13 7
20 8 8
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.
The negative numbers in the interleaved and restored sequences come from the interleaving blocks' initial conditions, not from the original data. The first of the original symbols appears in the restored sequence only after a delay of 12 symbols. The delay of the interleaver-deinterleaver combination is the product of the number of shift registers (3) and the maximum delay among all shift registers (4).
For a similar example that also indicates the contents of the shift registers at each step of the process, see Example: Convolutional Interleavers in the Communications Toolbox documentation set.
[1] Berlekamp, E.R., and P. Tong, "Improved Interleavers for Algebraic Block Codes," U. S. Patent 4559625, Dec. 17, 1985.
[2] Clark, George C., Jr., and J. Bibb Cain, Error-Correction Coding for Digital Communications, New York, Plenum Press, 1981.
[3] Forney, G.D., Jr., "Burst-Correcting Codes for the Classic Bursty Channel," IEEE Transactions on Communications, Vol. COM-19, October 1971, pp. 772–781.
[4] Heegard, Chris, and Stephen B. Wicker, Turbo Coding, Boston, Kluwer Academic Publishers, 1999.
[5] Ramsey, J.L, "Realization of Optimum Interleavers," IEEE Transactions on Information Theory, IT-16 (3), May 1970, pp. 338–345.
[6] Takeshita, O.Y., and Costello, D.J., Jr., "New Classes of Algebraic Interleavers for Turbo-Codes," Proc. 1998 IEEE International Symposium on Information Theory, Boston, August, 1998, pp. 419.
![]() | Cyclic Redundancy Check Coding | Analog Modulation | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |