(3,1,4)编码,信息取八位
约束关系为: y1=m1 y2=m1+m2+m3+m4 y3=m1+m3+m4
>> M=randint(1,8)
M =
1 0 1 0 1 1 0 0
>> g=[1,1,1,0,1,1,0,1,0,0,1,1];
>>G=[g,zeros(1,12);zeros(1,3),g,zeros(1,9);zeros(1,6),g,zeros(1,6);zeros(1,9),g,zeros(1,3);zeros(1,12),g;zeros(1,15),1,1,1,0,1,1,0,1,0;zeros(1,18),1,1,1,0,1,1;zeros(1,21),1,1,1];
>> Y=M*G
Y =
Columns 1 through 18
1 1 1 0 1 1 1 2 1 0 2 2 1 2 1 1 3 3
Columns 19 through 24
0 2 1 0 2 1
>> for i=1:1:24
if Y(i)>1
Y(i)=mod(Y(i),2);
else Y(i)=Y(i);
end
end
>> Y
Y =
Columns 1 through 17
1 1 1 0 1 1 1 0 1 0 0 0 1 0 1 1 1
Columns 18 through 24
1 0 0 1 0 0 1 |