How to use the LDPC encoder/decoder in MATLAB ?

Greetings,
I am simply trying to use the LDPC encoder/decoder in MATLAB. A very small code like the following:
message = randi([0 1],2,1);
ldpcEncoder = comm.LDPCEncoder;
ldpcDecoder = comm.LDPCDecoder;
encoder = ldpcEncoder(message);
decoder = ldpcDecoder(encoder);
is throwing an error :
Error using LDPCEncoder
Input must be a column vector of length K, the message length. K is the number of columns in the parity check matrix minus the number of rows.
I presume when we don't mention a parity check matrix it takes a default value as described in dvbs2ldpc. So here, I really don't know what's happening even with such a simple code. Please guide me through it. Thank you !

 採用された回答

Harikrishnan Balachandran Nair
Harikrishnan Balachandran Nair 2021 年 8 月 20 日

0 投票

Hi,
From my Understanding, you are facing an error related to the size of your message ,when trying to perform LDPC coding. As you have mentioned in the question, when a parity check matrix is not specified, the default sparse parity check matrix is obtained as dvbs2ldpc(1/2), which returns the parity-check matrix H of the LDPC code with code rate (1/2) from the Digital Video Broadcasting standard DVB-S.2. The block length of the code is 64,800. Hence the size of the parity check matrix H is 32400*64800. Thus the size of your message should be (64800-32400), as the dimension of the matrix H is (N-K) by (N) , where K is the size of your message, and N is the block length of the code. You can see that the error no longer exists when the following code is executed. Hope this helps!
message = randi([0 1],32400,1);
ldpcEncoder = comm.LDPCEncoder;
ldpcDecoder = comm.LDPCDecoder;
encoder = ldpcEncoder(message);
decoder = ldpcDecoder(encoder);

4 件のコメント

Das Siddharth
Das Siddharth 2021 年 8 月 20 日
Thank you so much for your response ! If I have to perform LDPC on some of the customized sizes let's say codelength of 7 or 11. Can we set the parity matrix as per our need ? If so how can we do that ? Because I couldn't find proper documentaion for LDPC.
Harikrishnan Balachandran Nair
Harikrishnan Balachandran Nair 2021 年 8 月 20 日
編集済み: Harikrishnan Balachandran Nair 2021 年 8 月 20 日
Yes you can set the parity matrix as your need, provided it follows the corresponding properties. You can find more about it here : https://www.mathworks.com/help/comm/ref/comm.ldpcencoder-system-object.html#bsyh0xo-5 .
Rupali c
Rupali c 2023 年 5 月 10 日
The both arrays message and decoder should be same. but actually why are they different?
Amit Kansal
Amit Kansal 2023 年 11 月 20 日
The input to the decoder must be LLRs (log-likelihood ratios), while what is passed in are binary bits.
Using
decoder = ldpcDecoder(1-2*encoder);
to map the logical 0 to a 1 and logical 1 to a -1, gives message as the expected decoded output.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange802.11n/ac (Wi-Fi 4 and Wi-Fi 5) についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by