Amplitude phase shift keying (APSK) demodulation

performs APSK demodulation of the input signal `z`

= apskdemod(`y`

,`M`

,`radii`

)`y`

, based on the
specified number of constellation points per PSK ring, `M`

, and
the radius of each PSK ring, `radii`

. For a description of APSK
demodulation, see APSK Hard Demodulation and APSK Soft Demodulation.

apskdemod specifically applies to multiple ring PSK constellations. For
a single ring PSK constellation, use `pskdemod`

.

specifies an initial phase offset for each PSK ring of the APSK modulated
signal.`z`

= apskdemod(`y`

,`M`

,`radii`

,`phaseoffset`

)

specifies options using one or more name-value pair arguments using any of the
previous syntaxes. For example, `z`

= apskdemod(___,`Name,Value`

)`'OutputDataType','double'`

specifies the desired output data type as double. Specify name-value pair arguments
after all other input arguments.

Demodulate a 16-APSK signal that has an unequal number of constellation points on each circle. Plot the received constellation.

Define vectors for modulation order and PSK ring radii. Generate random 16-ary data symbols.

M = [4 12]; radii = [1 2]; modOrder = sum(M); x = randi([0 modOrder-1],1000,1);

Apply APSK modulation to the data.

txSig = apskmod(x,M,radii);

Pass the modulated signal through a noisy channel.

snr = 20; % dB rxSig = awgn(txSig,snr,'measured');

Plot the transmitted (reference) signal points and the noisy received signal points.

plot(rxSig,'b*') hold on grid plot(txSig,'r+') xlim([-3 3]) ylim([-3 3]) xlabel('In-Phase') ylabel('Quadrature') legend('Received constellation','Reference constellation')

Demodulate the received signal and compare to the input data.

z = apskdemod(rxSig,M,radii); isequal(x,z)

`ans = `*logical*
1

Demodulate a 64-APSK signal with custom symbol mapping. Compute hard decision bit output and verify that the input matches the output.

Define vectors for modulation order and PSK ring radii. Generate 100 symbols of random bit input.

```
M = [8 12 16 28]; % 4-PSK circles
modOrder = sum(M);
radii = [0.5 1 1.3 2];
x = randi([0 1],100*log2(modOrder),1);
```

Create a custom symbol mapping vector of binary mapping.

cmap = 0:63;

Modulate the data and plot the constellation.

y = apskmod(x,M,radii,'SymbolMapping',cmap,'inputType','bit', ... 'PlotConstellation',true);

Demodulate the received signal.

z = apskdemod(y,M,radii,'SymbolMapping',cmap,'OutputType','bit');

Verify that the demodulated signal is equal to the original data.

isequal(x,z)

`ans = `*logical*
1

Demodulate a 32-APSK signal and calculate soft bits.

Define vectors for modulation order and PSK ring radii. Generate 10000 symbols of random bit data.

M = [16 16]; modOrder = sum(M); radii = [0.6 1.2]; numSym = 10000; x = randi([0 1], numSym*log2(modOrder),1);

Generate a reference constellation. Create a constellation diagram object.

refAPSK = apskmod(0:modOrder-1,M,radii); constDiagAPSK = comm.ConstellationDiagram('ReferenceConstellation',refAPSK, ... 'Title','Received Symbols','XLimits',[-2 2],'YLimits',[-2 2]);

Modulate the data.

txSig = apskmod(x,M,radii,'InputType','bit'); sigPow = var(txSig);

Pass the signal through a noisy channel.

```
snr = 15;
rxSig = awgn(txSig,snr,sigPow,'linear');
```

Plot the reference and received constellation symbols.

constDiagAPSK(rxSig)

Demodulate the signal and compute soft bits.

z = apskdemod(rxSig,M,radii,'OutputType','approxllr', ... 'NoiseVariance',sigPow/snr);

`y`

— APSK modulated signalscalar | vector | matrix

APSK modulated signal, specified as a complex scalar, vector, or matrix. Each column is treated as an independent channel.

