# comm.MSKDemodulator

Demodulate using MSK method and Viterbi algorithm

## Description

The `comm.MSKDemodulator` System object™ demodulates a signal that was modulated using the differentially encoded minimum shift keying method. The object expects the input signal to be a baseband representation of a coherent modulated signal with no precoding. For more information, see Algorithms.

To demodulate a signal that was modulated using minimum shift keying:

1. Create the `comm.MSKDemodulator` object and set its properties.

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

## Creation

### Syntax

``mskdemod = comm.MSKDemodulator``
``mskdemod = comm.MSKDemodulator(Name=Value)``

### Description

example

````mskdemod = comm.MSKDemodulator` creates a demodulator System object, `mskdemod`. This object demodulates the input minimum shift keying (MSK) modulated data using the Viterbi algorithm.```

example

````mskdemod = comm.MSKDemodulator(Name=Value)` sets Properties using one or more name-value arguments. For example, `InitialPhaseOffset=pi/2` specifies an initial phase of `pi/2` radians for the input modulated waveform.```

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

Option to provide output in bits, specified as a numeric or logical `0` (`false`) or `1` (`true`).

• When you set this property to `false`, the object method outputs a column vector with a length equal to N/`SamplesPerSymbol`. N represents the length of the input signal, which is the number of input baseband modulated symbols. The vector elements are `-1` or `1`.

• When you set this property to `true`, the object method outputs a binary column vector with a length equal to N/`SamplesPerSymbol`. The vector elements are bit values of `0` or `1`.

Data Types: `logical`

Initial phase offset of the input modulated waveform in radians, specified as a numeric scalar.

Number of samples per input symbol, specified as a positive integer.

Data Types: `double`

Number of trellis branches that the Viterbi algorithm uses to construct each traceback path, specified as a positive integer. The value of this property is also the output delay. This value indicates the number of zero symbols that precede the first meaningful demodulated symbol in the output.

Data Types: `double`

Data type of output, specified as:

• `int8`, `int16`, `int32`, or `double` when you set the `BitOutput` property to false.

• `double` or `logical` when you set the `BitOutput` property to true.

## Usage

### Syntax

``y = mskdemod(x)``

### Description

````y = mskdemod(x)` applies MSK demodulation to the input signal and returns the demodulated signal.```

### Input Arguments

expand all

MSK-modulated signal, specified as a scalar or column vector.

Data Types: `single` | `double`

### Output Arguments

expand all

Output signal, returned as a scalar or column vector. To specify whether the object outputs values as integers or bits, use the BitOutput property. The output data type is determined by the OutputDataType property.

## 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 `reset` Reset internal states of System object

## Examples

collapse all

Create an MSK modulator and an MSK demodulator. Use a phase offset of $\pi /4$.

``` mskmod = comm.MSKModulator(BitInput=true, ... InitialPhaseOffset=pi/4); mskdemod = comm.MSKDemodulator(BitOutput=true, ... InitialPhaseOffset=pi/4);```

Create an error rate calculator. Account for the delay caused by the Viterbi algorithm.

``` ber = comm.ErrorRate('ReceiveDelay',mskdemod.TracebackDepth); for counter = 1:100```

Transmit 100 3-bit words through an AWGN channel, using a signal-to-noise ratio of 0.

``` data = randi([0 1],300,1); modSignal = mskmod(data); noisySignal = awgn(modSignal,0); receivedData = mskdemod(noisySignal); errorStats = ber(data, receivedData); end fprintf('Error rate = %f\nNumber of errors = %d\n', ... errorStats(1), errorStats(2))```
```Error rate = 0.000000 Number of errors = 0 ```

## Algorithms

Differentially encoded minimum shift keying modulation uses pulse shaping to smooth the phase transitions of the modulated signal. The function q(t) is the phase response obtained from the frequency pulse, g(t), through this relation:$q\left(t\right)={\int }_{-\text{\hspace{0.17em}}\infty }^{t}g\left(t\right)dt$.

The specified frequency pulse shape corresponds to this rectangular pulse shape expression for g(t).

Pulse ShapeExpression
`Rectangular`$g\left(t\right)=\left\{\begin{array}{cc}\frac{1}{2LT},& 0\le t\le LT\\ 0& \text{otherwise}\end{array}$

• L is the main lobe pulse duration in symbol intervals.

• The duration of the pulse, LT, is the pulse length in symbol intervals.

## Version History

Introduced in R2012a