# wlanHTDataRecover

Recover bits from HT-Data field

## Syntax

``dataBits = wlanHTDataRecover(rxDataSig,chEst,noiseVarEst,cfgHT)``
``dataBits = wlanHTDataRecover(rxDataSig,chEst,noiseVarEst,cfgHT,Name,Value)``
``````[dataBits,eqSym] = wlanHTDataRecover(___)``````
``````[dataBits,eqSym,cpe] = wlanHTDataRecover(___)``````

## Description

example

````dataBits = wlanHTDataRecover(rxDataSig,chEst,noiseVarEst,cfgHT)` recovers `dataBits`, a column vector of bits, from `rxDataSig`, the received HT-Data field of a high-throughput-mixed (HT-mixed) transmission. The function recovers `dataBits` by using `chEst`, a channel estimate for the occupied subcarriers, `noiseVarEst`, an estimate of noise variance, and `cfgHT`, a configuration object that contains HT transmission parameters.For more information about the HT-Data field, see HT-Data Field. For more information about the HT-mixed format, see HT-Mixed Format.```
````dataBits = wlanHTDataRecover(rxDataSig,chEst,noiseVarEst,cfgHT,Name,Value)` specifies algorithm options by using one or more name-value pair arguments. For example, `'LDPCDecodingMethod','layered-bp'` specifies the layered belief propagation low-density parity-check (LDPC) decoding algorithm.```
``````[dataBits,eqSym] = wlanHTDataRecover(___)``` returns `eqSym`, the equalized OFDM symbols that comprise the data subcarriers of the HT-Data field, using any input argument combination from the previous syntaxes.```

example

``````[dataBits,eqSym,cpe] = wlanHTDataRecover(___)``` returns `cpe`, the common phase error between the received and expected OFDM symbols.```

## Examples

collapse all

Recover bits from the HT-Data field of an HT-mixed waveform transmitted through an additive white Gaussian noise (AWGN) channel.

Configure an HT-mixed transmission and generate the corresponding HT-Data field.

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

Transmit the signal through an AWGN channel with a signal-to-noise ratio (SNR) of 10 dB.

```snr = 10; noiseVarEst = 10^(-snr/10); rxDataSig = awgn(txDataSig,snr);```

Specify a channel estimate. Because the signal does not pass through a fading channel, a vector of ones is a perfect estimate. For a channel bandwidth of 20 MHz, the HT-SIG field contains 52 data subcarriers and 4 pilot subcarriers.

`chEst = ones(56,1);`

Recover the bits from the received HT-Data field and confirm that the recovered bits match the transmitted bits.

```dataBits = wlanHTDataRecover(rxDataSig,chEst,noiseVarEst,cfgHT); isequal(dataBits,bits)```
```ans = logical 1 ```

Recover the HT-Data field and calculate the common phase error of an HT-mixed signal recovered from an AWGN channel by using zero-forcing equalization at the receiver.

Configure an HT-mixed transmission with a channel bandwidth of 40 MHz and a PSDU length of 1024 bytes, then generate the corresponding HT-Data field.

```psduLength = 1024; cfgHT = wlanHTConfig('ChannelBandwidth','CBW40','PSDULength',psduLength); bits = randi([0 1],8*psduLength,1); txDataSig = wlanHTData(bits,cfgHT);```

Pass the signal through an AWGN channel with an SNR of 7 dB.

```snr = 7; noiseVarEst = 10^(-snr/10); rxDataSig = awgn(txDataSig,7);```

Specify a channel estimate.

`chEst = ones(114,1);`

Recover the bits from the received HT-Data field and confirm that the recovered bits match the transmitted bits.

```[dataBits,eqSym,cpe] = wlanHTDataRecover(rxDataSig,chEst,noiseVarEst,cfgHT,'EqualizationMethod','ZF'); isequal(bits,dataBits)```
```ans = logical 1 ```

Calculate and display the maximum common phase error.