**Data Types: **`double`

| `single`

**Complex Number Support: **Yes

`M`

— Constellation points per PSK ringvector

Constellation points per PSK ring, specified as a vector with more than
one element. Vector elements indicate the number of constellation points in
each PSK ring. The first element corresponds to the innermost circle, and so
on, until the last element, that corresponds to the outermost circle.
Element values must be multiples of four and
`sum(`

must be a power of
two. The modulation order is the total number of points in the signal
constellation and equals the sum of the vector elements,
`M`

)`sum(`

.`M`

)

**Example: **`[4 12 16]`

specifies a three PSK ring
constellation with a modulation order of `sum(M)`

=
32.

**Data Types: **`double`

`radii`

— PSK ring radiivector

PSK ring radii, specified as a vector with the same length as
`M`

. The first element corresponds to the innermost
circle, and so on, until the last element, that corresponds to the outermost
circle. The elements must be positive and arranged in increasing
order.

**Example: **`[0.5 1 2]`

defines constellation PSK ring radii.
The inner ring has a radius of 0.5, the second ring has a radius of 1.0, and
the outer ring has a radius of 2.0.

**Data Types: **`double`

`phaseoffset`

— PSK ring phase offsets`[pi/M(1) pi/M(2) … pi/M(end)]`

(default) | scalar | vectorPhase offset of each PSK ring in radians, specified as a scalar or vector
with the same length as `M`

. The first element
corresponds to the innermost circle, and so on, until the last element, that
corresponds to the outermost circle. The `phaseoffset`

can be a scalar only if all the elements of `M`

are the
same value.

**Example: **`[pi/4 pi/12 pi/16]`

defines three constellation
PSK ring phase offsets. The inner ring has a phase offset of pi/4, the
second ring has a phase offset of pi/12, and the outer ring has a phase
offset of pi/16.

**Data Types: **`double`

Specify optional
comma-separated pairs of `Name,Value`

arguments. `Name`

is
the argument name and `Value`

is the corresponding value.
`Name`

must appear inside quotes. You can specify several name and value
pair arguments in any order as
`Name1,Value1,...,NameN,ValueN`

.

```
y =
apskdemod(x,M,radii,'OutputType','bit','OutputDataType','single');
```

`'SymbolMapping'`

— Symbol mapping`'gray'`

| `'contourwise-gray'`

| integer vectorSymbol mapping, specified as the comma-separated pair consisting of
`SymbolMapping`

and one of the following:

`'contourwise-gray'`

— Uses Gray mapping along the contour in phase dimension.`'gray'`

— Uses Gray mapping along the contour in both the amplitude and phase dimensions. For Gray symbol mapping, all the values for`M`

must be equal and all the values for`phaseoffset`

must be equal. For a description of the Gray mapping used, see [2].integer vector — Use custom symbol mapping. Vector must consist of

`sum(`

unique elements with values from 0 to (`M`

)`sum(`

). The first element corresponds to the constellation point in the first quadrant of the innermost circle, with subsequent elements positioned counterclockwise around the PSK rings.`M`

)-1

The default symbol mapping depends on
`M`

and `phaseOffset`

. When
all the elements of `M`

and
`phaseOffset`

are equal, the default is
`'gray'`

. For all other cases, the default is
`'contourwise-gray'`

.

**Data Types: **`double`

| `char`

| `string`

`'OutputType'`

— Output type`'integer'`

(default) | `'bit'`

| `'llr'`

| `'approxllr'`

Output type, specified as the comma-separated pair consisting of
`'OutputType'`

and `'integer'`

,
`'bit'`

, `'llr'`

, or
`'approxllr'`

. For a description of the returned
output, see `z`

.

**Data Types: **`char`

| `string`

`'OutputDataType'`

— Output data type`'double'`

(default) | `...`

Output data type, specified as the comma-separated pair consisting of
`OutputDataType`

and one of the indicated data
types. Acceptable values for `OutputDataType`

depend
on the `OutputType`

