Question Find all the codewords of the 1511 Hamming code and
Question:
Find all the codewords of the (15,11) Hamming code and verify that its minimum distance is equal to 3.
1. Open Malab editor
2. Define Hamming code codeword parameters k to be 11, n to be 15.
3. Define the generator matrix
g=[1 0 0 0 0 0 0 0 0 0 0 1 1 0 0; 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0;
0 0 1 0 0 0 0 0 0 0 0 0 0 1 1;
0 0 0 1 0 0 0 0 0 0 0 1 0 1 0;
0 0 0 0 1 0 0 0 0 0 0 1 0 0 1;
0 0 0 0 0 1 0 0 0 0 0 0 1 0 1;
0 0 0 0 0 0 1 0 0 0 0 1 1 1 0;
0 0 0 0 0 0 0 1 0 0 0 0 1 1 1;
0 0 0 0 0 0 0 0 1 0 0 1 0 1 1;
0 0 0 0 0 0 0 0 0 1 0 1 1 0 1;
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1];
4. Generate all the possible Hamming code words
5. Find the minimum Hamming distance between code words that are generated.
6. Save the matlab file into your machine and run the code
Please HELP!! Again I am terrible with MATLAB!
Solution
clc;
clear all;
N=15;
K=11;
% Input Generator Matrix
g=[1 0 0 0 0 0 0 0 0 0 0 1 1 0 0; 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0;
0 0 1 0 0 0 0 0 0 0 0 0 0 1 1;
0 0 0 1 0 0 0 0 0 0 0 1 0 1 0;
0 0 0 0 1 0 0 0 0 0 0 1 0 0 1;
0 0 0 0 0 1 0 0 0 0 0 0 1 0 1;
0 0 0 0 0 0 1 0 0 0 0 1 1 1 0;
0 0 0 0 0 0 0 1 0 0 0 0 1 1 1;
0 0 0 0 0 0 0 0 1 0 0 1 0 1 1;
0 0 0 0 0 0 0 0 0 1 0 1 1 0 1;
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1];
for a = 1:2^K
for b = K:-1:1
if rem(a-1,2^(-b+K+1))>=2^(-b+K)
w(a,b)=1;
else
w(a,b)=0;
end
end
end
w;
disp(\'The Possible Codewords are :\')
code_word = rem(w*g,2)
d_min = min(sum((code_word(2:2^K,:))\'));
fprintf(\'The Minimum Hamming Distance for given Block Code is=%i\',d_min);

