The generator matrix for a 10 4 linear block code is given b
The generator matrix for a (10, 4) linear block code is given by
G=[1 0 0 1 1 1 0 1 1 1
1 1 1 0 0 0 1 1 1 0
0 1 1 0 1 1 0 1 0 1
1 1 0 1 1 1 1 0 0 1]
Determine all the code words and the minimum weight of the code. (Using MATLAB)
Lab procedures : generate_code_words_and_find_the_minimum_distance.m
Steps
1. Open Malab editor
2. Define linear block codeword parameters k to be 4, n to be 10.
3. Define the generator matrix
g=[1 0 0 1 1 1 0 1 1 1
1 1 1 0 0 0 1 1 1 0
0 1 1 0 1 1 0 1 0 1
1 1 0 1 1 1 1 0 0 1]
3. Generate all the possible linear block code words
4. Find the minimum Hamming distance between code words that are generated.
5. Save the matlab file into your machine and run the code.
Please Help! I am terrible with MATLAB
Solution
clear;
n=10;
k=4;%no of message bit
%Define the generator matrix
g=[1 0 0 1 1 1 0 1 1 1;
1 1 1 0 0 0 1 1 1 0;
0 1 1 0 1 1 0 1 0 1;
1 1 0 1 1 1 1 0 0 1];
%define all binary inputs;
u = de2bi(0:(2^k - 1),k);
%define codeword
c=rem(u*g,2);
Dmin=min(sum((c(2:2^k,:))\'))%Find the minimum Hamming distance between code words
![The generator matrix for a (10, 4) linear block code is given by G=[1 0 0 1 1 1 0 1 1 1 1 1 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 1 0 1 1 1 0 1 1 1 1 0 0 1] Determine a The generator matrix for a (10, 4) linear block code is given by G=[1 0 0 1 1 1 0 1 1 1 1 1 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 1 0 1 1 1 0 1 1 1 1 0 0 1] Determine a](/WebImages/2/the-generator-matrix-for-a-10-4-linear-block-code-is-given-b-972488-1761496322-0.webp)