I am trying to implement the LDPC code for OFDM system, where I input data should be binary of length $1024$ and the output coded data of length $2048$ (means of rate 1/2).

As known in Matlab integrated function, we build the encoder and decoder, respectively, as:

ldpcEncoder = comm.LDPCEncoder;  %Encoder 
ldpcDecoder = comm.LDPCDecoder;  %Decoder

After checking that, I see that parity check matrix is set by default into $32400$ x $64800$ which means the input data length must be a column of length $32400$.

I need the input data to be set manually, for example of length $1024$, how can I modify the parity check of the above encoder?

Thank you

  • 1
    $\begingroup$ Maybe, you should try to build the ldpc manually using your own parameters. $\endgroup$ – Zeyad_Zeyad Jul 17 '20 at 12:53
  • $\begingroup$ Matlab doesn't have a default 32400 x 64800 size: you've entered that somewhere before. You're not showing us all of your code! $\endgroup$ – Marcus Müller Jul 17 '20 at 14:20
  • $\begingroup$ That's all what I entered, I only entered these two commands, and the resulted size is 32400 x 64800. @MarcusMüller $\endgroup$ – Fatima_Ali Jul 17 '20 at 14:42
  • $\begingroup$ @Fatima_Ali these two lines don't output the size, so that can't be all you've done. Do a clear, then post all lines that you had to type to find out the size. $\endgroup$ – Marcus Müller Jul 17 '20 at 14:47
  • 2
    $\begingroup$ @Fatima_Ali the documentation is clear fr.mathworks.com/help/comm/ref/… Specify 'ParityCheckMatrix' in both encoder and decoder. $\endgroup$ – AlexTP Jul 17 '20 at 15:47

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);

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);

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
  • $\begingroup$ Thank you for you help $\endgroup$ – Fatima_Ali Jul 18 '20 at 9:46
  • 1
    $\begingroup$ @Fatima_Ali you are welcome $\endgroup$ – AlexTP Jul 18 '20 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.