# comm.PAMDemodulator System object

Package: comm

Demodulate using M-ary PAM method

## Description

The `PAMDemodulator` object demodulates a signal that was modulated using M-ary pulse amplitude modulation. The input is a baseband representation of the modulated signal.

To demodulate a signal that was modulated using M-ary pulse amplitude modulation:

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

2. Call `step` to demodulate the signal according to the properties of `comm.PAMDemodulator`. The behavior of `step` is specific to each object in the toolbox.

## Construction

`H = comm.PAMDemodulator` creates a demodulator System object™, `H`. This object demodulates the input signal using the M-ary pulse amplitude modulation (M-PAM) method.

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

## 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 `4`. When you set the `BitOutput` property to `false`, this value must be even. When you set the `BitOutput` property to `true`, this value requires an integer power of two. `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 with length equal to log2(`ModulationOrder`) times the number of demodulated symbols. When you set this property to `false`, the `step` method outputs a column vector, with length equal to the input data vector. This value 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 as one of `Binary` | `Gray`. 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\le m\le$(`ModulationOrder`–1) maps to the complex value 2m-`ModulationOrder`+1. `NormalizationMethod` Constellation normalization method Specify the method used to normalize the signal constellation as one of `Minimum distance between symbols` | ```Average power``` | `Peak power`. The default is ```Minimum distance between symbols```. `MinimumDistance` Minimum distance between symbols Specify the distance between two nearest constellation points as a positive, real, numeric scalar value. The default is `2`. This property applies when you set the `NormalizationMethod` property to `Minimum distance between symbols`. `AveragePower` Average power of constellation Specify the average power of the symbols in the constellation as a positive, real, numeric scalar value. The default is `1`. This property applies when you set the `NormalizationMethod` property to `Average power`. `PeakPower` Peak power of constellation Specify the maximum power of the symbols in the constellation as a positive, real, numeric scalar value. The default is `1`. This property applies when you set the `NormalizationMethod` property to `Peak power`. `OutputDataType` Data type of output Specify the output data type as one of `Full precision` | ```Smallest unsigned integer``` | `double` | `single` | `int8` | `uint8` | `int16` | `uint16` | `int32` | `uint32`. The default is `Full precision`. When you set this property to `Full precision`, and the input data type is single or double precision, the output data has the same data type that of the input. When the input signal is an integer data type, you must have a Fixed-Point Designer™ user license to use this property in ```Smallest unsigned integer``` or `Full precision` mode. 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 the `BitOutput` property to `true`, then `logical` data type becomes a valid option.

## Methods

 clone Create M-PAM demodulator object with same property values constellation Calculate or plot ideal signal constellation getNumInputs Number of expected inputs to step method getNumOutputs Number of outputs from step method isLocked Locked status for input attributes and nontunable properties release Allow property value and input characteristics changes step Demodulate using M-ary PAM method

## Examples

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 = step(hMod, data); noisySignal = step(hAWGN, modSignal); receivedData = step(hDemod, noisySignal); errorStats = step(hError, data, receivedData); end fprintf('Error rate = %f\nNumber of errors = %d\n', ... errorStats(1), errorStats(2))```

## Algorithms

This object implements the algorithm, inputs, and outputs described on the M-PAM Demodulator Baseband block reference page. The object properties correspond to the block parameters.