Experiment: 2 Object

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

0112EC071102

EC-2 (BIST)

EXPERIMENT: 2
OBJECT:
To simulate Hamming code using the binary format, and a Reed-Solomon code
using the integer format.
INTRODUCTION:
Binary Format (All Coding Methods)
You can structure messages and codewords as binary vector signals, where each vector
represents a message word or a codeword. At a given time, the encoder receives an entire
message word, encodes it, and outputs the entire codeword. The message and code signals share
the same sample time.

Integer Format (Reed-Solomon Only)


A message word for an [N,K] Reed-Solomon code consists of M*K bits, which you can interpret
as K symbols between 0 and 2M. The symbols are binary sequences of length M, corresponding
to elements of the Galois field GF(2M), in descending order of powers. The integer format for
Reed-Solomon codes lets you structure messages and codewords as integer signals instead of
binary signals. (The input must be a frame-based column vector.)
LAB WORK:
Hamming Code in Binary Format
This example shows very simply how to use an encoder and decoder. It illustrates the appropriate
vector lengths of the code and message signals for the coding blocks. Because the Error Rate
Calculation block accepts only scalars or frame-based column vectors as the transmitted and
received signals, this example uses frame-based column vectors throughout. (It thus avoids
having to change signal attributes using a block such as Convert 1-D to 2-D.)

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY, BHOPAL


0112EC071102
EC-2 (BIST)

To build the model, gather and configure these blocks:


• Bernoulli Binary Generator, in the Comm Sources library
○ Set Probability of a zero to .5.
○ Set Initial seed to any positive integer scalar, preferably the output of the
randseed function.
○ Check the Frame-based outputs check box.
○ Set Samples per frame to 4.
• Hamming Encoder, with default parameter values
• Hamming Decoder, with default parameter values
• Error Rate Calculation, in the Comm Sinks library, with default parameter values
Connect the blocks as in the preceding figure. Use the Signal dimensions feature from the
Port/signal displays submenu of the model window's Format menu. After updating the diagram
if necessary (Update diagram from the Edit menu), the connector lines show relevant signal
attributes. The connector lines are double lines to indicate frame-based signals, and the
annotations next to the lines show that the signals are column vectors of appropriate sizes.

Result:-
Here we get without Hamming Block there is :
Bit Error Rate:- 0.0099
Total Error :- 100
Total Symbol :- 1.01e + 004

And with Hamming Block


Bit Error Rate:- 0.00106
Total Error :- 101
Total Symbol :- 9.474e + 004

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY, BHOPAL


0112EC071102
EC-2 (BIST)

Reed-Solomon Code in Integer Format


This example uses a Reed-Solomon code in integer format. It illustrates the appropriate vector
lengths of the code and message signals for the coding blocks. It also exhibits error correction,
using a very simple way of introducing errors into each codeword.

To build the model, gather and configure these blocks:


• Random Integer Generator, in the Comm Sources library
○ Set M-ary number to 15.
○ Set Initial seed to a positive number, randseed(0) is chosen here.
○ Check the Frame-based outputs check box.
○ Set Samples per frame to 5.
• Integer-Input RS Encoder
○ Set Codeword length N to 15.
○ Set Message length K to 5.
• Gain, in the Simulink Math Operations library
○ Set Gain to [0; 0; 0; 0; 0; ones(10,1)].
• Integer-Output RS Decoder
○ Set Codeword length N to 15.
○ Set Message length K to 5.
• Scope, in the Simulink Sinks library. Get two copies of this block.
• Sum, in the Simulink Math Operations library
○ Set List of signs to |-+

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY, BHOPAL


0112EC071102
EC-2 (BIST)

Connect the blocks as in the preceding figure. From the model window's Simulation menu,
select Configuration parameters. In the Configuration Parameters dialog box, set Stop time to
500.
The vector length numbers appear on the connecting lines only if you select Signal dimensions
from the Port/signal displays submenu of the model's Format menu. The encoder accepts a
vector of length 5 (which is K in this case) and produces a vector of length 15 (which is N in this
case). The decoder does the opposite.
Running the model produces the following scope images.

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY, BHOPAL

You might also like