Main Content

comm.PSKDemodulator

(To be removed) Demodulate using M-ary PSK method

comm.PSKDemodulator will be removed in a future release. Use pskdemod instead. For information on updating your code, see Version History.

Description

The comm.PSKDemodulator object demodulates a signal that was modulated using the M-ary phase shift keying (M-PSK) method. The input is a baseband representation of the modulated signal.

To demodulate a signal that was modulated using the M-PSK method:

  1. Create the comm.PSKDemodulator object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

mpskdemod = comm.PSKDemodulator creates a System object™ to demodulate input M-PSK signals.

mpskdemod = comm.PSKDemodulator(Name=Value) sets properties using one or more name-value arguments. For example, DecisionMethod="Hard decision" specifies demodulation using the hard-decision method.

mpskdemod = comm.PSKDemodulator(M,Name=Value) sets the ModulationOrder property to M and optional name-value arguments.

example

mpskdemod = comm.PSKDemodulator(M,phase,Name=Value) sets the ModulationOrder property to M, the PhaseOffset property to phase, and optional name-value arguments. Specify phase in radians.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Number of points in signal constellation, specified as a positive integer.

Data Types: double

Phase of the zeroth point in the constellation in radians, specified as a scalar.

Example: PhaseOffset=0 aligns the QPSK signal constellation points on the axes {(1,0), (0,j), (-1,0), (0,-j)}.

Data Types: double

Option to output data as bits, specified as a logical 0 (false) or 1 (true).

  • Set this property to false to output symbols as integer values in the range [0, (M – 1)] with length equal to the input data vector. M represents the value of the ModulationOrder.

  • Set this property to true to output a column vector of bit values with length equal to log2(M) times the number of demodulated symbols. Groups of log2(M) bits are mapped onto a symbol, with the first bit representing the MSB and the last bit representing the LSB.

Data Types: logical

Symbol encoding mapping of constellation bits, specified as 'Gray', 'Binary', or 'Custom'. Each integer or group of log2(ModulationOrder) bits corresponds to one symbol.

  • When you set this property to 'Gray', the object map symbols to a Gray-encoded signal constellation.

  • When you set this property to 'Binary', the object map symbols to a natural binary-encoded signal constellation. Specifically, the complex value ej(PhaseOffset + (2πm/ModulationOrder)), where m is an integer in the range [0, (ModulationOrder1)].

  • When you set this property to 'Custom', the object map symbols to the signal constellation defined in the CustomSymbolMapping property.

Custom symbol encoding, specified as an integer vector with length equal to the value of ModulationOrder and unique values in the range [0, (ModulationOrder1)]. 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 –2π/ModulationOrder + PhaseOffset.

Dependencies

To enable this property, set the SymbolMapping property to 'Custom'.

Data Types: double

Demodulation decision method, specified as 'Hard decision', 'Log-likelihood ratio', or 'Approximate log-likelihood ratio'. When you set the BitOutput property to false, the object always performs hard-decision demodulation.

Dependencies

To enable this property, set the BitOutput property to true.

Source of noise variance, specified as 'Property' or 'Input port'.

Dependencies

To enable this property, set the BitOutput property to true and the DecisionMethod property to 'Log-likelihood ratio' or 'Approximate log-likelihood ratio'.

Noise variance, specified as a positive scalar.

Tunable: Yes

Tips

The exact LLR algorithm computes exponentials using finite precision arithmetic. For computations involving very large positive or negative magnitudes, the exact LLR algorithm yields:

  • Inf or -Inf if the noise variance is a very large value

  • NaN if the noise variance and signal power are both very small values

The approximate LLR algorithm does not compute exponentials. You can avoid Inf, -Inf, and NaN results by using the approximate LLR algorithm.

Dependencies

To enable this property, set the BitOutput property to true, the DecisionMethod property to 'Log-likelihood ratio' or 'Approximate log-likelihood ratio', and the VarianceSource property to 'Property'.

