# dvbs2ldpc

Low-density parity-check (LDPC) codes from DVB-S.2 standard

## Syntax

``H = dvbs2ldpc(r)``
``H = dvbs2ldpc(r,outputFormat)``

## Description

example

````H = dvbs2ldpc(r)` returns the parity-check matrix `H` of the LDPC code with code rate `r` from the Digital Video Broadcasting standard DVB-S.2. The block length of the code is 64,800.```
````H = dvbs2ldpc(r,outputFormat)` specifies the format for the output parity-check matrix.```

## Examples

collapse all

Create an LDPC parity check matrix for a code rate of 3/5 from the DVB-S.2 standard.

`p = dvbs2ldpc(3/5);`

Create an LDPC encoder object from the parity-check matrix `p`.

`enc = comm.LDPCEncoder(p);`

The parity-check matrix has dimensions of (N-K)-by-N. Calculate the length of the input message.

`msgLength = size(p,2) - size(p,1)`
```msgLength = 38880 ```

## Input Arguments

collapse all

Code rate, specified as `1/4`, `1/3`, `2/5`, `1/2`, `3/5`, `2/3`, `3/4`, `4/5`, `5/6`, `8/9`, or `9/10`.

Data Types: `double`

Output format for parity-check matrix `H`, specified as `'sparse'` or `'indices'`.

If you set this value to `'sparse'`, `H` is a sparse logical matrix. If you set this value to `'indices'`, `H` is a two-column matrix that defines the row and column indices of the 1s in `H`.

Data Types: `char` | `string`

## Output Arguments

collapse all

Parity-check matrix, returned as a matrix.

The default parity-check matrix of size 32,400-by-64,800 corresponds to an irregular LDPC code with the structure shown in this table.

RowNumber of 1s per Row
16
2 to 324007

ColumnNumber of 1s per Column
1 to 129608
12961–324003

Columns from 32,401 to 64,800 form a lower triangular matrix. Only the elements on the main diagonal of the matrix and the subdiagonal immediately below the main diagonal are 1s. This LDPC code is used in conjunction with a BCH code in the DVB-S.2 standard to achieve a packet error rate below ${10}^{-7}$ at about 0.7 dB to 1 dB from the Shannon limit.