`max(abs(cpe))`
```ans = 0.4709 ```

## Input Arguments

collapse all

Received HT-Data field, specified as a complex-valued array of size NS-by-NR.

• NS is the number of time-domain samples.

• NR is the number of receive antennas.

Data Types: `double`
Complex Number Support: Yes

Channel estimate, specified as a complex-valued array of size NST-by-NSTS-by-NR.

• NST is the number of occupied subcarriers.

• NSTS is the number of space-time streams.

• NR is the number of receive antennas.

Data Types: `double`
Complex Number Support: Yes

Noise variance estimate, specified as a nonnegative scalar.

Data Types: `double`

HT transmission parameters, specified as a `wlanHTConfig` object.

### Name-Value 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 the comma-separated pair consisting of `'OFDMSymbolOffset'` and a scalar in the interval [0, 1]. The value you specify indicates the start location for OFDM demodulation relative to the beginning of the CP. The value `0` represents the start of the CP, and the value `1` represents the end of the CP.

Data Types: `double`

Equalization method, specified as one of these values.

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

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

When the received signal has multiple receive antennas, the function exploits receiver diversity during equalization. When the number of transmitted space-time streams is one and you specify this argument as `'ZF'`, the function performs maximal-ratio combining.

Data Types: `char` | `string`

Pilot phase tracking, specified as the comma-separated pair consisting of `'PilotPhaseTracking'` and one of these values.

• `'PreEQ'` — Enable pilot phase tracking, which the function performs before any equalization operation.

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

Data Types: `char` | `string`

LDPC decoding algorithm, specified as the comma-separated pair consisting of `'LDPCDecodingMethod'` and 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 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, set the `ChannelCoding` property of the `cfgHT` input to `'LDPC'`.

Data Types: `char` | `string`

Scaling factor for normalized min-sum LDPC decoding, specified as the comma-separated pair consisting of `'MinSumScalingFactor'` and 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 the comma-separated pair consisting of `'MinSumOffset'` and 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 the comma-separated pair consisting of `'MaximumLDPCIterationCount'` and a positive integer.

#### Dependencies

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

Data Types: `double`

Enable early termination of LDPC decoding, specified as the comma-separated pair consisting of `'EarlyTermination'` and `1` (`true`) or `0` (`false`).

• When you set this value to `0` (`false`), LDPC decoding completes the number of iterations specified in the `'``MaximumLDPCIterationCount``'` name-value pair argument 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, set the `ChannelCoding` property of the `cfgHT` input to `'LDPC'`.

Data Types: `logical`

## Output Arguments

collapse all

Bits recovered from HT-Data field, returned as a binary-valued column vector of length 8×LPSDU, where LPSDU is the length of the PSDU in bytes.

Data Types: `int8`

Equalized OFDM symbols comprising the HT-Data field, returned as a complex-valued array of size NSD-by-NSym-by-NSS.

• NSD is the number of data subcarriers

• NSym is the number of OFDM symbols in the HT-Data field

• NSS is the number of spatial streams.

Data Types: `double`
Complex Number Support: Yes

Common phase error between the received and expected OFDM symbols, in radians, returned as a real-valued column vector. The length of this output is NSym, the number of OFDM symbols in the HT-Data field.

Data Types: `double`

collapse all

### HT-Data Field

The HT-Data field follows the last HT-long training field (HT-LTF) of an HT-mixed packet.

The HT-Data field is carries one or more frames from the medium access control (MAC) layer and consists of four subfields.

• Service — Contains 16 zeros to initialize the data scrambler

• PSDU — Variable-length field containing a PLCP service data unit (PSDU)

• Tail — Contains six zeros for each encoding stream, required to terminate a convolutional code

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

### HT-Mixed Format

HT-mixed transmissions contain a PLCP header such that devices operating in HT and non-HT modes can decode them.

## Algorithms

collapse all

This function supports these four LDPC decoding algorithms.

### Belief Propagation Decoding

The 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 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 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 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.