Main Content

comm.PSKModulator

(To be removed) Modulate signal using M-PSK method

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

Description

The PSKModulator System object™ modulates using the M-ary phase shift keying (M-PSK) method. The output is a baseband representation of the modulated signal.

To modulate a signal by using the M-PSK method:

  1. Create the comm.PSKModulator 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

mpskmod = comm.PSKModulator creates a modulator System object, that modulates the input signal using the M-ary phase shift keying (M-PSK) method.

mpskmod = comm.PSKModulator(Name=Value) sets properties using one or more name-value arguments. For example, BitInput=true specifies input values must be binary.

example

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

mpskmod = comm.PSKModulator(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 the signal constellation, specified as a positive integer.

Data Types: double

Phase of the zeroth point of 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 provide input in bits, specified as a numeric or logical 0 (false) or 1 (true).

  • If you set this property to false, the input values must be integers in the range [0, M–1], where M is the ModulationOrder.

  • If you set this property to true, the input values must be binary and the input vector length must be an integer multiple of the number of bits per symbol, log2(M). 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

Output data type, specified as either 'double', 'single' or 'Custom'.

Fixed-Point Properties

Fixed-point data type of the output signal, specified as a numerictype object with its Signedness property set to Auto. To create this type of object, use the numerictype (Fixed-Point Designer) function.

Dependencies

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

Usage

Description

mpsksignal = mpskmod(insignal) modulates the input signal by using the M-PSK method. The output is the modulated M-PSK baseband signal.

Input Arguments

expand all

Input signal, specified as a column vector of integers or bits. The BitInput property specifies the expected input values and vector length.

Data Types: double

Output Arguments

expand all

M-PSK modulated baseband signal, returned as a scalar or vector of complex-valued constellation symbols. The OutputDataType property specifies the data type of the output.

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')

Algorithms

For binary-encoding, the output baseband signal maps input bits or integers to complex symbols according to:

sn(t)=exp(jπ(2n+1M));n{0,1,,M1}.

When the input is configured for bits, groups of log2(M) bits represent the complex symbols for the configured symbol mapping. The mapping can be binary encoded, Gray encoded, or custom encoded.

Gray coding has the advantage that only one bit changes between adjacent constellation points, which results in better bit error rate performance. This table shows the mapping between the input and output symbols for 8-PSK modulation with Gray coding.

InputOutput
0 0 (000)
1 1 (001)
2 3 (011)
3 2 (010)
4 6 (110)
5 7 (111)
6 5 (101)
7 4 (100)

This constellation diagram shows the corresponding symbols and their binary values.

Constellation diagram showing 8-PSK Gray Mapping with phase offset=0.3972 radians

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.PSKModulator will be removed in a future release. Use the pskmod function to M-ary PSK modulate the input signal.