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:
Create the
comm.PAMModulator
object and set its properties.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
Syntax
Description
creates a
modulator System object that modulates the input signal using M-PAM
method.pammodulator
= comm.PAMModulator
pammodulator = comm.PAMModulator(
sets Properties using one or more name-value arguments.
For example, Name=Value
)comm.PAMModulator(ModulationOrder=2)
sets the
number of points in the signal constellation to 2
.
sets the pammodulator
= comm.PAMModulator(M
,Name=Value
)ModulationOrder
property by using M
input argument.
Input Arguments
M
— Modulation order
positive even integer
Modulation order, specified as an positive even integer.
M
represents the number of points in signal
constellation.
Data Types: double
Properties
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
ModulationOrder
— Number of points in signal constellation
4
(default) | positive even integer
Number of points in the signal constellation, specified as one of these options.
The comm.PAMModulator
System object scales the signal constellation based on how you set the
NormalizationMethod property. For more information, see
Constellation Size and Scaling.
BitInput
— Bit input
0
(false
) (default) | 1
(true
)
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
SymbolMapping
— Constellation encoding
"Gray"
(default) | "Binary"
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 2m – M + 1. M is the property ModulationOrder value and m lies in the range [0, (M – 1)].
NormalizationMethod
— Constellation normalization method
"Minimum distance between symbols"
(default) | "Average power"
| "Peak power"
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.
MinimumDistance
— Minimum distance between two symbols
2
(default) | positive scalar
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
AveragePower
— Average power of symbols in constellation
1
(default) | positive scalar
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
PeakPower
— Peak power of symbols in constellation
1
(default) | positive scalar
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
OutputDataType
— Data type of output
"double"
(default) | "single"
| "Custom"
Data type of output, specified as "double"
,
"single"
, or "Custom"
.
Fixed-Point Properties
CustomOutputDataType
— Fixed-point data type of output
numerictype([],16)
(default) | numerictype
function
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
Syntax
Description
Input Arguments
X
— Input signal
scalar | column vector
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
Y
— Modulated baseband signal
scalar | column vector
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)
Specific to comm.PAMModulator
constellation | Calculate or plot ideal signal constellation |
Examples
Apply 16-PAM
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
Constellation Size and Scaling
The System object outputs the real-valued constellation symbols as a complex signal with the imaginary part equal to zero. Constellation symbols map an integer m in the range [0, (M – 1)] to the complex value 2m – M + 1.
The comm.PAMModulator
scales the default signal constellation based on
how you set the NormalizationMethod property. This table lists the possible scaling
conditions.
Value of Normalization Method
Property | Scaling Condition |
---|---|
"Min. distance between symbols" | The nearest pair of points in the constellation is separated by
the value of the "Min. distance between symbols"
property. |
"Average Power"
| The average power of the symbols in the constellation is
the"Average Power" property. |
"Peak Power"
| The maximum power of the symbols in the constellation is the
"Peak Power" property. |
The SymbolMapping property specifies whether the System object assigns signal constellation points using binary-coded or Gray-coded mapping. For details about Gray coding and symbol mapping, see Digital Baseband Modulation.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).
Version History
Introduced in R2012aR2018b: 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)
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)