As specified in documentation, using 'ParityCheckMatrix'
you can configure the Parity Check Matrix (PCM) during the constructions of the encoder/decoder objects.
The syntax is encoder = comm.LDPCEncoder('ParityCheckMatrix',pcm)
or simply
encoder = comm.LDPCEncoder(pcm);
decoder = comm.LDPCDecoder(pcm);
where pcm
is the desired PCM which must be sparse type.
An example for (probably poor performance) 1024x2048 PCM:
pcm = sparse([eye(1024) eye(1024)]);
encoder = comm.LDPCEncoder(pcm);
decoder = comm.LDPCDecoder(pcm);
%data
m = randi([0 1],1024,1);
%encode then decode. Note the convention of the output of comm.LDPCDecoder
y = 1 - decoder(encoder(m));
%error which equals to 0
biterr(y,m)