# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# pamdemod

Pulse amplitude demodulation

## Syntax

```z = pamdemod(y,M) z = pamdemod(y,M,ini_phase) z = pamdemod(y,M,ini_phase,symbol_order) ```

## Description

`z = pamdemod(y,M)` demodulates the complex envelope `y` of a pulse amplitude modulated signal. `M` is the alphabet size. The ideal modulated signal should have a minimum Euclidean distance of 2.

`z = pamdemod(y,M,ini_phase)` specifies the initial phase of the modulated signal in radians.

`z = pamdemod(y,M,ini_phase,symbol_order)` specifies how the function assigns binary words to corresponding integers. If `symbol_order` is set to `'bin'` (default), the function uses a natural binary-coded ordering. If `symbol_order` is set to `'gray'`, it uses a Gray-coded ordering.

## Examples

collapse all

Modulate and demodulate random integers using pulse amplitude modulation. Verify that the output data matches the original data.

Set the modulation order and generate 100 M-ary data symbols.

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

Perform modulation and demodulation operations.

```modData = pammod(dataIn,M); dataOut = pamdemod(modData,M);```

Compare the first five symbols.

`[dataIn(1:5) dataOut(1:5)]`
```ans = 9 9 10 10 1 1 10 10 7 7 ```

Verify that there are no symbol errors in the entire sequence.

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