# wlanBCCDecode

Convolutionally decode input data

## Syntax

``y = wlanBCCDecode(sym,rate)``
``y = wlanBCCDecode(sym,rate,decType)``
``y = wlanBCCDecode(sym,rate,tDepth)``
``y = wlanBCCDecode(sym,rate,decType,tDepth)``

## Description

example

````y = wlanBCCDecode(sym,rate)` returns decoded bits `y` by convolutionally decoding symbols `sym` the decoding rate specified by `rate`.```
````y = wlanBCCDecode(sym,rate,decType)` specifies the decoding type of the Viterbi decoding algorithm. ```

example

````y = wlanBCCDecode(sym,rate,tDepth)` specifies the traceback depth of the Viterbi decoding algorithm. ```

example

````y = wlanBCCDecode(sym,rate,decType,tDepth)` specifies the decoding type and the traceback depth. You can specify the `decType` and `tDepth` inputs in any order after `rate`.```

## Examples

collapse all

Decode two encoded streams of soft bits by using a BCC of rate 1/2.

Create the sequence of data bits.

`dataBits = randi([0 1],100,1,"int8");`

Parse the data bits.

```numES = 2; parsedData = reshape(dataBits,numES,[]).';```

BCC-encode the parsed sequence.

`rate = "1/2"`
```rate = "1/2" ```
`encodedData = wlanBCCEncode(parsedData,rate);`

Convert the encoded bits to soft bits.

`demodData = double(1-2*encodedData);`

BCC-decode the demodulated data.

`decodedData = wlanBCCDecode(demodData,rate);`

Deparse the decoded data.

`deparsedData = reshape(decodedData.',[],1);`

Verify that the decoded data matches the original data.

`isequal(dataBits,deparsedData)`
```ans = logical 1 ```

Decode a sequence of soft bits by using a BCC of rate 3/4 and a traceback depth of 60.

Create the sequence of data bits.

`dataBits = randi([0 1],300,1);`

BCC-encode the sequence of bits.

`encodedData = wlanBCCEncode(dataBits,3/4);`

Convert the encoded bits to soft bits (i.e. LLR demodulation).

`demodData = 1-2*encodedData;`

BCC-decode the demodulated bits.

```tDepth = 60; decodedData = wlanBCCDecode(demodData,3/4,tDepth);```

Verify that the decoded data matches the original data.

`isequal(dataBits,decodedData)`
```ans = logical 1 ```

Decode a sequence of hard bits by using a BCC of rate 3/4 and a traceback depth of 45.

Create the sequence of data bits.

`dataBits = randi([0 1],300,1,'int8');`

BCC-encode the sequence of bits.

`encodedData = wlanBCCEncode(dataBits,'2/3');`

Perform hard BCC decoding on the encoded bits. Specify a traceback depth 45.

```tDepth = 45; decodedBits = wlanBCCDecode(encodedData,'2/3','hard',tDepth);```

Verify that the decoded bits match the original bits.

`isequal(dataBits,decodedBits)`
```ans = logical 1 ```

## Input Arguments

collapse all

Symbols to decode, specified as a matrix of integers. The number of columns must be the number of encoded streams. Each stream is encoded separately. When you specify the `decType` input as `'soft'`, this input must be a real matrix with log-likelihood ratios. Positive values represent a logical `0` and negative values represent a logical `1`.

Data Types: `single` | `double` | `int8`

Code rate of the binary convolutional code (BCC), specified as a numeric scalar, character vector, or string scalar. To select a code rate, specify this input as a value in accordance with the table.

Code RateScalarCharacter VectorString
1/2`1/2``'1/2'``"1/2"`
2/3`2/3``'2/3'``"2/3"`
3/4`3/4``'3/4'``"3/4"`
5/6`5/6``'5/6'``"5/6"`

Example: `'3/4'`

Data Types: `single` | `double` | `char` | `string`

Decoding type of the binary convolutional code (BCC), specified as a character vector or a string scalar. To specify a hard input Viterbi algorithm, specify this input as `'hard'`. To specify a soft input Viterbi algorithm without any quantization, specify this input as`'soft'`.

For more information on BCC, see sections 17.3.5.6 and 19.3.11.6 in .

Data Types: `char` | `string`

Traceback depth of the Viterbi decoding algorithm, specified as a positive integer less than or equal to the number of input symbols in `sym`.

Data Types: `single` | `double`

## Output Arguments

collapse all

Binary convolutionally decoded bits, returned as a binary matrix. The number of rows of `y` is equal to the number of rows of input `sym` multiplied by `rate`, rounded to the next integer. The number of columns of `y` is equal to the number of columns of `sym`.

Data Types: `int8`

 IEEE Std 802.11™-2020 (Revision of IEEE Std 802.11-2016). “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.