# wlanVHTDataRecover

Recover VHT data

## Syntax

``recBits = wlanVHTDataRecover(rxSig,chEst,noiseVarEst,cfg)``
``recBits = wlanVHTDataRecover(rxSig,chEst,noiseVarEst,cfg,userNumber)``
``recBits = wlanVHTDataRecover(rxSig,chEst,noiseVarEst,cfg,userNumber,numSTS)``
``recBits = wlanVHTDataRecover(___,Name,Value)``
``````[recBits,crcBits] = wlanVHTDataRecover(___)``````
``````[recBits,crcBits,eqSym] = wlanVHTDataRecover(___)``````
``````[recBits,crcBits,eqSym,cpe] = wlanVHTDataRecover(___)``````

## Description

example

````recBits = wlanVHTDataRecover(rxSig,chEst,noiseVarEst,cfg)` returns the recovered payload bits from the VHT data field[1] for a single-user transmission. Inputs include the received VHT data field signal, the channel estimate, the noise variance estimate, and the format configuration object, `cfg`.```

example

````recBits = wlanVHTDataRecover(rxSig,chEst,noiseVarEst,cfg,userNumber)` returns the recovered payload bits, in a multiuser transmission, for the user specified by `userNumber`.```
````recBits = wlanVHTDataRecover(rxSig,chEst,noiseVarEst,cfg,userNumber,numSTS)` also specifies the number of space-time streams, `numSTS`, for a multiuser transmission.```

example

