To add, the relationship between the generation matrix G and the check matrix H: The generated matrix G is a 4*7 matrix, divided into two blocks, the first 4 columns composed of the 4*4 matrix is the unit matrix, the latter 3 columns composed of the 4*3 matrix I call it the supervisory matrix, the check matrix is 3*7 matrix, the first 4 columns of the 3*4 matrix is the monitoring matrix is The 3*3 matrix consisting of the following three columns is the unit matrix.
The constraint relationship between the set (7,4) linear block code information bit and the test bit is:
%C5=C1+C2+C3;C6=C2+C3+C4;C7=C1+C2+C4;
% by the constraint relationship can write out the generated matrix G.
Clear all;
g1=[1,0,0,0;0,1,0,0;0,0,1,0;0,0,0,1];
g2=[1,0,1;1,1,1;1,1,0;0,1,1];
G=[G1,G2];
c=[1,0,1,1]; %C=[C1,C2,C3,C4] to encode the information code word
R1=c*g;
R=mod (r1,2);
fprintf (' output is encoded as:r= ')
Disp (R);
% known to generate matrix G, you can find the check matrix H.
Clear all;
e=[1,1,1,1,1,1,1];
h1=[1,1,1,0;0,1,1,1;1,1,0,1];
h2=[1,0,0;0,1,0;0,0,1];
h=[h1,h2];% Check matrix.
r=[1,0,1,1,0,0,1];% receive the code word.
s1=r* (H '); %s is a school array;
S=mod (s1,2);
For I=1:7; % use the For loop to remove each column in H and add it to S.
T=h (:, [i]);
%disp (T);
B1=s+t ';
B=mod (b1,2);
if (All (B (:) ==0)),% if S and H 's list and b are 0 Matrix, it means that the first code word in R is wrong.
fprintf (the error code bit in the sequence of"R" is:');
Disp (i)
Else
E (1,i) = 0;
End
End
C=mod ((R+e), 2);
fprintf (' corrected code word should be:c= ');
Disp (C);
7-4 matlab program for linear block codes