# wlanHTDataRecover

Recover HT data

## Syntax

``recData = wlanHTDataRecover(rxSig,chEst,noiseVarEst,cfg)``
``recData = wlanHTDataRecover(rxSig,chEst,noiseVarEst,cfg,Name,Value)``
``````[recData,eqSym] = wlanHTDataRecover(___)``````
``````[recData,eqSym,cpe] = wlanHTDataRecover(___)``````

## Description

example

````recData = wlanHTDataRecover(rxSig,chEst,noiseVarEst,cfg)` returns the recovered HT-Data field[1] , `recData`, for input signal `rxSig`. Specify a channel estimate for the occupied subcarriers, `chEst`, a noise variance estimate, `noiseVarEst`, and an HT-Mixed format configuration object, `cfg`.```

example

````recData = wlanHTDataRecover(rxSig,chEst,noiseVarEst,cfg,Name,Value)` specifies algorithm options by using one or more name-value pair arguments. When you do not specify a name-value pair, the function uses the default value.```
``````[recData,eqSym] = wlanHTDataRecover(___)``` also returns the equalized symbols, `eqSym`, using the arguments from the previous syntaxes.```
``````[recData,eqSym,cpe] = wlanHTDataRecover(___)``` also returns the common phase error, `cpe`.```

## Examples

collapse all

Create an HT configuration object having a PSDU length of 1024 bytes. Generate an HTData sequence from a binary sequence whose length is eight times the length of the PSDU.

```cfgHT = wlanHTConfig('PSDULength',1024); txBits = randi([0 1],8*cfgHT.PSDULength,1); txHTSig = wlanHTData(txBits,cfgHT);```

Pass the signal through an AWGN channel with a signal-to-noise ratio of 10 dB.

`rxHTSig = awgn(txHTSig,10);`

Specify a channel estimate. Because fading was not introduced, a vector of ones is a perfect estimate. For a 20 MHz bandwidth, there are 52 data subcarriers and 4 pilot subcarriers in the HT-SIG field.

`chEst = ones(56,1);`

Recover the data bits and determine the number of bit errors. Display the number of bit errors and the associated bit error rate.

```rxBits = wlanHTDataRecover(rxHTSig,chEst,0.1,cfgHT); [numerr,ber] = biterr(rxBits,txBits)```
```numerr = 0 ```
```ber = 0 ```

Create an HT configuration object with a 40 MHz channel bandwidth and a PSDU length of 1024 bytes. Generate the corresponding HT-Data sequence.

```cfg = wlanHTConfig('ChannelBandwidth','CBW40','PSDULength',1024); txBits = randi([0 1],8*cfg.PSDULength,1); txSig = wlanHTData(txBits,cfg);```

Pass the signal through an additive white Gaussian noise (AWGN) channel with a signal-to-noise ratio of 7 dB.

`rxSig = awgn(txSig,7);`

Recover the data and determine the number of bit errors, specifying a zero-forcing algorithm. Because there is no fading, set the channel estimate to a vector of ones whose length is equal to the number of occupied subcarriers.

```chEst = ones(114,1); noiseVarEst = 0.2; recData = wlanHTDataRecover(rxSig,chEst,noiseVarEst,cfg,'EqualizationMethod','ZF'); [numerr,ber] = biterr(recData,txBits);```

## Input Arguments

collapse all

Received HT-Data signal, specified as an NS-by-NR vector or matrix. NS is the number of samples, and NR is the number of receive antennas.

Data Types: `double`
Complex Number Support: Yes

Channel estimate, specified as an NST-by-NSTS-by-NR array. NST is the number of occupied subcarriers, NSTS is the number of space-time streams, and NR is the number of receive antennas.

Data Types: `double`
Complex Number Support: Yes

Noise variance estimate, specified as a nonnegative scalar.

Example: 0.7071

Data Types: `double`

Format configuration, specified as a `wlanHTConfig` object.

### Name-Value Pair Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: `'PilotPhaseTracking','None'` disables pilot phase tracking.

OFDM symbol sampling offset represented as a fraction of the cyclic prefix (CP) length, specified as a scalar in the interval [0, 1]. The value you specify indicates the start location for OFDM demodulation relative to the beginning of the cyclic prefix. The value `0` represents the start of the cyclic prefix and the value `1` represents the end of the cyclic prefix.

Data Types: `double`

Equalization method, specified as one of these values:

• `'MMSE'` — The receiver uses a minimum mean squared error equalizer.

• `'ZF'` — The receiver uses a zero-forcing equalizer.

Data Types: `char` | `string`

Pilot phase tracking, specified as one of these values:

• `'PreEQ'` — Enable pilot phase tracking, which is performed before any equalization operation.

• `'None'` — Disable pilot phase tracking.

Data Types: `char` | `string`

