pskdemod
Demodulate using M-ary PSK method
Syntax
Description
specifies the phase offset of the M-PSK constellation.Z
= pskdemod(Y
,M
,phaseoffset
)
specifies the symbol order of the M-PSK constellation.Z
= pskdemod(Y
,M
,phaseoffset
,symorder
)
specifies optional name-value arguments using any of the previous syntaxes. For
example, Z
= pskdemod(___,Name=Value
)pskdemod(Y,M,PlotConstellation=true)
demodulates using
modulation order M
and plots the constellation. Specify
name-value arguments after all other input arguments.
Examples
Compare Phase Noise Effects on PSK and PAM Signals
Compare PSK and PAM modulation schemes to demonstrate that PSK is more sensitive to phase noise. PSK is more sensitive to phase noise because the PSK constellation is circular, while the PAM constellation is linear.
Specify the number of symbols and the modulation order parameters. Generate random data symbols.
len = 10000; M = 16; msg = randi([0 M-1],len,1);
Create a phase noise System object™ and show the configured settings.
phasenoise = comm.PhaseNoise(Level=[-70 -80])
phasenoise = comm.PhaseNoise with properties: Level: [-70 -80] FrequencyOffset: [2000 20000] SampleRate: 1000000 RandomStream: 'Global stream'
Modulate msg
using both PSK and PAM to compare the two methods.
txpsk = pskmod(msg,M); txpam = pammod(msg,M);
Perturb the phase of the modulated signals.
rxpsk = phasenoise(txpsk); rxpam = phasenoise(txpam);
Create scatter plots of the received signals.
scatterplot(rxpsk);
title('Noisy PSK Scatter Plot')
scatterplot(rxpam);
title('Noisy PAM Scatter Plot')
Demodulate the received signals.
recovpsk = pskdemod(rxpsk,M); recovpam = pamdemod(rxpam,M);
Compute the number of symbol errors for each modulation scheme. The PSK signal experiences a much greater number of symbol errors.
numerrs_psk = symerr(msg,recovpsk); numerrs_pam = symerr(msg,recovpam); [numerrs_psk numerrs_pam]
ans = 1×2
795 3
Modulate and Demodulate QPSK Signal in AWGN
Generate random symbols.
dataIn = randi([0 3],1000,1);
QPSK modulate the data.
txSig = pskmod(dataIn,4,pi/4);
Pass the signal through an AWGN channel.
rxSig = awgn(txSig,10);
Demodulate the received signal and compute the number of symbol errors.
dataOut = pskdemod(rxSig,4,pi/4); numErrs = symerr(dataIn,dataOut)
numErrs = 3
PSK Symbol Mapping
Set the modulation order, then create a data sequence containing a complete set of constellation points.
M = 8; data = (0:M-1); phaseoffset = 0;
Visualize the plot constellations of 8-PSK symbol mapping for modulated and demodulated gray-coded and binary-coded data.
symgray = pskmod(data,M,phaseoffset,'gray',PlotConstellation=true, ... InputType='integer');
mapgray = pskdemod(symgray,M,phaseoffset,'gray',OutputType='integer'); symbin = pskmod(data,M,phaseoffset,'bin'); mapbin = pskdemod(symbin,M,phaseoffset,'bin',PlotConstellation=true, ... OutputType='bit');
Input Arguments
Y
— M-PSK modulated input signal
scalar | vector | matrix
M-PSK modulated input signal, specified as a scalar, vector, or matrix.
When Y
is a matrix, the function processes the columns
independently.
Data Types: double
| single
Complex Number Support: Yes
M
— Modulation order
positive integer
Modulation order, specified as an integer value greater than 1.
Data Types: double
phaseoffset
— Phase offset
0
(default) | scalar
Phase offset of the PSK constellation in radians, specified as a scalar.
Data Types: double
symorder
— Symbol order
'gray'
(default) | 'bin'
| vector
Symbol order, specified as 'gray'
,
'bin'
or a vector. This argument specifies how the
function assigns binary vectors to corresponding integers.
'gray'
— Use a Gray-coded ordering.'bin'
— Use a binary-coded ordering.vector –– Use custom symbol ordering. The vector is of length
M
containing unique values in the range [0,M
– 1]. The first element correlates to the constellation point corresponding to anglephaseoffset
, with subsequent elements running counter-clockwise.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: Z =
pskdemod(Y,M,phaseoffset,symorder,OutputType='bit')
OutputType
— Output type
'integer'
(default) | 'bit'
| 'llr'
| 'approxllr'
Output type, specified as 'integer'
,
'bit'
, 'llr'
, or
'approxllr'
.
OutputDataType
— Data type of output
'double'
| 'single'
| ...
Data type of the output, specified as one of the data types listed in
this table. 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' |
The default value is the data type of input Y
.
Dependencies
To enable this argument, set OutputType
to 'integer'
or
'bit'
.
NoiseVariance
— Noise variance
1
(default) | positive scalar | vector of positive values
Noise variance, specified as one of these options:
Positive scalar — The function uses the same noise variance value on all input elements.
Vector of positive values — For all the elements of the input along the corresponding last dimension, the function uses the noise variance specified by each element of the vector. The vector length must be equal to the number of columns in the input signal.
The demodulation function expects a complex input signal. In the case of BPSK, the modulator outputs a complex signal with a zero-valued imaginary part. If you instead input a real signal to the demodulator, you must represent the noise power of a complex signal in the real-valued input signal by setting the variance value to twice the variance of the real-valued input signal.
Tip
The exact LLR algorithm computes exponentials using finite precision arithmetic. For computations involving very large positive or negative magnitudes, the exact LLR algorithm yields:
Inf
or-Inf
if the noise variance is a very large valueNaN
if the noise variance and signal power are both very small values
The approximate LLR algorithm does not compute exponentials. You can avoid
Inf
, -Inf
, and NaN
results by using
the approximate LLR algorithm.
Dependencies
This argument applies when you set OutputType
to 'llr'
or
'approxllr'
.
Data Types: double
PlotConstellation
— Option to plot constellation
false
or
0
(default) | true
or 1
Option to plot constellation, specified as logical
0
(false
) or
1
(true
). To plot the
constellation, set PlotConstellation
to
true
.
Data Types: logical
Output Arguments
Z
— M-PSK demodulated output signal
scalar | vector | matrix
M-PSK demodulated output signal, returned as a scalar, vector, or matrix.
The value and dimension of this output vary depending on the specified
OutputType
value, as shown in this table.
OutputType | pskdemod Output
Value | Dimensions of Output |
---|---|---|
'integer' | Demodulated integer values in the range [0,
M – 1] | Z has the same dimensions as the
input Y . |
'bit' | Demodulated bits | The number of rows in Z
is log2(M ) times the number of rows in
Y . The function maps each
demodulated symbol to a group of log2(M ) bits, where the first bit represents the
MSB and the last bit represents the LSB. |
'llr' | Log-likelihood ratio value for each bit calculated using the exact log-likelihood algorithm. For details, see Exact LLR Algorithm. | |
'approxllr' | Approximate log-likelihood ratio value for each bit. The values are calculated using the approximate log-likelihood algorithm. For details, see Approximate LLR Algorithm. |
References
[1] Proakis, John G. Digital Communications. 4th ed. New York: McGraw Hill, 2001.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function supports GPU array inputs. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006aR2024b: Add GPU array support
The pskdemod
function adds support for gpuArray
(Parallel Computing Toolbox) object processing to run
code on a graphics processing unit (GPU).
R2022a: New enhancements to the function
You can now:
Specify a binary output using the
OutputType
argument.Specify custom symbol mapping using the
symorder
argument. The default now is'gray'
symbol mapping.Perform soft-decision demodulation by using the bit-wise log-likelihood or approximate log-likelihood algorithm
Specify all built-in numeric data types using the
OutputDataType
argument.Visualize the reference constellation using the
PlotConstellation
argument.
See Also
Functions
Blocks
MATLAB Command
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.
Select a Web Site
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: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)