Function File: [y, mapping] = bin2gray (x, type, M)

Creates a Gray encoded data y with the same size as input x

Input:

  • x Binary matrix data
  • type: The modulation type choices available:’qam’, ’pam’,’psk’,’dpsk’, and ’fsk’
  • M: The modualtion order must be a power of 2

Output:

  • y: The gray data of the x data.
  • mapping: This provides the gray labesfor the given modulation.

Example

y = bin2gray ([0:3], 'qam', 16)
y =

    0
    1
    3
    2

Example with matrix

y = bin2gray ([0:3; 12:15], 'qam', 16)
y =

    0    1    3    2
    8    9   11   10

See also: qammod.

Package: communications