Demodulate using M-ary PSK method with GPU
The GPU PSKDemodulator
object demodulates an input
signal using the M-ary phase shift keying (M-PSK) method.
Note
To use this object, you must install a Parallel Computing Toolbox™ license and have access to an appropriate GPU. For more about GPUs, see GPU Computing (Parallel Computing Toolbox).
A GPU-based System object™ accepts typical MATLAB® arrays or objects created using the gpuArray
class. A GPU-based
System object supports input signals with double- or single-precision data types. The output
signal inherits its data type from the input signal.
If the input signal is a MATLAB array, the System object handles data transfer between the CPU and the GPU. The output signal is a MATLAB array.
If the input signal is a gpuArray
, the data remains on the GPU.
The output signal is a gpuArray
. When the object is given a
gpuArray
, calculations take place entirely on the GPU, and no
data transfer occurs. Passing gpuArray
arguments provides
increased performance by reducing simulation time. For more information, see Establish Arrays on a GPU (Parallel Computing Toolbox).
To demodulate a signal that was modulated using phase shift keying:
Define and set up your PSK demodulator object. See Construction.
Call step
to demodulate the signal
according to the properties of comm.gpu.PSKDemodulator
. The behavior of step
is specific to each object in the toolbox.
Note
Starting in R2016b, instead of using the step
method to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For
example, y = step(obj,x)
and y = obj(x)
perform equivalent operations.
H = comm.gpu.PSKDemodulator
returns a GPU-based demodulator
System object, H
. This object demodulates the input signal using
the M-ary phase shift keying (M-PSK) method.
H = comm.gpu.PSKDemodulator(Name,Value)
creates a GPU-based M-PSK
demodulator object, H,
with the specified property set to the
specified value. You can specify additional name-value pair arguments in any order as
(Name1,Value1,...,NameN,ValueN)
H = comm.gpu.PSKDemodulator(M,PHASE,Name,Value)
creates a
GPU-based M-PSK demodulator object, H
, with the ModulationOrder property
set to M
, the PhaseOffset property set to
PHASE
and other specified property names set to the specified
values. M
and PHASE
are value-only arguments. To
specify a value-only argument, you must also specify all preceding value-only arguments.
You can specify name-value pair arguments in any order.
|
Number of points in signal constellation Specify the number of points in the signal constellation as a positive,
integer scalar. The default is |
|
Phase of zeroth point of constellation Specify the phase offset of the zeroth point of the constellation, in radians, as a real scalar. The default is π/8. |
|
Output data as bits Specify whether the output consists of groups of bits or integer symbol
values. When you set this property to true, the step method outputs a column
vector of bit values with length equal to log2(ModulationOrder) times the number of demodulated symbols.
When you set this property to false, the step method outputs a column
vector, with a length equal to the input data vector that contains integer
symbol values between |
|
Constellation encoding Specify how the object maps an integer or group of log2(ModulationOrder) bits to the corresponding symbol as
|
|
Custom constellation encoding Specify a custom constellation symbol mapping vector. The default is
|
|
Demodulation decision method Specify the decision method that the object uses as one of |
|
Source of noise variance Specify the source of the noise variance as one of
|
|
Specify the variance of the noise as a positive, real scalar. The default
is |
|
Data type of output When you set this property to |
constellation | Calculate or plot ideal signal constellation |
step | Demodulate using M-ary PSK method |
Common to All System Objects | |
---|---|
release | Allow System object property value changes |
The GPU PSK Demodulator
System object uses the same algorithm as the comm.PSKDemodulator
System object. See Decoding Algorithm for details.
Transmit an LDPC-encoded, QPSK-modulated bit stream through an AWGN channel. Then demodulate, decode, and count errors.
Transmit an LDPC-encoded, QPSK-modulated bit stream through an AWGN channel.
Create a GPU-based PSK Modulator System object.
hMod = comm.gpu.PSKModulator(16, 'PhaseOffset',pi/16);
Create a GPU-based AWGN Channel System object with a signal-to-noise ratio of 15.
hAWGN = comm.gpu.AWGNChannel('NoiseMethod', ... 'Signal to noise ratio (SNR)','SNR',15);
Create a GPU-based PSK Demodulator System object.
hDemod = comm.gpu.PSKDemodulator(16, 'PhaseOffset',pi/16);
Create an error rate calculator System object.
hError = comm.ErrorRate;
Transmit a frame of data containing 50 symbols.
for counter = 1:100
data = gpuArray.randi([0 hMod.ModulationOrder-1], 50, 1);
Run the simulation by using the step method to process data.
modSignal = step(hMod, data);
noisySignal = step(hAWGN, modSignal);
receivedData = step(hDemod, noisySignal);
errorStats = step(hError, gather(data), gather(receivedData));
end
Compute the error rate results.
fprintf('Error rate = %f\nNumber of errors = %d\n',... errorStats(1), errorStats(2))
Create GPU PSK modulator and demodulator pair.
gpuMod = comm.gpu.PSKModulator; gpuDemod = comm.gpu.PSKDemodulator;
Generate random data symbols. Modulate the data.
txData = randi([0 7],1000,1); txSig = gpuMod(txData);
Pass the signal through an AWGN channel.
rxSig = awgn(txSig,20);
Demodulate the received signal.
rxData = gpuDemod(rxSig);
Determine the number of symbol errors.
numSymErrors = symerr(txData,rxData)
numSymErrors = 736