LDPC decoding algorithm, specified as one of these values.

• `'bp'` — Use the belief propagation (BP) decoding algorithm. For more information, see Belief Propagation Decoding.

• `'layered-bp'` — Use the layered BP decoding algorithm, suitable for quasi-cyclic parity check matrices (PCMs). For more information, see Layered Belief Propagation Decoding.

• `'norm-min-sum'` — Use the layered BP decoding algorithm with the normalized min-sum approximation. for more information, see Normalized Min-Sum Decoding.

• `'offset-min-sum'` — Use the layered BP decoding algorithm with the offset min-sum approximation. For more information, see Offset Min-Sum Decoding.

### Note

When you specify this input as `'norm-min-sum'` or `'offset-min-sum'`, the `wlanHTDataRecover` function sets input log-likelihood ratio (LLR) values that are greater than `1e10` or less than `-1e10` to `1e10` and `-1e10`, respectively. The function then uses these values when executing the LDPC decoding algorithm.

#### Dependencies

To enable this argument, specify the `ChannelCoding` property of the `cfg` input as `'LDPC'`.

Data Types: `char` | `string`

Scaling factor for normalized min-sum LDPC decoding, specified as a scalar in the interval (0, 1].

#### Dependencies

To enable this argument, specify the `'``LDPCDecodingMethod``'` name-value pair argument as `'norm-min-sum'`.

Data Types: `double`

Offset for offset min-sum LDPC decoding, specified as a nonnegative scalar.

#### Dependencies

To enable this argument, specify the `'``LDPCDecodingMethod``'` name-value pair argument as `'offset-min-sum'`.

Data Types: `double`

Maximum number of LDPC decoding iterations, specified as a positive integer.

#### Dependencies

To enable this argument, set the `ChannelCoding` property of the `cfg` input to `'LDPC'`.

Data Types: `double`

Enable early termination of LDPC decoding, specified as `1` (`true`) or `0` (`false`).

• When you set this value to `0` (`false`), LDPC decoding completes the number of iterations specified by `'MaximumLDPCIterationCount'` regardless of parity check status.

• When you set this value to `1` (`true`), LDPC decoding terminates when all parity checks are satisfied.

#### Dependencies

To enable this argument, specify the `ChannelCoding` property of the `cfg` input as `'LDPC'`.

Data Types: `logical`

## Output Arguments

collapse all

Recovered binary output data, returned as a column vector of length 8×NPSDU, where NPSDU is the length of the PSDU in bytes. See `wlanHTConfig` for `PSDULength` details.

Data Types: `int8`

Equalized symbols, returned as an NSD-by-NSYM-by-NSS array. NSD is the number of data subcarriers, NSYM is the number of OFDM symbols in the HT-Data field, and NSS is the number of spatial streams.

Data Types: `double`
Complex Number Support: Yes

Common phase error in radians, returned as a column vector having length NSYM. NSYM is the number of OFDM symbols in the HT-Data field.

collapse all

### HT-Data field

The high throughput data field (HT-Data) follows the last HT-LTF of an HT-mixed packet.

The high throughput data field is used to transmit one or more frames from the MAC layer and consists of four subfields.

• Service field — Contains 16 zeros to initialize the data scrambler.

• PSDU — Variable-length field containing the PLCP service data unit (PSDU). In 802.11™, the PSDU can consist of an aggregate of several MAC service data units.

• Tail — Tail bits required to terminate a convolutional code. The field uses six zeros for each encoding stream.

• Pad Bits — Variable-length field required to ensure that the HT-Data field consists of an integer number of symbols.

### HT-Mixed

High throughput mixed (HT-mixed) format devices support a mixed mode in which the PLCP header is compatible with HT and Non-HT modes.

## Algorithms

collapse all

The `wlanHTDataRecover` function supports these four LDPC decoding algorithms.

### Belief Propagation Decoding

The `wlanHTDataRecover` function implements the BP algorithm based on the decoding algorithm presented in [2]. For transmitted LDPC-encoded codeword $c=\left({c}_{0},{c}_{1},\dots ,{c}_{n-1}\right)$, the input to the LDPC decoder is the LLR given by

.

In each iteration, the function updates the key components of the algorithm based on these equations:

$L\left({r}_{ji}\right)=2\text{\hspace{0.17em}}\text{atanh}\text{\hspace{0.17em}}\left(\prod _{{i}^{\prime }\in {V}_{j}\\left\{i\right\}}\mathrm{tanh}\left(\frac{1}{2}L\left({q}_{{i}^{\prime }j}\right)\right)\right)$,

