Documentation |
Package: comm
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 in the Parallel Computing Toolbox documentation. |
A GPU-based System object™ accepts typical MATLAB^{®} arrays or objects that you create using the gpuArray class as an input to the step method. GPU-based System objects support input signals with double- or single-precision data types. The output signal inherits its datatype from the input signal.
If the input signal is a MATLAB array, then the output signal is also a MATLAB array. In this case, the System object handles data transfer between the CPU and GPU.
If the input signal is a gpuArray, then the output signal is also a gpuArray. In this case, the data remains on the GPU. Therefore, when the object is given a gpuArray, calculations take place entirely on the GPU and no data transfer occurs. Invoking the step method with gpuArray arguments provides increased performance by reducing simulation time. For more information, see Establish Arrays on a GPU in the Parallel Computing Toolbox documentation.
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.
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.
ModulationOrder |
Number of points in signal constellation Specify the number of points in the signal constellation as a positive, integer scalar. The default is 8. |
PhaseOffset |
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. |
BitOutput |
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 0 and ModulationOrder-1. The default is false. |
SymbolMapping |
Constellation encoding Specify how the object maps an integer or group of log2(ModulationOrder) bits to the corresponding symbol as Binary | Gray | Custom. The default is Gray. When you set this property to Gray, the object uses a Gray-encoded signal constellation. When you set this property to Binary, the integer m (0 ≤ m ≤ModulationOrder-1) maps to the complex value. This value is represented as exp(j*PhaseOffset + j*2*pi*m/ModulationOrder). When you set this property to Custom, the object uses the signal constellation defined in the CustomSymbolMapping property. |
CustomSymbolMapping |
Custom constellation encoding Specify a custom constellation symbol mapping vector. The default is 0:7. This property must be a row or column vector of size ModulationOrder with unique integer values in the range [0, ModulationOrder-1]. The values must be of data type double. The first element of this vector corresponds to the constellation point at an angle of 0 + PhaseOffset, with subsequent elements running counterclockwise. The last element corresponds to the constellation point at an angle of -π/ModulationOrder + PhaseOffset. This property applies when you set the SymbolMapping property to Custom. |
DecisionMethod |
Demodulation decision method Specify the decision method that the object uses as one of Hard decision | Log-likelihood ratio | Approximate log-likelihood ratio. The default is Hard decision. When you set DecisionMethod to false, the object always performs hard decision demodulation. This property applies when you set the BitOutput property to true. |
VarianceSource |
Source of noise variance Specify the source of the noise variance as one of Property | Input port. The default is Property. This property applies when you set the BitOutput property to true and the DecisionMethod property to Log-likelihood ratio or Approximate log-likelihood ratio. |
Variance |
Specify the variance of the noise as a positive, real scalar. The default is 1. If this value is very small (i.e., SNR is very high), then log-likelihood ratio (LLR) computations may yield Inf or -Inf. This occurs because the LLR algorithm computes the exponential value of very large or very small numbers using finite precision arithmetic. In such cases, use approximate LLR is recommended because its algorithm does not compute exponentials. This property applies when you set the BitOutput property to true, the DecisionMethod property to Log-likelihood ratio or Approximate log-likelihood ratio, and the VarianceSource property to Property. This property is tunable. |
OutputDataType |
Data type of output When you set this property to Full precision, the output signal inherits its data type from the input signal. |
clone | Create PSK demodulator object with same property values |
constellation | Calculate or plot ideal signal constellation |
isLocked | Locked status for input attributes and nontunable properties |
release | Allow property value and input characteristics changes |
step | Demodulate using M-ary PSK method |
The GPU PSK Demodulator System object uses the same algorithm as the comm.PSKDemodulator Communications System Toolbox 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))