# bluetoothWhiten

Whiten or dewhiten input data bits

Since R2022b

## Description

The `bluetoothWhiten` System object™ whitens or dewhitens input data bits by using a linear feedback shift register (LFSR). The Bluetooth® Core Specification v5.3 [2] specifies the generator polynomial ${}^{{x}^{7}+{x}^{4}+1}$ and initial values of LFSR.

To whiten or dewhiten input data bits:

1. Create the `bluetoothWhiten` object and set its properties.

2. Call the object with arguments, as if it were a function.

Note

For more information about Bluetooth data whitening and dewhitening, see Volume 2, Part B, Section 7.2 and Volume 6, Part B, Section 3.2 of the Bluetooth Core Specification v5.3 [2].

## Creation

### Syntax

``whiten = bluetoothWhiten``
``whiten = bluetoothWhiten(Name=Value)``

### Description

example

````whiten = bluetoothWhiten` creates a default Bluetooth whitening or dewhitening System object.```

example

````whiten = bluetoothWhiten(Name=Value)` sets properties by using one or more optional name-value arguments. For example, `InitialConditionsSource="Input port"` sets the input port as the source of the initial conditions vector.```

## Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the `release` function unlocks them.

If a property is tunable, you can change its value at any time.

Source of the initial conditions vector, specified as `"Property"` or `"Input port"`.

Data Types: `char` | `string`

Initial conditions of the LFSR, specified as a seven-element column vector of binary values. For the System object to generate an output different from the input data, at least one element of this property must be nonzero.

Data Types: `double`

## Usage

### Syntax

``y = whiten(x)``
``y = whiten(x,initCondition)``

### Description

example

````y = whiten(x)` whitens or dewhitens the input data bits, `x`, at the transmitter or receiver, respectively, and returns the result, `y`.```

example

````y = whiten(x,initCondition)` whitens or dewhitens the input data by using the specified initial values of the LFSR, `initCondition`.```

### Input Arguments

expand all

Input data, specified as a column vector of binary values.

Data Types: `double` | `logical`

Initial conditions of LFSR, specified as a seven-element column vector of binary values. To specify this input,you must set the InitialConditionsSource property of `whiten` to `"Input port"`. For the System object to generate an output different from the input data, at least one element of this input must be nonzero.

Data Types: `double`

### Output Arguments

expand all

Whitened or dewhitened output data bits, returned as a column vector of binary values with the same length and data type as `x`.

Data Types: `double` | `logical`

## Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named `obj`, use this syntax:

`release(obj)`

expand all

 `step` Run System object algorithm `release` Release resources and allow changes to System object property values and input characteristics `clone` Create duplicate System object `isLocked` Determine if System object is in use `reset` Reset internal states of System object

## Examples

collapse all

Specify a channel index.

`channelIndex = 4;`

Generate initial conditions from the channel index.

`initCond = [1; int2bit(channelIndex,6)];`

Create a Bluetooth whiten System object, specifying the input port as the source of the initial conditions vector.

`whiten = bluetoothWhiten(InitialConditionsSource="Input port");`

Generate random input data.

`data = randi([0 1],1024,1)`
```data = 1024×1 1 1 0 1 1 0 0 1 1 1 ⋮ ```

Whiten the input data.

`whitenedData = whiten(data,initCond)`
```whitenedData = 1024×1 1 1 1 1 1 1 1 1 0 1 ⋮ ```

Specify the initial conditions of a shift register.

`initCond = [1 0 1 1 0 0 0]';`

Create two System objects, one for whitening the input data, and the other for dewhitening the whitened data.

```whiten = bluetoothWhiten(InitialConditions=initCond); dewhiten = bluetoothWhiten(InitialConditions=initCond);```

Generate random input data.

`data = randi([0 1],800,1);`

Whiten the input data.

`whitenedData = whiten(data);`

Perform dewhitening on the whitened data and, verify that the dewhitened output is same as the original, generated data.

```deWhitenedData = dewhiten(whitenedData); isequal(data,deWhitenedData)```
```ans = logical 1 ```

## References

[1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed March 22, 2022. https://www.bluetooth.com/.

[2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. https://www.bluetooth.com/.

## Version History

Introduced in R2022b