value.

`OutputType`
Value | Acceptable
`OutputDataType` Values |
---|---|

`'integer'` | `'double'` ,
`'single'` ,
`'int8'` ,
`'int16'` ,
`'int32'` ,
`'uint8'` ,
`'uint16'` , or
`'uint32'` |

`'bit'` | `'double'` ,
`'single'` ,
`'int8'` ,
`'int16'` ,
`'int32'` ,
`'uint8'` ,
`'uint16'` ,
`'uint32'` , or
`'logical'` |

This name-value pair argument applies only when
`OutputType`

is set to
`'integer'`

or `'bit'`

.

**Data Types: **`char`

| `string`

`'NoiseVariance'`

— Noise variance`1`

(default) | positive scalar | vector of positive valuesNoise variance, specified as the comma-separated pair consisting of
`NoiseVariance`

and a positive scalar or vector
of positive values.

When specified as a scalar, the same noise variance value is used on all input elements.

When specified as a vector, the vector length must be equal to the number of columns in the input signal.

When the noise variance or signal power result in computations involving extreme positive or negative magnitudes, see APSK Soft Demodulation for algorithm selection considerations.

This name-value pair argument applies only when
`OutputType`

is set to
`'llr'`

or
`'approxllr'`

.

**Data Types: **`double`

`'PlotConstellation'`

— Option to plot constellation`false`

(default) | `true`

Option to plot constellation, specified as the comma-separated pair
consisting of `'PlotConstellation'`

and a logical
scalar. To plot the constellation, set
`PlotConstellation`

to
`true`

.

**Data Types: **`logical`

`z`

— Demodulated signalscalar | vector | matrix

Demodulated signal, returned as a scalar, vector, or matrix. The
dimensions of `z`

depend on the specified
`OutputType`

value.

`OutputType`
Value | Return Value of
`apskdemod` | Dimensions of `z` |
---|---|---|

`'integer'` | Demodulated integer values from 0 to
(sum(`M` ) – 1) | `z` has the same dimensions as input
`y` . |

`'bit'` | Demodulated bits | The number of rows in `z`
is log_{2}(sum(`M` )) times the number of rows in
`y` . Each demodulated symbol is mapped
to a group of log_{2}(sum(`M` )) elements in a column, where the first
element represents the MSB and the last element represents
the LSB. |

`'llr'` | Log-likelihood ratio value for each bit | |

`'approxllr'` | Approximate log-likelihood ratio value for each bit |

For soft demodulation, two soft-decision log-likelihood ratio (LLR) algorithms are available: exact LLR and approximate LLR. This table compares these algorithms.

Algorithm | Accuracy | Execution Speed |
---|---|---|

Exact LLR | more accurate | slower execution |

Approximate LLR | less accurate | faster execution |

For further description of these algorithms, see Exact LLR Algorithm and Approximate LLR Algorithm.

The exact LLR algorithm computes exponentials using finite precision arithmetic. Computation of exponentials with very large positive or negative magnitudes might yield:

`Inf`

or`-Inf`

if the noise variance is a very large value`NaN`

if both the noise variance and signal power are very small values

When the output returns any of these values, try using the approximate LLR algorithm because it does not compute exponentials.

[1] Sebesta, J. “Efficient Method
for APSK Demodulation.” *Selected Topics on Applied Mathematics, Circuits,
Systems, and Signals* (P. Pardalos, N. Mastorakis, V. Mladenov, and Z.
Bojkovic, eds.). Vouliagmeni, Athens, Greece: WSEAS Press, 2009.

[2] Liu, Z., Q. Xie, K. Peng, and
Z. Yang. "APSK Constellation with Gray Mapping." *IEEE Communications
Letters*. Vol. 15, Number 12, December 2011, pp. 1271–1273.

Generate C and C++ code using MATLAB® Coder™.

A modified version of this example exists on your system. Do you want to open this version instead?

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web siteYou can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

- América Latina (Español)
- Canada (English)
- United States (English)

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)