Communications Toolbox    

Representing Messages and Codewords

Each message or codeword is an ordered grouping of symbols. The next few subsections illustrate the various ways that these symbols may be organized or interpreted as input and output.

Binary Vector Format

One straightforward MATLAB format for messages and codewords is a vector of 0s and 1s. That is, messages and codes might look like msg and code in the lines below.

In this example, msg consists of 12 entries, which are interpreted as three four-digit (since k = 4) messages. The resulting vector code comprises three six-digit (since n = 6) codewords, which are concatenated to form a vector of length eighteen.

Binary Matrix Format

You can also organize coding information so as to emphasize the grouping of digits in a single message or codeword. The code below illustrates this by listing each four-digit message on a separate row in msg and each six-digit codeword on a separate row in code.

For all coding techniques except Reed-Solomon, the message matrix must have k columns. The corresponding code matrix has n columns.

Reed-Solomon Coding Using Binary Matrix Format.   For Reed-Solomon codes, the message matrix must have m columns, where m is an integer greater than or equal to 3 that satisfies = 2m-1.

Decimal Format

Another way to process the same information is to regard each of the three rows of msg and code above as binary representations of decimal integers. MATLAB then accepts the corresponding decimal integers as valid messages, and returns decimal integers as codewords.

The syntax for the encode command must mention the decimal format explicitly, as in the example below. Notice that /decimal is appended to the fourth argument in the encode command.

Reed-Solomon Coding Using Decimal Format.   For Reed-Solomon coding using decimal formats, the message matrix must have k columns. Each entry in the matrix must be an integer between 0 and n. The example below illustrates the decimal format for Reed-Solomon coding using the encode command.

Exponential Format (Reed-Solomon Code Only)

For Reed-Solomon coding using exponential formats, the message matrix must have k columns. Each entry of the matrix must be an integer between -1 and n-1. The example below is the exponential-form counterpart of the Reed-Solomon example from the previous section.

The name "exponential format" comes from one of MATLAB's standard formats for elements of GF(2m). This format uses integers from -1 to 2m-2, where the symbol -Inf is sometimes substituted for -1. See Exponential Format for definitions.


 Block Coding Terminology Representing Block Coding Parameters