Main Content

comm.PAMModulator

(Not recommended) Modulate using M-ary pulse amplitude modulation

comm.PAMModulator is not recommended. Use pammod instead. For more information, see Version History.

Description

The comm.PAMModulator System object™ modulates a signal by using M-ary pulse amplitude modulation (PAM) method. The output is a baseband representation of the modulated signal.

To modulate a signal using M-ary pulse amplitude modulation:

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

pammodulator = comm.PAMModulator creates a modulator System object that modulates the input signal using M-PAM method.

pammodulator = comm.PAMModulator(Name=Value) sets Properties using one or more name-value arguments. For example, comm.PAMModulator(ModulationOrder=2) sets the number of points in the signal constellation to 2.

pammodulator = comm.PAMModulator(M,Name=Value) sets the ModulationOrder property by using M input argument.

example

Input Arguments

expand all

Modulation order, specified as an positive even integer. M represents the number of points in signal constellation.

Data Types: double

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.

General Properties

Number of points in the signal constellation, specified as one of these options.

  • When you set the BitInput property to false, ModulationOrder must be positive even integer.

  • When you set the BitInput property to true, ModulationOrder must be an integer power of two.

The comm.PAMModulatorSystem object scales the signal constellation based on how you set the NormalizationMethod property. For more information, see Constellation Size and Scaling.

Bit input, specified as a numeric or logical 0 (false) or 1 (true).

  • 1(true) — Use this option to specify the object input, x, as a column vector of bit values that represent integers. These binary-valued signals are grouped in K = log2(M) bits, where K is the number of bits per symbol and M is the modulation order.

  • 0 (false) — Use this option to specify the object input, x, as a column vector of integer symbol values in the range [0, M - 1]. M is the modulation order.

Data Types: logical

Constellation encoding, specified as one of these options."Gray" or "Binary".

Symbol mapping specifies how the object maps an integer or group of log2(ModulationOrder) input bits to the corresponding symbol.

  • When you set this property to "Gray", the object uses a Gray-encoded signal constellation.

  • When you set this property to "Binary", the input integer m maps to the complex value 2mM + 1. M is the property ModulationOrder value and m lies in the range [0, (M – 1)].

Constellation normalization method used to normalize the signal constellation, specified as "Minimum distance between symbols", "Average power", or "Peak power". For more information, see Constellation Size and Scaling.

Minimum distance between two symbols, specified as a positive scalar.

Dependencies

To enable this property, set the NormalizationMethod property is set to "Minimum distance between symbols".

Data Types: double

Average power of the symbols in the constellation, specified as a positive scalar.

Dependencies

To enable this property, set the NormalizationMethod property is set to "Average power".

Data Types: double

Peak power of the symbols in the constellation, specified as a positive scalar.

Dependencies

To enable this property, set the NormalizationMethod property is set to "Peak power".

Data Types: double

Data type of output, specified as "double", "single", or "Custom".

Fixed-Point Properties

Fixed-point data type of the output, specified as a numerictype (Fixed-Point Designer) function with the Signedness name-value argument set to "Auto".

Dependencies

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

Usage

Description

Y = pammodulator(X) modulates the input signal using M-PAM method. The output is the baseband modulated signal.

example

Input Arguments

expand all

Input signal, specified as a scalar or column vector.

Depending on the value of the BitInput property, input X can be an integer or bit-valued column vector with numeric, logical, or fixed-point data types.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | logical | fi

Output Arguments

expand all

Modulated baseband signal, returned as a scalar or column vector. Use the OutputDataType property to specify the output data type.

Data Types: single | double | fi
Complex Number Support: Yes

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
cloneCreate duplicate System object
isLockedDetermine if System object is in use

Examples

collapse all

Modulate and demodulate a signal using 16-PAM modulation.

hMod = comm.PAMModulator(16);
hAWGN = comm.AWGNChannel("NoiseMethod", ...
    "Signal to noise ratio (SNR)", ...
    SNR=20, SignalPower=85);
hDemod = comm.PAMDemodulator(16);
% Create an error rate calculator
hError = comm.ErrorRate;
for counter = 1:100
    % Transmit a 50-symbol frame
    data = randi([0 hMod.ModulationOrder-1],50,1);
    modSignal = hMod(data);
    noisySignal = hAWGN(modSignal);
    receivedData = hDemod(noisySignal);
    errorStats = hError(data,receivedData);
end
fprintf('Error rate = %f\nNumber of errors = %d\n', ...
    errorStats(1), errorStats(2))
Error rate = 0.112600
Number of errors = 563

Algorithms

expand all

Extended Capabilities

Version History

Introduced in R2012a

collapse all

R2018b: Not recommended

comm.PAMModulator is not recommended. Use pammod instead.

n = 10000;              % Number of symbols to process
M = 8;                  % Modulation order
x = randi([0 M-1],n,1); % Create message signal

%% Using PAM modulation and demodulation System objects
pammodObj = comm.PAMModulator(M);
pamdemodObj = comm.PAMDemodulator(M);
yOld = pammodObj(x);                 % Modulate
% Channel filtering
zOld = pamdemodObj(complex(yOld));   % Demodulate

%% Using PAM modulation and demodulation functions
yNew = pammod(x,M);     % Modulate
% Channel filtering
zNew = pamdemod(y,M);   % Demodulate
isequal(zOld,zNew)

See Also

|