Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

comm.PSKDemodulator System object

Package: comm

Demodulate using M-ary PSK method

Description

The PSKDemodulator object demodulates an input signal using the M-ary phase shift keying (M-PSK) method.

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

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

  2. Call step to demodulate the signal according to the properties of comm.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.

Construction

H = comm.PSKDemodulator creates a demodulator System object, H. This object demodulates the input signal using the M-ary phase shift keying (M-PSK) method.

H = comm.PSKDemodulator(Name,Value) creates an M-PSK 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.PSKDemodulator(M,PHASE,Name,Value) creates an M-PSK demodulator object, H. This object has the ModulationOrder property set to M, the PhaseOffset property set to PHASE, and the other specified properties 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.

Properties

ModulationOrder

Number of points in signal constellation

Specify the number of points in the signal constellation as a positive, integer scalar value. 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 value. The default is pi/8.

BitOutput

Output data as bits

Specify whether the output consists of groups of bits or integer symbol values. The default is false. When you set this property to true, the step method outputs a column vector of bit values. The length of this vector equals 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. This vector contains integer symbol values between 0 and ModulationOrder-1.

SymbolMapping

Constellation encoding

Specify how the object maps an integer or group of log2(ModulationOrder) bits to the corresponding symbol. Choose from 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, between 0 mModulationOrder1) maps to the complex value exp(j×PhaseOffset + j×2×π×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 requires a row or column vector with a size of ModulationOrder. This vector must have unique integer values in the range [0, ModulationOrder1]. 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 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 instead because the algorithm for that option 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. It 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, the input data type is single- or double-precision, the output data has the same data type as 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. If you set the BitOutput property to true and the DecisionMethod property to Log-likelihood ratio or Approximate log-likelihood ratio, the output data has the same data type as the input. In this case, the data type must be single- or double-precision.

 Fixed-Point Properties

Methods

constellationCalculate or plot ideal signal constellation
stepDemodulate using M-ary PSK method
Common to All System Objects
clone

Create System object with same property values

getNumInputs

Expected number of inputs to a System object

getNumOutputs

Expected number of outputs of a System object

isLocked

Check locked states of a System object (logical)

release

Allow System object property value changes

Examples

expand all

Create 16-PSK modulator and demodulator System objects™ in which custom symbol mapping is used. Estimate the BER in an AWGN channel and compare the performance with that of a theoretical Gray-coded PSK system.

Create a custom symbol mapping for the 16-PSK modulation scheme. The 16 integer symbols must have values which fall between 0 and 15.

custMap = [0 2 4 6 8 10 12 14 15 13 11 9 7 5 3 1];

Create a 16-PSK modulator and demodulator pair having custom symbol mapping defined by the array, custMap.

pskModulator = comm.PSKModulator(16,'BitInput',true, ...
    'SymbolMapping','Custom', ...
    'CustomSymbolMapping',custMap);
pskDemodulator = comm.PSKDemodulator(16,'BitOutput',true, ...
    'SymbolMapping','Custom', ...
    'CustomSymbolMapping',custMap);

Display the modulator constellation.

constellation(pskModulator)

Create an AWGN channel System object for use with 16-ary data.

awgnChannel = comm.AWGNChannel('BitsPerSymbol',log2(16));

Create an error rate object to track the BER statistics.

errorRate = comm.ErrorRate;

Initialize the simulation vectors. The Eb/No is varied from 6 to 18 dB in 1 dB steps.

ebnoVec = 6:18;
ber = zeros(size(ebnoVec));

Estimate the BER by modulating binary data, passing it through an AWGN channel, demodulating the received signal, and collecting the error statistics.

for k = 1:length(ebnoVec)

    % Reset the error counter for each Eb/No value
    reset(errorRate)
    % Reset the array used to collect the error statistics
    errVec = [0 0 0];
    % Set the channel Eb/No
    awgnChannel.EbNo = ebnoVec(k);

    while errVec(2) < 200 && errVec(3) < 1e7
        % Generate a 1000-symbol frame
        data = randi([0 1],4000,1);
        % Modulate the binary data
        modData = pskModulator(data);
        % Pass the modulated data through the AWGN channel
        rxSig = awgnChannel(modData);
        % Demodulate the received signal
        rxData = pskDemodulator(rxSig);
        % Collect the error statistics
        errVec = errorRate(data,rxData);
    end

    % Save the BER data
    ber(k) = errVec(1);
end

Generate theoretical BER data for an AWGN channel using berawgn.

berTheory = berawgn(ebnoVec,'psk',16,'nondiff');

Plot the simulated and theoretical results. Because the simulated results rely on 16-PSK modulation that does not use Gray codes, the performance is not as good as that predicted by theory.

figure
semilogy(ebnoVec,[ber; berTheory])
xlabel('Eb/No (dB)')
ylabel('BER')
grid
legend('Simulation','Theory','location','ne')

Algorithms

expand all

Extended Capabilities

Introduced in R2012a

Was this topic helpful?