Main Content

# pamdemod

Pulse amplitude demodulation

## Syntax

``Z = pamdemod(Y,M)``
``Z = pamdemod(Y,M,initphase)``
``Z = pamdemod(Y,M,initphase,symorder)``

## Description

example

````Z = pamdemod(Y,M)` applies pulse amplitude demodulation to the pulse amplitude modulated signal, `Y`, of order `M` and returns the demodulated input signal.```
````Z = pamdemod(Y,M,initphase)` specifies the initial phase of the modulated signal in radians.```

example

````Z = pamdemod(Y,M,initphase,symorder)` specifies the symbol mapping order for the demodulation.```

## Examples

collapse all

Demodulate a noiseless pulse amplitude modulated signal of order 8. Verify that the input data symbols match the demodulated symbols.

Generate random 8-ary data symbols.

```M = 8; dataIn = randi([0 M-1],100,1);```

Apply pulse amplitude modulation (PAM) to the generated data.

`modData = pammod(dataIn,M);`

Apply pulse amplitude demodulation to the modulated data.

`demodData = pamdemod(modData,M);`

Compare the first five symbols.

`[dataIn(1:5) demodData(1:5)]`
```ans = 5×2 6 6 7 7 1 1 7 7 5 5 ```

Determine the number of symbol errors in the demodulated data.

`symErrors = symerr(dataIn,demodData)`
```symErrors = 0 ```

Demodulate a noisy pulse amplitude modulated signal of order 8.

```M = 8; dataIn = randi([0 M-1],1000,1);```

Apply pulse amplitude modulation (PAM) to the generated data. Employ a Gray-coded symbol mapping order for the modulation.

`modData = pammod(dataIn,M,0,"gray");`

Pass the modulated data through an additive white Gaussian noise channel. Set the signal-to-noise ratio to 8 dB.

`noisyData = awgn(modData,M);`

Display the noisy PAM constellation.

`scatterplot(noisyData)`

Apply pulse amplitude demodulation to the noisy modulated data.

`demodData = pamdemod(noisyData,M,0,"gray");`

Determine the number of symbol errors in the demodulated data.

`symErrors = symerr(dataIn,demodData)`
```symErrors = 1 ```

## Input Arguments

collapse all

Pulse amplitude modulated signal, specified as a scalar, vector, or matrix. If `Y` is a matrix, the function processes the columns independently.

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

Modulation order, specified as a positive integer power of two.

Data Types: `single` | `double`

Initial phase of the modulated signal in radians, specified as a scalar.

Data Types: `single` | `double`

Symbol mapping order for the demodulation, specified as one of these options.

• `"bin"` — Use a binary-coded mapping order.

• `"gray"` — Use a Gray-coded mapping order.

The `symorder` argument specifies how the function assigns binary vectors to corresponding integers.

Data Types: `char` | `string`

## Output Arguments

collapse all

Demodulated input signal, returned as a scalar, vector, or matrix of integers in the range [0, M–1]. `Z` is of the same length as `Y`.

Data Types: `double` | `single`

## Version History

Introduced before R2006a