comm.LDPCEncoder/comm.LDPCDecoder support Systematic codes only. The error
you are receiving suggests that the codes you are using are not Systematic.
However, you can convert your code to a Systematic code and then use
comm.LDPCEncoder/comm.LDPCDecoder. Here is an example of how to convert a
code to Systematic code -
% H is non-systematic, i.e., the last (N-K) columns are not invertible in
GF(2)
% Columns [1 4 6 7 9 10] correspond to the information bits
H = [1 1 0 1 0 0 1 0 1 1
1 1 1 1 0 0 0 0 0 0
0 0 1 1 1 1 1 0 0 1
0 1 0 0 1 0 1 1 1 0];
infobits_loc = [1 4 6 7 9 10];
% Permute H to obtain a systematic code
% This is always possible if H has full rank and if infobits_loc is
% correctly defined
paritybits_loc = setdiff(1:size(H,2),infobits_loc);
H2 = H(:,[infobits_loc paritybits_loc]);
% Create LDPC encoder
encoder = comm.LDPCEncoder(sparse(H2));
% Determine how the output of LDPC encoder should be permuted
[temp,order] = sort([infobits_loc paritybits_loc]);
for i = 1:10000
% Generate random information bits
infobits = rand(size(infobits_loc'))>0.5;
% Generate an intermediate codeword using LDPC encoder object
c = step(encoder,infobits);
% Get the codeword corresponding to H by permuting the intermediate
% codeword in the right order
codeword = c(order);
% Test whether codeword is right. No error should occur
if max(abs(mod(H*codeword,2)))>0
error('Parity-check equations violated');
end
if max(abs(codeword(infobits_loc)-infobits))>0
error('Information bits mismatched');
end
end
HTH,
Chandresh
"Antonio Carlos" <
marcojr...@gmail.com> wrote in message
news:mp5knn$a9s$1...@newscl01ah.mathworks.com...