This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

comm.LDPCEncoder System object

Package: comm

Encode binary low-density parity-check code


The LDPCEncoder object encodes a binary low-density parity-check code.

To encode a binary low-density parity-check code:

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

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

    Note:   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.LDPCEncoder creates a binary low-density parity-check (LDPC) encoder System object, h. This object performs LDPC encoding based on the specified parity-check matrix.

h = comm.LDPCEncoder('ParityCheckMatrix',Value) creates an LDPC encoder object, h, with the ParityCheckMatrix property set to the specified value.

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



Parity-check matrix

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, which is the result of dvbs2ldpc(1/2).

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.


cloneCreate LDPC Encoder object with same property values
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
stepEncode input using LDPC coding scheme


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


This object implements the algorithm, inputs, and outputs described on the LDPC Encoder block reference page. The object properties correspond to the block parameters.

Introduced in R2012a

Was this topic helpful?