Accelerating the pace of engineering and science

# comm.QPSKDemodulator System object

Package: comm

Demodulate using QPSK method

## Description

The QPSKDemodulator object demodulates a signal that was modulated using the quaternary phase shift keying method. The input is a baseband representation of the modulated signal.

To demodulate a signal that was modulated using quaternary phase shift keying:

1. Define and set up your QPSK demodulator object. See Construction.

2. Call step to demodulate the signal according to the properties of comm.QPSKDemodulator. The behavior of step is specific to each object in the toolbox.

## Construction

H = comm.QPSKDemodulator creates a demodulator System object™, H. This object demodulates the input signal using the quadrature phase shift keying (QPSK) method.

H = comm.QPSKDemodulator(Name,Value) creates a QPSK demodulator object, H, with each 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.QPSKDemodulator(PHASE,Name,Value) creates a QPSK demodulator object, H. This object has the PhaseOffset property set to PHASE, and the other specified properties set to the specified values.

## Properties

 PhaseOffset Phase of zeroth point in constellation Specify the phase offset of the zeroth point in the constellation, in radians, as a real scalar value. The default is pi/4. 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 twice the number of demodulated symbols. When you set this property to false, the step method outputs a column vector with length equal to the input data vector. This vector contains integer symbol values between 0 and 3. The default is false. SymbolMapping Constellation encoding Specify how the object maps an integer or group of 2 bits to the corresponding symbol as one of Binary | Gray. 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, between $0\le m\le 3$ maps to the complex value exp(j$×$PhaseOffset + j$×$$2\pi ×m}{4}$). DecisionMethod Demodulation decision method Specify the decision method the object uses as Hard decision | Log-likelihood ratio | Approximate log-likelihood ratio. The default is Hard decision. When you set the BitOutput property 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 Noise variance Specify the variance of the noise as a positive, real scalar value. The default is 1. If this value is very small (i.e., SNR is very high), log-likelihood ratio (LLR) computations may yield Inf or -Inf. This result occurs because the LLR algorithm computes the exponential of very large or very small numbers using finite-precision arithmetic. In such cases, use approximate LLR is because that option's 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 Specify the output data type as Full precision | Smallest unsigned integer | double | single | int8 | uint8 | int16 | uint16 | int32 | uint32. The default is Full precision. This property applies when you set the BitOutput property to false. The property also applies when you set the BitOutput property to true and the DecisionMethod property to Hard decision. In this second case, when the OutputDataType property is set to Full precision, and the input data type is single or double precision, the output data has the same as that of the input. When the input data is of a fixed-point type, the output data type behaves as if you had set the OutputDataType property to Smallest unsigned integer. When you set BitOutput to true and the DecisionMethod property to Hard Decision, then logical data type becomes a valid option. When you set the BitOutput property to true and the DecisionMethod property to Log-likelihood ratio or Approximate log-likelihood ratio, the output data type is the same as that of the input. In this case, that data type can only be single or double precision.

## Methods

 clone Create QPSK demodulator object with same property values constellation Calculate or plot ideal signal constellation getNumInputs Number of expected inputs to step method getNumOutputs Number of outputs from step method isLocked Locked status for input attributes and nontunable properties release Allow property value and input characteristics changes step Demodulate using QPSK method

## Examples

Modulate and demodulate a signal using QPSK modulation.

```    hMod = comm.QPSKModulator('PhaseOffset',pi/4);
hAWGN = comm.AWGNChannel('NoiseMethod',...
'Signal to noise ratio (SNR)','SNR',15);
hDemod = comm.QPSKDemodulator('PhaseOffset',pi/4);
%Create an error rate calculator
hError = comm.ErrorRate;
for counter = 1:100
% Transmit a 50-symbol frame
data = randi([0 3],50,1);
modSignal = step(hMod, data);
noisySignal = step(hAWGN, modSignal);
end
fprintf('Error rate = %f\nNumber of errors = %d\n', ...
errorStats(1), errorStats(2))
```

## Algorithms

This object implements the algorithm, inputs, and outputs described on the QPSK Demodulator Baseband block reference page. The object properties correspond to the block parameters.