# dpskmod

Differential phase shift keying modulation

## Syntax

`y = dpskmod(x,M)y = dpskmod(x,M,phaserot)y = dpskmod(x,M,phaserot,symbol_order)`

## Description

`y = dpskmod(x,M)` outputs the complex envelope `y` of the modulation of the message signal `x` using differential phase shift keying modulation. `M` is the alphabet size and must be an integer. The message signal must consist of integers between 0 and `M-1`. If `x` is a matrix with multiple rows and columns, the function processes the columns independently.

`y = dpskmod(x,M,phaserot)` specifies the phase rotation of the modulation in radians. In this case, the total phase shift per symbol is the sum of `phaserot` and the phase generated by the differential modulation.

`y = dpskmod(x,M,phaserot,symbol_order)` specifies how the function assigns binary words to corresponding integers. If `symbol_order` is set to `'bin'` (default), the function uses a natural binary-coded ordering. If `symbol_order` is set to `'gray'`, it uses a Gray-coded ordering.

 Note:   An initial phase rotation of 0 is used in determining the first element of the output `y` (or the first row of `y` if it is a matrix with multiple rows), because two successive elements are required for a differential algorithm.

## Examples

collapse all

### Modulate a DPSK Signal and View its Signal Trajectory

This example shows how to plot the output of the `dspkmod` function. The image shows the possible transitions from each symbol in the DPSK signal constellation to the next symbol.

Set the modulation order to 4 to model DQPSK modulation.

```M = 4; ```

Generate a sequence of 4-ary random symbols.

```x = randi([0 M-1],500,1); ```

Apply DQPSK modulation to the input symbols.

```y = dpskmod(x,M,pi/8); ```

Create a constellation diagram object and set its properties to display a signal trajectory diagram and to disable the display of the reference constellation. Use the `step` function to display the trajectory.

```h = comm.ConstellationDiagram('ShowTrajectory',true,'ShowReferenceConstellation',false); step(h,y) ```