0% found this document useful (0 votes)
47 views4 pages

Hamming

The document describes an experiment to implement systematic and non-systematic Hamming codes in Scilab. It provides background on Hamming codes, which add parity bits to detect and correct errors. The experiment involves generating codewords from message polynomials using a generator polynomial for both systematic and cyclic Hamming codes. The codewords are produced correctly for both methods according to the output displayed. In conclusion, the experiment on implementing Hamming codes in Scilab was performed successfully without errors.

Uploaded by

prajakti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views4 pages

Hamming

The document describes an experiment to implement systematic and non-systematic Hamming codes in Scilab. It provides background on Hamming codes, which add parity bits to detect and correct errors. The experiment involves generating codewords from message polynomials using a generator polynomial for both systematic and cyclic Hamming codes. The codewords are produced correctly for both methods according to the output displayed. In conclusion, the experiment on implementing Hamming codes in Scilab was performed successfully without errors.

Uploaded by

prajakti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

EXPERIMENT NO.

AIM: To study and implement Systematic and Non-Systematic Hamming Code on SCILAB.
Apparatus: Scilab software.
Theory:
In coding theory, Hamming (7,4) is a linear error-correcting code that encodes four bits of data
into seven bits by adding three parity bits. It is a member of a larger family of Hamming codes,
but the term Hamming code often refers to this specific code that Richard W. Hamming introduced
in 1950. At the time, Hamming worked at Bell Telephone Laboratories and was frustrated with the
error-prone punched card reader, which is why he started working on error-correcting codes.[1]
The Hamming code adds three additional check bits to every four data bits of the message.
Hamming's (7,4) algorithm can correct any single-bit error, or detect all single-bit and two-bit
errors. In other words, the minimal Hamming distance between any two correct codewords is 3,
and received words can be correctly decoded if they are at a distance of at most one from the
codeword that was transmitted by the sender. This means that for transmission medium situations
where burst errors do not occur, Hamming's (7, 4) code is effective (as the medium would have to
be extremely noisy for two out of seven bits to be flipped).
In telecommunication, Hamming codes are a family of linear error-correcting codes. Hamming
codes can detect up to two-bit errors or correct one-bit errors without detection of uncorrected
errors. By contrast, the simple parity code cannot correct errors, and can detect only an odd number
of bits in error. Hamming codes are perfect codes, that is, they achieve the highest possible rate for
codes with their block length and minimum distance of three.
Parity bits –
A parity bit is a bit appended to a data of binary bits to ensure that the total number of 1’s in the
data are even or odd. Parity bits are used for error detection. There are two types of parity bits.
1. Even parity bit:
In the case of even parity, for a given set of bits, the number of 1’s are counted. If that count is
odd, the parity bit value is set to 1, making the total count of occurrences of 1’s an even number.
If the total number of 1’s in a given set of bits is already even, the parity bit’s value is 0.

2. Odd Parity bit –


In the case of odd parity, for a given set of bits, the number of 1’s are counted. If that count is
even, the parity bit value is set to 1, making the total count of occurrences of 1’s an odd number.
If the total number of 1’s in a given set of bits is already odd, the parity bit’s value is 0.
Algorithm:
Systematic:
1. Take a generator polynomial ‘g’.
2. Take a message polynomial ‘m’.
3. Specify the dimensions of Code i.e. (n,k).
4. Calculate the remainder of the function s^(n-k)*m when divided by g. Perform the
normal polynomial division.
5. Generate the Systematic Code word by adding the obtained remainder to the function
s^(n-k)*m.
Cyclic:
1. Take a generator polynomial ‘g’.
2. Take a message polynomial ‘m’.
3. Specify the dimension of the code i.e. (n,k).
4. Multiply the generator polynomial with the message polynomial to obtain the desired
codeword.

Code:
Systematic:
clc

g = 1+ s + s^3;
disp("Generator matrix polynomial =");
disp(g);
m = 1 + s^2 + s^3;
disp("message polynomial");
disp(m);

n=15;
k=11;

s=poly(0,'s');
p1=s^(n-k)*m;
p2=g;
[r,q]=pdiv(p1,p2)
disp(r);
//disp(q);
A=s^(n-k)*m+r;

disp (A);
[d]=coeff(A);
for i =1:7;
if (modulo(d(1,i),2)== 0) then
d(1,i)=0;
else
d(1,i)=1;
end,
end

disp ("codeword ");


disp([d]);

Cyclic:

clc
s=poly(0,"s");
g = 1+ s + s^3;
disp("Generator matrix polynomial =");
disp(g);
m = 1 + s^2 + s^3;
disp("message polynomial");
disp(m);
c= g *m;
disp("codeword polynomial");
disp(c);
[d]=coeff(c);
for i =1:7;
if (modulo(d(1,i),2)== 0) then
d(1,i)=0;
else
d(1,i)=1;
end,
end
e= degree(d);
//end
//disp (e);
disp ("codeword ");
disp([d]);
Output:
Systematic:

Cyclic:

Conclusion: The experiment on Hamming Code was performed and executed successfully
without any error.

You might also like