Main Content


Phase shift keying demodulation



z = pskdemod(y,M) demodulates the complex envelope, y, of a PSK-modulated signal having modulation order M.


z = pskdemod(y,M,ini_phase) specifies the initial phase of the PSK-modulated signal.

z = pskdemod(y,M,ini_phase,symorder) specifies the symbol order of the PSK-modulated signal.


collapse all

Compare PSK and PAM modulation schemes to demonstrate that PSK is more sensitive to phase noise. This is the expected result 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);

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 by applying a random phase rotation.

phasenoise = randn(len,1)*.015;
rxpsk = txpsk.*exp(2i*pi*phasenoise);
rxpam = txpam.*exp(2i*pi*phasenoise);

Create scatter plots of the received signals.

title('Noisy PSK Scatter Plot')

Figure Scatter Plot contains an axes. The axes with title Noisy PSK Scatter Plot contains an object of type line. This object represents Channel 1.

title('Noisy PAM Scatter Plot')

Figure Scatter Plot contains an axes. The axes with title Noisy PAM Scatter Plot contains an object of type line. This object represents Channel 1.

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

   343     1

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 = 2

Plot PSK symbol mapping for Gray and natural binary encoded data.

Set the modulation order, and then create a data sequence containing a complete set of constellation points.

M = 8;
data = (0:M-1);
phz = 0;

Modulate and demodulate the data using Gray and natural binary encoded data.

symgray = pskmod(data,M,phz,'gray');
mapgray = pskdemod(symgray,M,phz,'gray');

symbin = pskmod(data,M,phz,'bin');
mapbin = pskdemod(symbin,M,phz,'bin');

Plot the constellation points using one of the symbol sets. For each constellation point, assign a label indicating the Gray and natural binary values for each symbol.

  • For Gray binary symbol mapping, adjacent constellation points differ by a single binary bit and are not numerically sequential.

  • For natural binary symbol mapping, adjacent constellation points follow the natural binary encoding and are sequential.

for k = 1:M
        dec2base(mapbin(k),2,4),'Color',[1 0 0]);
        num2str(mapbin(k)),'Color',[1 0 0]);
axis([-2 2 -2 2])

Figure Scatter Plot contains an axes. The axes with title Scatter plot contains 33 objects of type line, text. This object represents Channel 1.

Input Arguments

collapse all

PSK-modulated input signal, specified as a real or complex vector or matrix. If y is a matrix, the function processes the columns independently.

Data Types: double
Complex Number Support: Yes

Modulation order, specified as an integer power of two.

Example: 2 | 4 | 16

Data Types: double

Initial phase of the PSK modulation, specified in radians as a real scalar.

If ini_phase is empty, then pskdemod uses an initial phase of 0.

Example: pi/4

Data Types: double

Symbol order, specified as 'bin' or 'gray'. This argument specifies how the function assigns binary vectors to corresponding integers.

  • If symorder is 'bin', the function uses a natural binary-coded ordering.

  • If symorder is 'gray', the function uses a Gray-coded ordering.

Data Types: char

Output Arguments

collapse all

PSK-demodulated output signal, returned as a vector or matrix having the same number of columns as input signal y.

Introduced before R2006a