````recBits = wlanVHTDataRecover(___,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.```
``````[recBits,crcBits] = wlanVHTDataRecover(___)``` also returns the VHT-SIG-B checksum bits, `crcBits`, using the arguments from the previous syntaxes.```
``````[recBits,crcBits,eqSym] = wlanVHTDataRecover(___)``` also returns the equalized symbols, `eqSym`.```
``````[recBits,crcBits,eqSym,cpe] = wlanVHTDataRecover(___)``` also returns the common phase error, `cpe`.```

## Examples

collapse all

Recover bits in the VHT-Data field using channel estimation on a VHT-LTF field over a 2 x 2 quasi-static fading channel.

Create a VHT configuration object with 160 MHz channel bandwidth and two transmission paths.

```cbw = 'CBW160'; vht = wlanVHTConfig('ChannelBandwidth',cbw,'NumTransmitAntennas',2,'NumSpaceTimeStreams',2,'APEPLength',512);```

Generate VHT-LTF and VHT-Data field signals.

```txDataBits = randi([0 1],8*vht.PSDULength,1); txVHTLTF = wlanVHTLTF(vht); txVHTData = wlanVHTData(txDataBits,vht);```

Pass the transmitted waveform through a 2 x 2 quasi-static fading channel with AWGN.

```snr = 10; H = 1/sqrt(2)*complex(randn(2,2),randn(2,2)); rxVHTLTF = awgn(txVHTLTF*H,snr); rxVHTData = awgn(txVHTData*H,snr);```

Calculate the received signal power and use it to estimate the noise variance.

```powerDB = 10*log10(var(rxVHTData)); noiseVarEst = mean(10.^(0.1*(powerDB-snr)));```

Perform channel estimation based on the VHT-LTF field.

```demodVHTLTF = wlanVHTLTFDemodulate(rxVHTLTF,vht,1); chanEst = wlanVHTLTFChannelEstimate(demodVHTLTF,vht);```

Recover payload bits in the VHT-Data field and compare against the original payload bits.

```rxDataBits = wlanVHTDataRecover(rxVHTData,chanEst,noiseVarEst,vht); numErr = biterr(txDataBits,rxDataBits)```
```numErr = 0 ```

Recover VHT-Data field bits for a multiuser transmission using channel estimation on a VHT-LTF field over a quasi-static fading channel.

Create a VHT configuration object having a 160 MHz channel bandwidth, two users, and four transmit antennas. Assign one space-time stream to the first user and three space-time streams to the second user.

```cbw = 'CBW160'; numSTS = [1 3]; vht = wlanVHTConfig('ChannelBandwidth',cbw,'NumUsers',2, ... 'NumTransmitAntennas',4,'NumSpaceTimeStreams',numSTS);```

Because there are two users, the PSDU length is a 1-by-2 row vector.

`psduLen = vht.PSDULength`
```psduLen = 1×2 1050 3156 ```

Generate multiuser input data. This data must be in the form of a 1-by- N cell array, where N is the number of users.

```txDataBits{1} = randi([0 1],8*vht.PSDULength(1),1); txDataBits{2} = randi([0 1],8*vht.PSDULength(2),1);```

Generate VHT-LTF and VHT-Data field signals.

```txVHTLTF = wlanVHTLTF(vht); txVHTData = wlanVHTData(txDataBits,vht);```

Pass the data field for the first user through a 4x1 channel because it consists of a single space-time stream. Pass the second user's data through a 4x3 channel because it consists of three space-time streams. Apply white Gaussian noise to each user signal.

```snr = 15; H1 = 1/sqrt(2)*complex(randn(4,1),randn(4,1)); H2 = 1/sqrt(2)*complex(randn(4,3),randn(4,3)); rxVHTData1 = awgn(txVHTData*H1,snr,'measured'); rxVHTData2 = awgn(txVHTData*H2,snr,'measured');```

Repeat the process for the VHT-LTF fields.

```rxVHTLTF1 = awgn(txVHTLTF*H1,snr,'measured'); rxVHTLTF2 = awgn(txVHTLTF*H2,snr,'measured');```

Calculate the received signal power for both users and use it to estimate the noise variance.

```powerDB1 = 10*log10(var(rxVHTData1)); noiseVarEst1 = mean(10.^(0.1*(powerDB1-snr))); powerDB2 = 10*log10(var(rxVHTData2)); noiseVarEst2 = mean(10.^(0.1*(powerDB2-snr)));```

Estimate the channel characteristics using the VHT-LTF fields.

```demodVHTLTF1 = wlanVHTLTFDemodulate(rxVHTLTF1,cbw,numSTS); chanEst1 = wlanVHTLTFChannelEstimate(demodVHTLTF1,cbw,numSTS); demodVHTLTF2 = wlanVHTLTFDemodulate(rxVHTLTF2,cbw,numSTS); chanEst2 = wlanVHTLTFChannelEstimate(demodVHTLTF2,cbw,numSTS);```

Recover VHT-Data field bits for the first user and compare against the original payload bits.

```rxDataBits1 = wlanVHTDataRecover(rxVHTData1,chanEst1,noiseVarEst1,vht,1); [~,ber1] = biterr(txDataBits{1},rxDataBits1)```
```ber1 = 0.4983 ```

Determine the number of bit errors for the second user.

```rxDataBits2 = wlanVHTDataRecover(rxVHTData2,chanEst2,noiseVarEst2,vht,2); [~,ber2] = biterr(txDataBits{2},rxDataBits2)```
```ber2 = 0.0972 ```

The bit error rates are quite high because there is no precoding to mitigate the interference between streams. This is especially evident for the user 1 receiver because it receives energy from the three streams intended for user 2. The example is intended to show the workflow and proper syntaxes for the LTF demodulate, channel estimation, and data recovery functions.

Recover a VHT-Data field signal through a SISO AWGN channel using zero-forcing equalization.

Configure VHT format configuration object, generate random payload bits, and generate the VHT-Data field.

```cfg = wlanVHTConfig('APEPLength',512); txBits = randi([0 1],8*cfg.PSDULength,1); txSig = wlanVHTData(txBits,cfg);```

Pass the transmitted VHT data through an additive white Gaussian noise (AWGN) channel.

```awgnChan = comm.AWGNChannel('NoiseMethod','Variance','Variance',0.1); rxSig = awgnChan(txSig);```

Recover the payload bits using a perfect channel estimate of all ones and zero-forcing equalization. Verify that the recovered signal contains no bit errors.

```chEst = ones(242,1); noiseVarEst = 0.1; recBits = wlanVHTDataRecover(rxSig,chEst,noiseVarEst,cfg,'EqualizationMethod','ZF'); numErr = biterr(txBits,recBits)```
```numErr = 0 ```

## Input Arguments

collapse all

Received VHT-Data field signal in the time domain, specified as an NS-by-NR matrix. NR is the number of receive antennas. NS must be greater than or equal to the number of time-domain samples in the VHT-Data field input.

### Note

`wlanVHTDataRecover` processes one PPDU data field per entry. If NS is greater than the field length, extra samples at the end of `rxSig` are not processed. To process a concatenated stream of PPDU data fields, multiple calls to `wlanVHTDataRecover` are required. If `rxSig` is shorter than the length of the VHT-Data field, an error occurs.

Data Types: `double`
Complex Number Support: Yes

Channel estimation for data and pilot subcarriers, specified as a matrix or array of size NST-by-NSTS-by-NR. NST is the number of occupied subcarriers. NSTS is the number of space-time streams. For multiuser transmissions, NSTS is the total number of space-time streams for all users. NR is the number of receive antennas. NST and NSTS must match the `cfg` configuration object settings for channel bandwidth and number of space-time streams.

NST increases with channel bandwidth.

`ChannelBandwidth`Number of Occupied Subcarriers (NST)Number of Data Subcarriers (NSD)Number of Pilot Subcarriers (NSP)
`'CBW20'``56``52``4`
`'CBW40'``114``108``6`
`'CBW80'``242``234``8`
`'CBW160'``484``468``16`

Data Types: `double`
Complex Number Support: Yes

Noise variance estimate, specified as a nonnegative scalar.

Data Types: `double`

VHT PPDU configuration, specified as a `wlanVHTConfig` object.

Number of the user in a multiuser transmission, specified as an integer having a value from 1 to NUsers. NUsers is the total number of users.

Number of space-time streams in a multiuser transmission, specified as a vector. The number of space-time streams is a 1-by-NUsers vector of integers from 1 to 4, where NUsers is an integer from 1 to 4.

Example: `[1 3 2]` is the number of space-time streams for each user.

### Note

The sum of the space-time stream vector elements must not exceed eight.

Data Types: `double`

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

### Note

Specify this argument as `'EqualizationMethod','ZF'` when you set either of these property values in the `cfg` input:

• `'NumSpaceTimeStreams',1`

• `'NumSpaceTimeStreams',2,'STBC',true`

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 `wlanVHTDataRecover` 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'` for the user corresponding to the `userNumber` input.

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` name-value pair argument to `'LDPC'` for the user corresponding to the `userNumber` input.

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'` for the user corresponding to the `userNumber` input.

Data Types: `logical`

## Output Arguments

collapse all

Recovered payload bits in the VHT-Data field, returned as a column vector of length 8 × `cfgVHT.PSDULength`. See `wlanVHTConfig` for `PSDULength` details. The output is for a single user as determined by `userNumber`.

Data Types: `int8`

Checksum bits for VHT-SIG-B field, returned as a binary column vector of length 8.

Data Types: `int8`

Equalized symbols, returned as an NSD-by-NSYM-by-NSS matrix or array. NSD is the number of data subcarriers. NSYM is the number of OFDM symbols in the VHT-Data field. NSS is the number of spatial streams assigned to the user. When STBC is `false`, NSS = NSTS. When STBC is `true`, NSS = NSTS/2.

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 VHT data field.

## Limitations

`wlanVHTDataRecover` processing limitations, restrictions, and recommendations:

• If only VHT format PPDUs are processed, then ```isa(cfgVHT, 'wlanVHTConfig')``` must be `true`.

• For single-user scenarios, `cfgVHT.NumUsers` must equal 1.

• When STBC is enabled, the number of space-time streams must be even.

• `cfgRec.EqualizationMethod = 'ZF'` is recommended when `cfgVHT.STBC = true` and ```cfgVHT.NumSpaceTimeStreams = 2```

• `cfgRec.EqualizationMethod = 'ZF'` is recommended when `cfgVHT.NumSpaceTimeStreams = 1`

collapse all

### VHT data field

The very high throughput data (VHT data) field is used to transmit one or more frames from the MAC layer. It follows the VHT-SIG-B field in the packet structure for the VHT format PPDUs.

For a detailed description of the VHT Data field, see section 21.3.10 of IEEE® Std 802.11™-2016. The VHT Data field consists of four subfields.

• Service field — Contains a seven-bit scrambler initialization state, one bit reserved for future considerations, and eight bits for the VHT-SIG-B CRC field.

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

• PHY Pad — Variable number of bits passed to the transmitter to create a complete OFDM symbol.

• Tail — Bits used to terminate a convolutional code. Tail bits are not needed when LDPC is used.

## Algorithms

collapse all

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

### Belief Propagation Decoding

The `wlanVHTDataRecover` 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 $L\left({Q}_{i}\right)$ 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 `wlanVHTDataRecover` 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 `wlanVHTDataRecover` 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 `wlanVHTDataRecover` 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.11ac™-2013 (Amendment to IEEE Std 802.11-2012, as amended by IEEE Std 802.11ae™-2012, IEEE Std 802.11a™-2012, and IEEE Std 802.11ad™-2012). “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications. Amendment 4: Enhancements for Very High Throughput Operation in Bands below 6 GHz.” 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.