Decode binary low-density parity-check (LDPC) code
Communications Toolbox / Error Detection and Correction / Block
The LDPC Decoder block uses the belief propagation algorithm to decode a binary LDPC code, which is input to the block as the soft-decision output (log-likelihood ratio of received bits) from demodulation. The block decodes generic binary LDPC codes where no patterns in the parity-check matrix are assumed. For more information, see Belief Propagation Decoding.
The input and output are discrete-time signals. The ratio of the output sample time to the input sample time is:
N/K when only the information-part of the codeword is decoded
1 when the entire codeword is decoded
N is the length of the received signal and must be in the range (0, 231). K is the length of the uncoded message and must be less than N.
This icon shows all ports, including optional ports, for the LDPC Decoder block.
LDPC Encode and Decode QPSK-Modulated Signal in Simulink
Transmit an LDPC-encoded, QPSK-modulated bit stream through an AWGN channel. Demodulate and decode the received signal. Compute the error statistics.
snr variable is initialized using the
InitFcn callback in Model Properties>Callbacks. The
SNR dB parameter in the AWGN Channel block and the
Variance parameter in the QPSK Demodulator Baseband block initialize settings using the
The simulation is configured to process one input frame of data. The Error Rate Calculation block compares the transmitted binary data stream with the information data bits output by the LDPC Decoder block.
For SNR = 1 dB, the error rate is 0.
In — Log-likelihood ratios
Log-likelihood ratios, specified as an N-by-1
column vector containing the soft-decision output from demodulation.
N is the number of bits in the LDPC codeword
before modulation. Each element is the log-likelihood ratio for a
received bit and the value is more likely to be
the log-likelihood ratio is positive. The first K
elements correspond to the information-part of the input message.
Out — Decoded data
Decoded data, returned as a column vector. The Decision type parameter specifies whether the block outputs hard decisions or soft decisions (log-likelihood ratios).
If the Output format parameter is set to
Information part, the output includes only the information-part of the received codeword.
If the Output format parameter is set to
Whole codeword, the output includes the whole log-likelihood ratio vector.
Iter — Number of executed decoding iterations
Number of executed decoding iterations, returned as a positive integer.
To enable this port, select the Output number of iterations executed parameter.
ParChk — Final parity checks
Final parity checks after decoding the input LDPC code, returned as an (N-K)-by-1 column vector. N is the number of bits in the LDPC codeword before modulation. K is the length of the uncoded message.
To enable this port, select the Output final parity checks parameter.
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Parity-check matrix (sparse binary (N-K)-by-N matrix) — Parity-check matrix
dvbs2ldpc(1/2) (default) | sparse binary matrix | nonsparse index matrix
Parity-check matrix, specified as a sparse (N –
K)-by-N binary-valued matrix.
N is the length of the received signal and must be in
the range (0, 231). K is the
length of the uncoded message and must be less than N.
The last (N – K) columns in the
parity-check matrix must be an invertible matrix in the Galois field of
You can also specify the parity-check matrix as a two-column nonsparse
I, that defines the row and column indices
1s in the parity-check matrix such that
This parameter accepts numeric data types. When you set this parameter to
a sparse binary matrix, this parameter also accepts the
Boolean data type.
The default value uses the
dvbs2ldpc function to
configure a sparse parity-check matrix for half-rate LDPC coding, as
specified in the DVB-S.2 standard.
dvbs2ldpc(R,'indices') configures the index
matrix for the DVB-S.2 standard, where
R is the code
'indices' specifies the output format of
dvbs2ldpc as a two-column double-precision matrix
that defines the row and column indices of the
1s in the
Output format — Output value format
Information part (default) |
Output value format, specified as one of these values:
Information part— The block outputs a K-by-1 column vector containing only the information-part of the received log-likelihood ratio vector. K is the length of the uncoded message.
Whole codeword— The block outputs an N-by-1 column vector containing the whole log-likelihood ratio vector. N is the length of the received signal.
N and K must align with the dimension of the (N–K)-by-K parity-check matrix.
Decision type — Decision method
Hard decision (default) |
Decision method used for decoding, specified as one of these values:
Hard decision— The block outputs decoded data of data type
boolean. Specify this data type using the Output data type parameter.
Soft decision— The block outputs log-likelihood ratios of data type
Output data type — Output value data type
double (default) |
Output value data type, specified as
To enable this parameter, set the Decision type
Number of iterations — Maximum number of decoding iterations
50 (default) | positive integer
Maximum number of decoding iterations, specified as a positive integer.
Stop iterating when all parity-checks are satisfied — Condition for iteration termination
off (default) |
Select this parameter to terminate decoding after all parity checks are satisfied. If not all parity checks are satisfied, decoding terminates after the number of iterations specified by the Number of iterations parameter.
Output number of iterations executed — Output number of iterations executed
off (default) |
Select this parameter to enable the Iter output port.
Output final parity-checks — Output number of iterations executed
off (default) |
Select this parameter to enable the ParChk output port.
This block performs LDPC decoding using the belief propagation algorithm, also known as a message-passing algorithm.
Belief Propagation Decoding
The implementation of the belief propagation algorithm is based on the decoding algorithm presented by Gallager .
For transmitted LDPC-encoded codeword c = c0, c1, …, cn-1, the input to the LDPC decoder is the log-likelihood ratio (LLR) value .
In each iteration, the key components of the algorithm are updated based on these equations:
, initialized as before the first iteration, and
At the end of each iteration, L(Qi) contains the updated estimate of the LLR value for transmitted bit ci. The value L(Qi) is the soft-decision output for ci. If L(Qi) ≤ 0, the hard-decision output for ci is 1. Otherwise, the hard-decision output for ci is 0.
If decoding is configured to stop when all of the parity checks are satisfied, the algorithm verifies the parity-check equation (H c' = 0) at the end of each iteration. When all of the parity checks are satisfied, or if the maximum number of iterations is reached, decoding stops.
Index sets and are based on the parity-check matrix (PCM). Index sets Ci and Vj correspond to all nonzero elements in column i and row j of the PCM, respectively.
This figure shows the computation of these index sets in a given PCM for i = 5 and j = 3.
To avoid infinite numbers in the algorithm equations, atanh(1) and atanh(–1) are set to 19.07 and –19.07, respectively. Due to finite precision, MATLAB® returns 1 for tanh(19.07) and –1 for tanh(-19.07).
 Gallager, Robert G. Low-Density Parity-Check Codes. Cambridge, MA: MIT Press, 1963.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Introduced in R2007a