| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Communications Toolbox |
| Contents | Index |
| Learn more about Communications Toolbox |
l = fec.ldpcenc(H)
l = fec.ldpcenc
codeword = encode(l, msg)
The fec.ldpcenc function creates a low-density parity-check (LDPC) encoder object that you can use with the encode method to encode a signal.
l = fec.ldpcenc(H) constructs an LDPC encoder 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. The last n-k columns in H must be an invertible matrix in GF(2).
l = fec.ldpcenc constructs an LDPC encoder object l with a default parity-check matrix (32400-by-64800). For more information, see dvbs2ldpc.
The following table describes the properties of an LDPC encoder object. Only ParityCheckMatrix is writable. All other properties are derived from it.
| Property | Description |
|---|---|
| ParityCheckMatrix | Parity-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 |
| BlockLength | Total number of bits in a codeword, n. |
| NumInfoBits | Number of information bits in a codeword, k. |
| NumParityBits | Number of parity bits in a codeword, n-k. |
| EncodingAlgorithm | Method for solving the parity-check equation to compute the parity bits using the information bits. Set to 'Forward Substitution' if the last n-k columns in H are a lower triangular matrix, 'Backward Substitution' if the last n-k columns in H are an upper triangular matrix, and 'Matrix Inverse' in all other situations. |
This object has a method encode that is used to encode signals.
codeword = encode(l, msg) encodes msg using the LDPC code specified by the LDPC encoder object l. msg must be a binary 1-by-NumInfoBits vector.
codeword is a binary 1-by-BlockLength vector. The first NumInfoBits bits are the information bits (msg) and the last NumParityBits bits are the parity bits. The modulo-2 matrix product of ParityCheckMatrix and codeword' is a zero vector.
![]()
This example demonstrates the use of this object.
% Construct a default LDPC encoder object l = fec.ldpcenc; % Generate a random binary message msg = randint(1,l.NumInfoBits,2); % Encode the message codeword = encode(l, msg); % Verify the parity checks (which should be a zero vector) paritychecks = mod(l.ParityCheckMatrix * codeword', 2);
This example demonstrates the construction of an LDPC encoder 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.ldpcenc(H);
[1] Gallager, Robert G., Low-Density Parity-Check Codes, Cambridge, MA, MIT Press, 1963.
![]() | fec.ldpcdec | fec.bchdec | ![]() |

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 |