This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Decode binary low-density parity-check code


The LDPCDecoder object decodes a binary low-density parity-check code.

This object performs LDPC decoding, on the soft-decision output (log-likelihood ratio of received bits) from demodulation, using the belief-passing or message-passing algorithm, implemented as the log-domain sum-product algorithm. For more information, see Algorithms. To decode a binary low-density parity-check code:

  1. Define and set up your binary low-density parity-check decoder object. See Construction.

  2. Call step to decode a binary low-density parity-check code according to the properties of comm.LDPCDecoder. The behavior of step is specific to each object in the toolbox.


Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


h = comm.LDPCDecoder creates a binary low-density parity-check (LDPC) decoder System object, h. This object performs LDPC decoding based on the specified parity-check matrix, where the object does not assume any patterns in the parity-check matrix.

h = comm.LDPCDecoder('PropertyName','ValueName') creates an LDPC encoder object, h, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as ('PropertyName1','PropertyValue1',...,'PropertyNameN','PropertyValueN').

h = comm.LDPCDecoder(P) creates an LDPC decoder object, h, where the input P specifies the parity check matrix.


expand all

Specify the parity-check matrix as a binary valued sparse matrix P with dimension (NK)-by-N, where N > K > 0. The last N−K columns in the parity check matrix must be an invertible matrix in GF(2). Alternatively, you can specify a two-column, non-sparse integer index matrix I that defines the row and column indices of the 1s in the parity-check matrix, such that P = sparse(I(:,1), I(:,2), 1).

This property accepts numeric data types. When you set this property to a sparse matrix, it also accepts a logical data type. The upper bound for the value of N is 231-1.

The default is the sparse parity-check matrix of the half-rate LDPC code from the DVB-S.2 standard.

To generate code, set this property to a non-sparse index matrix. For instance, you can obtain the index matrix for the DVB-S.2 standard from dvbs2ldpc(R,'indices') with the second input argument explicitly specified to indices, where R represents the code rate.

Specify the output value format as 'Information part' or 'Whole codeword'. When you set this property to 'Information part', the output contains only the message bits and is a K element column vector, assuming an (NK)-by-K parity check matrix. When you set this property to 'Whole codeword', the output contains the codeword bits and is an N element column vector.

Specify the decision method used for decoding as either 'Hard decision' or 'Soft decision'. When you set this property to 'Hard decision', the output is decoded bits of data type double or logical. When you set this property to 'Soft decision', the output is log-likelihood ratios of data type double.

Specify the maximum number of iterations the object uses as a positive integer.

Specify the condition to stop the decoding iterations as either 'Maximum iteration count' or 'Parity check satisfied'. When you set this property to 'Maximum iteration count', the object will iterate for the number of iterations you specify in the MaximumIterationCount property. When you set this property to 'Parity check satisfied', the object will determine if the parity checks are satisfied after each iteration and stops if all parity checks are satisfied.

To output the number of iterations performed, set this property to true.

To output the final calculated parity checks, set this property to true.


stepDecode input using LDPC decoding scheme
Common to All System Objects

Allow System object property value changes


Transmit an LDPC-encoded, QPSK-modulated bit stream through an AWGN channel, then demodulate, decode, and count errors.

    hEnc = comm.LDPCEncoder;
    hMod = comm.PSKModulator(4, 'BitInput',true);
    hChan = comm.AWGNChannel(...
            'NoiseMethod','Signal to noise ratio (SNR)','SNR',1);
    hDemod = comm.PSKDemodulator(4, 'BitOutput',true,...
            'DecisionMethod','Approximate log-likelihood ratio', ...
            'Variance', 1/10^(hChan.SNR/10));
    hDec = comm.LDPCDecoder;
    hError = comm.ErrorRate;
    for counter = 1:10
      data           = logical(randi([0 1], 32400, 1));
      encodedData    = step(hEnc, data);
      modSignal      = step(hMod, encodedData);
      receivedSignal = step(hChan, modSignal);
      demodSignal    = step(hDemod, receivedSignal);
      receivedBits   = step(hDec, demodSignal);
      errorStats     = step(hError, data, receivedBits);
    fprintf('Error rate       = %1.2f\nNumber of errors = %d\n', ...
      errorStats(1), errorStats(2))


expand all

This object performs LDPC decoding using the belief-passing or message-passing algorithm, implemented as the log-domain sum-product algorithm.

Extended Capabilities

Introduced in R2012a