Phase shift keying demodulation
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.
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
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.
scatterplot(symgray,1,0,'b*'); for k = 1:M text(real(symgray(k))-0.2,imag(symgray(k))+.15,... dec2base(mapgray(k),2,4)); text(real(symgray(k))-0.2,imag(symgray(k))+.3,... num2str(mapgray(k))); text(real(symbin(k))-0.2,imag(symbin(k))-.15,... dec2base(mapbin(k),2,4),'Color',[1 0 0]); text(real(symbin(k))-0.2,imag(symbin(k))-.3,... num2str(mapbin(k)),'Color',[1 0 0]); end axis([-2 2 -2 2])
y
— PSK-modulated input signalPSK-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
M
— Modulation orderModulation order, specified as an integer power of two.
Example: 2
| 4
| 16
Data Types: double
ini_phase
— Initial phase[]
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
symorder
— Symbol order'bin'
(default) | 'gray'
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
z
— PSK-demodulated output signalPSK-demodulated output signal, returned as a vector or matrix
having the same number of columns as input signal y
.
You have a modified version of this example. Do you want to open this example with your edits?