pskmod
Modulate signal using M-PSK method
Syntax
Description
specifies the phase offset of the M-PSK constellation.y
= pskmod(x
,M
,phaseoffset
)
specifies the symbol order of the M-PSK constellation.y
= pskmod(x
,M
,phaseoffset
,symorder
)
specifies options using name-value arguments.y
= pskmod(x
,M
,Name=Value
)
Examples
Modulate PSK Signal
Modulate and plot the constellations of QPSK and 16-PSK signals.
QPSK
Set the modulation order to 4.
M = 4;
Generate random data symbols.
data = randi([0 M-1],1000,1);
Modulate the data symbols.
txSig = pskmod(data,M,pi/M);
Pass the signal through white noise and plot its constellation.
rxSig = awgn(txSig,20); scatterplot(rxSig)
16-PSK
Change the modulation order from 4 to 16.
M = 16;
Generate random data symbols.
data = randi([0 M-1],1000,1);
Modulate the data symbols.
txSig = pskmod(data,M,pi/M);
Pass the signal through white noise and plot its constellation.
rxSig = awgn(txSig,20); scatterplot(rxSig)
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
x
— Input signal
scalar | vector | matrix
Input signal, specified as a scalar, vector, or matrix of positive
integers. The elements of x
must have binary or integer
values in the range [0, M
–1], where
M
is the modulation order.
Note
To process an input signal as binary elements, set the
InputType
name-value argument to
'bit'
. For binary inputs, the number of rows must
be an integer multiple of log2(M
). The function maps groups of log2(M
) bits onto a symbol, with the first bit representing
the MSB and the last bit representing the LSB.
Data Types: double
| single
| int8
| int16
| int32
| uint8
| uint16
| uint32
| logical
M
— Modulation order
integer value greater than 1
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.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: y =
pskmod(x,M,phaseoffset,symorder,InputType='bit')
InputType
— Input type
'integer'
(default) | 'bit'
Input type, specified as either 'integer'
or
'bit'
.
'integer'
–– Input signal consists of integers in the range [0,M
–1].'bit'
–– Input signal consists of binary values and the number of rows must be an integer multiple of log2(M
).
OutputDataType
— Output data type
'double'
(default) | 'single'
Output data type, specified as either 'double'
or
'single'
.
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 PSK
constellation, set 'PlotConstellation'
to
true
.
Output Arguments
y
— M-PSK modulated baseband signal
scalar | vector | matrix
M-PSK modulated baseband signal, returned as a scalar, vector or matrix of
complex values. The columns of y
represent independent
channels. For integer inputs, the output y
has the same
dimensions as the input signal x
. For bit inputs, the
number of rows in y
is the number of rows in
x
divided by log2(M
).
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™.
Version History
Introduced before R2006aR2022a: New enhancements to the function
You can now:
Specify a binary input using the
InputType
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.
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)