LDPC Decoder
Decode binary lowdensity paritycheck (LDPC) code
Libraries:
Communications Toolbox /
Error Detection and Correction /
Block
Description
The LDPC Decoder block uses the belief propagation algorithm to decode a binary LDPC code, which is input to the block as the softdecision output (loglikelihood ratio of received bits) from demodulation. The block decodes generic binary LDPC codes where no patterns in the paritycheck matrix are assumed. For more information, see Belief Propagation Decoding.
The input and output are discretetime signals. The ratio of the output sample time to the input sample time is:
N/K when only the informationpart 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, 2^{31}). 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.
Examples
LDPC Encode and Decode QPSKModulated Signal in Simulink
Transmit an LDPCencoded, QPSKmodulated bit stream through an AWGN channel. Demodulate and decode the received signal. Compute the error statistics.
The 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 snr
variable.
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.
Ports
Input
In — Loglikelihood ratios
column vector
Loglikelihood ratios, specified as an Nby1
column vector containing the softdecision output from demodulation.
N is the number of bits in the LDPC codeword
before modulation. Each element is the loglikelihood ratio for a
received bit and the value is more likely to be 0
if
the loglikelihood ratio is positive. The first K
elements correspond to the informationpart of the input message.
Data Types: double
Output
Out — Decoded data
column vector
Decoded data, returned as a column vector. The Decision type parameter specifies whether the block outputs hard decisions or soft decisions (loglikelihood ratios).
If the Output format parameter is set to
Information part
, the output includes only the informationpart of the received codeword.If the Output format parameter is set to
Whole codeword
, the output includes the whole loglikelihood ratio vector.
Data Types: double
 Boolean
Iter — Number of executed decoding iterations
positive integer
Number of executed decoding iterations, returned as a positive integer.
Dependencies
To enable this port, select the Output number of iterations executed parameter.
Data Types: double
ParChk — Final parity checks
column vector
Final parity checks after decoding the input LDPC code, returned as an (NK)by1 column vector. N is the number of bits in the LDPC codeword before modulation. K is the length of the uncoded message.
Dependencies
To enable this port, select the Output final parity checks parameter.
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink^{®} Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Paritycheck matrix (sparse binary (NK)byN matrix) — Paritycheck matrix
dvbs2ldpc(1/2)
(default)  sparse binary matrix  nonsparse index matrix
Paritycheck matrix, specified as a sparse (N –
K)byN binaryvalued matrix.
N is the length of the received signal and must be in
the range (0, 2^{31}). K is the
length of the uncoded message and must be less than N.
The last (N – K) columns in the
paritycheck matrix must be an invertible matrix in the Galois field of
order 2, gf
(2).
You can also specify the paritycheck matrix as a twocolumn nonsparse
index matrix, I
, that defines the row and column indices
of the 1
s in the paritycheck matrix such that
sparse(I(:,1),I(:,2),1)
.
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 paritycheck matrix for halfrate LDPC coding, as
specified in the DVBS.2 standard.
Example: dvbs2ldpc(R,'indices')
configures the index
matrix for the DVBS.2 standard, where R
is the code
rate, and 'indices'
specifies the output format of
dvbs2ldpc
as a twocolumn doubleprecision matrix
that defines the row and column indices of the 1
s in the
paritycheck matrix.
Output format — Output value format
Information part
(default)  Whole codeword
Output value format, specified as one of these values:
Information part
— The block outputs a Kby1 column vector containing only the informationpart of the received loglikelihood ratio vector. K is the length of the uncoded message.Whole codeword
— The block outputs an Nby1 column vector containing the whole loglikelihood ratio vector. N is the length of the received signal.N and K must align with the dimension of the (N–K)byK paritycheck matrix.
Decision type — Decision method
Hard decision
(default)  Soft decision
Decision method used for decoding, specified as one of these values:
Hard decision
— The block outputs decoded data of data typedouble
orboolean
. Specify this data type using the Output data type parameter.Soft decision
— The block outputs loglikelihood ratios of data typedouble
.
Output data type — Output value data type
double
(default)  boolean
Output value data type, specified as double
or
boolean
.
Dependencies
To enable this parameter, set the Decision type
parameter to Hard decision
.
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 paritychecks are satisfied — Condition for iteration termination
off
(default)  on
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)  on
Select this parameter to enable the Iter output port.
Output final paritychecks — Output number of iterations executed
off
(default)  on
Select this parameter to enable the ParChk output port.
Block Characteristics
Data Types 

Multidimensional Signals 

VariableSize Signals 

Algorithms
This block performs LDPC decoding using the belief propagation algorithm, also known as a messagepassing algorithm.
Belief Propagation Decoding
The implementation of the belief propagation algorithm is based on the decoding algorithm presented by Gallager [2].
For transmitted LDPCencoded codeword c = c_{0}, c_{1}, …, c_{n}_{1}, the input to the LDPC decoder is the loglikelihood ratio (LLR) value $$L({c}_{i})=\mathrm{log}\left(\frac{\mathrm{Pr}({c}_{i}=0\text{channeloutputfor}{c}_{i})}{\mathrm{Pr}({c}_{i}=1\text{channeloutputfor}{c}_{i})}\right)$$.
In each iteration, the key components of the algorithm are updated based on these equations:
$$L({r}_{ji})=2\text{\hspace{0.17em}}\text{atanh}\text{\hspace{0.17em}}\left({\displaystyle \prod _{{i}^{\prime}\in {V}_{j}\backslash i}\mathrm{tanh}\left(\frac{1}{2}L({q}_{{i}^{\prime}j})\right)}\right)$$,
$$L({q}_{ij})=L({c}_{i})+{\displaystyle \sum _{{j}^{\prime}\in {C}_{i}\backslash j}L({r}_{{j}^{\prime}i})}$$, initialized as $$L({q}_{ij})=L({c}_{i})$$ before the first iteration, and
$$L({Q}_{i})=L({c}_{i})+{\displaystyle \sum _{{j}^{\prime}\in {C}_{i}}L({r}_{{j}^{\prime}i})}$$.
At the end of each iteration, L(Q_{i}) contains the updated estimate of the LLR value for transmitted bit c_{i}. The value L(Q_{i}) is the softdecision output for c_{i}. If L(Q_{i}) ≤ 0, the harddecision output for c_{i} is 1. Otherwise, the harddecision output for c_{i} is 0.
If decoding is configured to stop when all of the parity checks are satisfied, the algorithm verifies the paritycheck 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 $${C}_{i}\backslash j$$ and $${V}_{j}\backslash i$$ are based on the paritycheck matrix (PCM). Index sets C_{i} and V_{j} 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).
References
[1] Gallager, Robert G. LowDensity ParityCheck Codes. Cambridge, MA: MIT Press, 1963.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2007a
See Also
Blocks
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)