Products & Services Solutions Academia Support User Community Company

Learn more about Communications Toolbox   

fec.ldpcdec - Construct LDPC decoder object

Syntax

l = fec.ldpcdec(H)
l = fec.ldpcdec
decoded = decode(l, llr)

Description

The fec.ldpcdec function creates a low-density parity-check (LDPC) decoder object that you can use with the decode method to decode output from a demodulator.

l = fec.ldpcdec(H) constructs an LDPC decoder object l for a binary systematic LDPC code with a parity-check matrix H.

H must be a sparse zero-one matrix. n and n-k are the number of columns and the number of rows, respectively, in H.

l = fec.ldpcdec constructs an LDPC decoder object l with a default parity-check matrix (32400-by-64800). For more information, see dvbs2ldpc

Properties

The following table describes the properties of an LDPC decoder object.

ParityCheckMatrix specifies the LDPC code. DecisionType, OutputFormat, DoParityChecks, and NumIterations specify settings for the decoding operation. All other properties are read-only.

PropertyDescription
ParityCheckMatrixParity-check matrix of the LDPC code. Stored as a sparse logical matrix with dimension n -k by n (where n >k > 0) of real numbers. All nonzero elements must be equal to 1. The upper bound limit for the value of n is 231-1
BlockLengthTotal number of bits in a codeword, n.
NumInfoBitsNumber of information bits in a codeword, k.
NumParityBitsNumber of parity bits in a codeword, n-k.
DecisionTypeValue can be 'Hard decision' (default) or 'Soft decision'.
OutputFormatValue can be 'Information part' (default) or 'Whole codeword'.
DoParityChecksDetermines whether the parity checks should be verified after each iteration, and whether the decoder should stop iterating if all parity checks are satisfied. Value can be 'Yes' or 'No' (default).
NumIterationsNumber of iterations to be performed for decoding one codeword. Default value is 50.
ActualNumIterationsActual number of iterations executed for the last codeword. Initial value is [].
FinalParityChecks(n-k)-by-1 vector. 1s indicate the parity checks that are not satisfied when the decoder stops. Initial value is [].

When ParityCheckMatrix is changed, the properties BlockLength, NumInfoBits, and NumParityBits are updated.

Setting DoParityChecks to 'Yes' can speed up decoding in some situations by reducing the number of iterations executed.

Decoding Method

This object has a method decode that is used to decode signals.

decoded = decode(l, llr) decodes an LDPC code using the message-passing algorithm, where l is an LDPC decoder object and llr is a 1-by-BlockLength vector.

The results returned in decoded depends on the parameters of the LDPC decoder object.

If the property...is set to...then decoded is...
DecisionType'Hard decision'The decoded bits. See Decoding Algorithm.
DecisionType'Soft decision'The log-likelihood ratios for the decoded bits.
OutputFormat'Information part'A 1-by-NumInfoBits vector.
OutputFormat'Whole codeword'A 1-by-BlockLength vector.

This method uses the properties DecisionType, OutputFormat, NumIterations, and DoParityChecks, and updates the values for FinalParityChecks, and ActualNumIterations.

Decoding Algorithm

The input to the LDPC decoder is the log-likelihood ratio (LLR), , which is defined by the following equation

where is the ith bit of the transmitted codeword, c. There are three key variables in the algorithm: , , and . is initialized as . For each iteration, update , , and using the following equations

where the index sets, and , are chosen as shown in the following example.

Suppose you have the following parity-check matrix H:

For and , the index sets would be

At the end of each iteration, provides an updated estimate of the a posteriori log-likelihood ratio for the transmitted bit .

The soft-decision output for is . The hard-decision output for is 1 if , and 0 otherwise.

If the property DoParityCheck is set to 'no', the algorithm iterates as many times as specified by NumIterations.

If the property DoParityCheck is set to 'yes', then at the end of each iteration the algorithm verifies the parity check equation ( ) and stops if it is satisfied.

In this algorithm, atanh(1) and atanh(-1) are set to be 19.07 and -19.07 respectively to avoid infinite numbers from being used in the algorithm's equations. These numbers were chosen because MATLAB returns 1 for tanh(19.07) and -1 for tanh(-19.07), due to finite precision.

Usage Example

This example demonstrates the use of this object.

enc = fec.ldpcenc;  % Construct a default LDPC encoder object

% Construct a companion LDPC decoder object
dec = fec.ldpcdec;
dec.DecisionType = 'Hard decision';
dec.OutputFormat = 'Information part';
dec.NumIterations = 50;
% Stop if all parity-checks are satisfied
dec.DoParityChecks = 'Yes';

% Generate and encode a random binary message
msg = randint(1,enc.NumInfoBits,2);
codeword = encode(enc,msg);

% Construct a BPSK modulator object
modObj = modem.pskmod('M',2,'InputType','Bit');

% Modulate the signal (map bit 0 to 1 + 0i, bit 1 to -1 + 0i)
modulatedsig = modulate(modObj, codeword);

% Noise parameters
SNRdB = 1;
sigma = sqrt(10^(-SNRdB/10));

% Transmit signal through AWGN channel
receivedsig = awgn(modulatedsig, SNRdB, 0); ...
    % Signal power = 0 dBW

% Visualize received signal
scatterplot(receivedsig)

% Construct a BPSK demodulator object to compute
% log-likelihood ratios
demodObj = modem.pskdemod(modObj,'DecisionType','LLR', ...
     'NoiseVariance',sigma^2);

% Compute log-likelihood ratios (AWGN channel)
llr = demodulate(demodObj, receivedsig);

% Decode received signal
decodedmsg = decode(dec, llr);

% Actual number of iterations executed
disp(['Number of iterations executed = ' ...
     num2str(dec.ActualNumIterations)]);
% Number of parity-checks violated
disp(['Number of parity-checks violated = ' ...
     num2str(sum(dec.FinalParityChecks))]);
% Compare with original message
disp(['Number of bits incorrectly decoded = ' ...
     num2str(nnz(decodedmsg-msg))]);

Example with a Parity-Check Matrix

This example demonstrates the construction of an LDPC decoder object with a parity-check matrix.

i = [1  3  2  4  1  2  3  3  4];   % row indices of 1s
j = [1  1  2  2  3  4  4  5  6];   % column indices of 1s
H = sparse(i,j,ones(length(i),1)); % parity-check matrix H
l = fec.ldpcdec(H);

References

[1] Gallager, Robert G., Low-Density Parity-Check Codes, Cambridge, MA, MIT Press, 1963.

See Also

dvbs2ldpc, fec.ldpcenc, modem

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS