Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Convert Gray-encoded positive integers to corresponding Gray-decoded integers

`y = gray2bin(x,modulation,M)`

[y,map] = gray2bin(x,modulation,M)

`y = gray2bin(x,modulation,M)`

generates a
Gray-decoded output vector or matrix `y`

with the same dimensions as
its input parameter `x`

. `x`

can be a scalar, vector,
matrix, or 3-D array. `modulation`

is the modulation type and must be
`'qam'`

, `'pam'`

, `'fsk'`

,
`'dpsk'`

, or `'psk'`

. `M`

is the
modulation order that can be an integer power of 2.

`[y,map] = gray2bin(x,modulation,M)`

generates a
Gray-decoded output `y`

with its respective Gray-encoded constellation
map, `map`

.

You can use map output to label a Gray-encoded constellation. The map output gives the Gray encoded labels for the corresponding modulation. See the example below.

If you are converting binary coded data to Gray-coded data and modulating the
result immediately afterwards, you should use the appropriate modulation object or
function with the`'Gray'`

option, instead of BIN2GRAY.

Was this topic helpful?