Main Content

# bocmod

Binary offset carrier modulation

## Syntax

``y = bocmod(x,m,n)``
``y = bocmod(x,m,n,halfcyclesps)``
``y = bocmod(x,m,n,halfcyclesps,phasing)``

## Description

example

````y = bocmod(x,m,n)` performs binary offset carrier (BOC) modulation on the input bits `x` by using a square wave and returns the modulated symbols `y`. `m` is the square wave frequency indicator. `n` is the input bit rate indicator.By default, the phasing of the square wave is set to the phase of the sine curve.```
````y = bocmod(x,m,n,halfcyclesps)` specifies the number of samples per half cycle of the square wave.```

example

````y = bocmod(x,m,n,halfcyclesps,phasing)` specifies the phase of the square wave.```

## Examples

collapse all

Generate a random stream of input data bits to modulate.

```numBits = 5; bits = randi([0,1],numBits,1);```

Set the values of `m` and `n` for the subcarrier square wave.

```m = 2; % Square wave frequency is m*1.023e6 Hz n = 2; % Square wave input bit rate is n*1.023e6 Hz```

Modulate the input bits with the square wave using the BOC modulation technique.

`sym = bocmod(bits,m,n) % Default phasing is of a sine curve`
```sym = 20×1 -1 -1 1 1 -1 -1 1 1 1 1 ⋮ ```

Generate a random stream of input data bits to modulate.

```numBits = 10; bits = randi([0,1],numBits,1);```

Set the values of `m` and `n` for the subcarrier square wave. Also specify the number of samples per square wave half cycle, `spshc`.

```m = 5; n = 2; spshc = 4;```

Modulate the input bits with the square wave using the BOC modulation technique.

`sym = bocmod(bits,m,n,spshc,"cos");`

## Input Arguments

collapse all

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

The function maps an input bit value of `0` to `+1` and an input bit value of `1` to `-1`. It then multiplies the mapped symbols with a square wave by using the BOC modulation technique.

Data Types: `double` | `int8` | `logical`

Square wave frequency indicator, specified as a positive scalar.

The frequency of square wave is `m*1.023e6` Hz.

Note

The value of `2*m/n` must always be an integer. This value represents the number of square wave half cycles per input bit, `x`.

Data Types: `double`

Input bit rate indicator, specified as a positive scalar.

The input bit rate is `n*1.023e6` Hz.

Data Types: `double`

Number of samples per half cycle of the square wave, specified as an integer greater than or equal to 2.

Data Types: `double` | `uint8`

Phase of the square wave, specified as `"sin"` or `"cos"`.

• `"sin"` — Set the phase of the square wave to the phase of a sine curve.

• `"cos"` — Set the phase of the square wave to the phase of a cosine curve.

Data Types: `char` | `string`

## Output Arguments

collapse all

BOC modulated symbols, returned as a column vector. The length of the vector is equal to `length`(`x`)*`halfcyclesps`*2*`m`/`n`. If you do not specify `halfcyclesps`, the value of `y` is 2 by default.

The data type of the returned modulated symbols is same as that of the input bits, `x`.

## Version History

Introduced in R2022a