Experiment: 5 Object: Find All The Code Words of The (15,11) Hamming Code and Verify
Experiment: 5 Object: Find All The Code Words of The (15,11) Hamming Code and Verify
Experiment: 5 Object: Find All The Code Words of The (15,11) Hamming Code and Verify
EXPERIMENT: 5
Object: Find all the code words of the (15,11) Hamming code and verify
that its minimum distance is equal to 3.
Theory:
Hamming code:
Hamming code is a liner code that is useful for error detection up to two immediate bit errors. It is
capable of single-bit errors.
In Hamming code, the source encodes the message by adding redundant bits in the message. These
redundant bits are mostly inserted and generated at certain positions in the message to accomplish error
detection and correction process.
the first step is to identify the bit position of the data & all the bit positions which are powers of 2 are
marked as parity bits (e.g. 1, 2, 4, 8, etc.). The following image will help in visualizing the received
hamming code of 7 bits.
First, we need to detect whether there are any errors in this received hamming code.
Step 1: For checking parity bit P1, use check one and skip one method, which means, starting from
P1 and then skip P2, take D3 then skip P4 then take D5, and then skip D6 and take D7, this way we
will have the following bits,
As we can observe the total number of bits are odd so we will write the value of parity bit as P1 = 1.
This means error is there.
Step 2: Check for P2 but while checking for P2, we will use check two and skip two method, which
will give us the following data bits. But remember since we are checking for P2, so we have to start our
count from P2 (P1 should not be considered).
As we can observe that the number of 1's are even, then we will write the value of P2 = 0. This means
there is no error.
Step 3: Check for P4 but while checking for P4, we will use check four and skip four method, which
will give us the following data bits. But remember since we are checking for P4, so we have started our
count from P4(P1 & P2 should not be considered).
Name: Kamlesh College ID: 17EC29
As we can observe that the number of 1's are odd, then we will write the value of P4 = 1. This means
the error is there.
So, from the above parity analysis, P1 & P4 are not equal to 0, so we can clearly say that the received
hamming code has errors.
Hamming code generation:
n = 15;
k = 11;
data = randi([0 1],k,1);
encData = encode(data,n,k,'hamming/binary');
encData(4) = ~encData(4);
decData = decode(encData,n,k,'hamming/binary');
numerr = biterr(data,decData)
Output: numerr = 0
message bits=01010101111
encoded data=010101010101111
p=4
[H,G] = hammgen(p);
H = gen2par(G);
M = gf([0 1 0 1 1 1 1 0 1 0 1]);
C = M * G;
d = gfweight(G);
d
Output: d=3