$L\left({q}_{ij}\right)=L\left({c}_{i}\right)+\sum _{j\text{'}\in {C}_{i}\\left\{j\right\}}L\left({r}_{{j}^{\prime }i}\right)$, initialized as $L\left({q}_{ij}\right)=L\left({c}_{i}\right)$ before the first iteration, and

$L\left({Q}_{i}\right)=L\left({c}_{i}\right)+\sum _{{j}^{\prime }\in {C}_{i}}L\left({r}_{{j}^{\prime }i}\right)$.

At the end of each iteration, $L\left({Q}_{i}\right)$ is an updated estimate of the LLR value for the transmitted bit, ${c}_{i}$. The value $L\left({Q}_{i}\right)$ is the soft-decision output for ${c}_{i}$. If $L\left({Q}_{i}\right)$ is negative, the hard-decision output for ${c}_{i}$ is 1. Otherwise, the output is 0.

Index sets ${C}_{i}\\left\{j\right\}$ and ${V}_{j}\\left\{i\right\}$ are based on the PCM such that the sets ${C}_{i}$ and ${V}_{j}$ correspond to all nonzero elements in column i and row j of the PCM, respectively.

This figure demonstrates how to compute these index sets for PCM $H$ for the case 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).

When you specify the `'``EarlyTermination``'` name-value pair argument as `0` (`false`), the decoding terminates after the number of iterations specified by the `'``MaximumLDPCIterationCount``'` name-value pair argument. When you specify the `'``EarlyTermination``'` name-value pair argument as `1` (`true`), the decoding terminates when all parity checks are satisfied ($H{c}^{T}=0$) or after the number of iterations specified by the `'``MaximumLDPCIterationCount``'` name-value pair argument.

### Layered Belief Propagation Decoding

The `wlanHTDataRecover` function implements the layered BP algorithm based on the decoding algorithm presented in Section II.A of [3]. The decoding loop iterates over subsets of rows (layers) of the PCM.

For each row, m, in a layer and each bit index, j, the implementation updates the key components of the algorithm based on these equations.

(1) $L\left({q}_{mj}\right)=L\left({q}_{j}\right)-{R}_{mj}$

(2) $\Psi \left(x\right)=\mathrm{log}\left(|\mathrm{tanh}\left(x/2\right)|\right)$

(3) ${A}_{mj}=\sum _{n\in N\left(m\right)\\left\{j\right\}}\Psi \left(L\left({q}_{mn}\right)\right)$

(4) ${s}_{mj}=\prod _{n\in N\left(m\right)\\left\{j\right\}}\mathrm{sgn}\left(L\left({q}_{mn}\right)\right)$

(5) ${R}_{mj}=-{s}_{mj}\Psi \left({A}_{mj}\right)$

(6) $L\left({q}_{j}\right)=L\left({q}_{mj}\right)+{R}_{mj}$

For each layer, the decoding equation (6) works on the combined input obtained from the current LLR inputs, $L\left({q}_{mj}\right)$, and the previous layer updates, ${R}_{mj}$.

Because the layered BP algorithm updates only a subset of the nodes in a layer, this algorithm is faster than the BP algorithm. To achieve the same error rate as attained with BP decoding, use half the number of decoding iterations when using the layered BP algorithm.

### Normalized Min-Sum Decoding

The `wlanHTDataRecover` function implements the normalized min-sum decoding algorithm by following the layered BP algorithm with equation (3) replaced by

${A}_{mj}={\mathrm{min}}_{n\in N\left(m\right)\\left\{j\right\}}\left(\alpha |L\left({q}_{mn}\right)|\right)$,

where α is the scaling factor specified by the `'``MinSumScalingFactor``'` name-value pair argument. This equation is an adaptation of equation (4) presented in [4].

### Offset Min-Sum Decoding

The `wlanHTDataRecover` function implements the offset min-sum decoding algorithm by following the layered BP algorithm with equation (3) replaced by

,

where β is the offset specified by the `'``MinSumOffset``'` name-value pair argument. This equation is an adaptation of equation (5) presented in [4].

## References

[1] IEEE Std 802.11-2016 (Revision of IEEE Std 802.11-2012). “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications.” IEEE Standard for Information technology — Telecommunications and information exchange between systems. Local and metropolitan area networks — Specific requirements.

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

[3] Hocevar, D.E. "A Reduced Complexity Decoder Architecture via Layered Decoding of LDPC Codes." In IEEE Workshop on Signal Processing Systems, 2004. SIPS 2004., 107-12. Austin, Texas, USA: IEEE, 2004. https://doi.org/10.1109/SIPS.2004.1363033.

[4] Jinghu Chen, R.M. Tanner, C. Jones, and Yan Li. "Improved Min-Sum Decoding Algorithms for Irregular LDPC Codes." In Proceedings. International Symposium on Information Theory, 2005. ISIT 2005., 449-53, 2005. https://doi.org/10.1109/ISIT.2005.1523374.