Data Types: double

Data type of the output, specified as 'Full precision', 'Smallest unsigned integer', 'double', 'single', 'int8', 'uint8', 'int16', 'uint16', 'int32', or 'uint32','logical'.

  • When the input data type is single or double precision and you set the BitOutput property to true, the DecisionMethod property to 'Hard decision', and the OutputDataType property to 'Full precision', the output has the same data type 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 is 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 and the input data type must be single or double precision.

Dependencies

To enable this property, set the BitOutput property to false or set the BitOutput property to true and the DecisionMethod property to 'Hard decision'.

Fixed-Point Properties

Data type of the derotate factor, specified as 'Same word length as input' or 'Custom'. The object uses the derotate factor in the computations only when the ModulationOrder property is 2, 4, or 8, the input signal is a fixed-point type, and the PhaseOffset property has a nontrivial value.

  • For ModulationOrder = 2, the phase offset is trivial if it is a multiple of π/2.

  • For ModulationOrder = 4, the phase offset is trivial if it is an even multiple of π/4.

  • For ModulationOrder = 8, there are no trivial phase offsets.

Dependencies

To enable this property, set the BitOutput property to false or set the BitOutput property to true and the DecisionMethod property to 'Hard decision'.

Fixed-point data type of the derotate factor, specified as an unscaled numerictype (Fixed-Point Designer) object with a Signedness of Auto. The word length must be a value in the range [2, 128].

Dependencies

To enable this property, set the DerotateFactorDataType property to 'Custom'.

Data Types: numerictype object

Usage

Description

y = mpskdemod(x) applies M-PSK demodulation to the input signal and returns the demodulated signal.

example

y = mpskdemod(x,var) uses soft decision demodulation and noise variance var. This syntax applies when you set the BitOutput property to true, the DecisionMethod property to 'Approximate log-likelihood ratio' or 'Log-likelihood ratio', and the VarianceSource property to 'Input port'.

Input Arguments

expand all

M-PSK-modulated signal, specified as a scalar or column vector.

Dependencies

The object accepts inputs with a signed integer data type or signed fixed point (sfi (Fixed-Point Designer)) objects when you set the ModulationOrder property to a value less than or equal to 8 and you set the BitOutput property to false or you set the DecisionMethod property to 'Hard decision' and the BitOutput property to true.

Data Types: double | single | int | fi

Noise variance, specified as a scalar.

Dependencies

To enable this argument, set the VarianceSource property to 'Input port', the BitOutput property to true, and the DecisionMethod property to 'Approximate log-likelihood ratio' or 'Log-likelihood ratio'.

Data Types: single | double

Output Arguments

expand all

Output signal, returned as a scalar or column vector. To specify whether the object outputs values as integers or bits, use the BitOutput property. To specify the output data type, use the OutputDataType property.

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

constellationCalculate or plot ideal signal constellation
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Create 16-PSK modulator and demodulator System objects that use custom symbol mapping. Estimate the BER in an AWGN channel and compare the performance to a theoretical Gray-coded PSK system.

Create a custom symbol mapping for the 16-PSK modulation scheme. The 16 integer symbols must have values in the range [0, 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);

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. Vary E b / N 0 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 n = 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(n);
    
    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(n) = errVec(1);
end

Generate theoretical BER data for an AWGN channel using the berawgn function.

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

Use this code to plot the simulated and theoretical results. The 16-PSK modulation BER performance of the simulated custom symbol mapping is not as good as the theoretical prediction curve for Gray codes.

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

More About

expand all

References

[1] Proakis, John G. Digital Communications. 4th ed. New York: McGraw Hill, 2001.

Extended Capabilities

Version History

Introduced in R2012a

collapse all

R2023a: To be removed

comm.PSKDemodulator will be removed in a future release. Use the pskdemod function to M-ary PSK demodulate the input signal.