| Communications Toolbox | ![]() |
To begin working with data from a Galois field GF(2^m), you must set the context by associating the data with crucial information about the field. The gf function performs this association and creates a Galois array in MATLAB. This function accepts as inputs
The Galois field data, x, which is a MATLAB array whose elements are integers between 0 and 2^m-1.
(Optional) An integer, m, that indicates that x is in the field GF(2^m). Valid values of m are between 1 and 16. The default is 1, which means that the field is GF(2).
(Optional) A positive integer that indicates which primitive polynomial for GF(2^m) you are using in the representations in x. If you omit this input argument, then gf uses a default primitive polynomial for GF(2^m). For information about this argument, see Specifying the Primitive Polynomial.
The output of the gf function is a variable that MATLAB recognizes as a Galois field array, rather than an array of integers. As a result, when you manipulate the variable, MATLAB works within the Galois field you have specified. For example, if you apply the log function to a Galois array, then MATLAB computes the logarithm in the Galois field and not in the field of real or complex numbers.
Some operations on Galois arrays require multiple arguments. If you specify one argument that is a Galois array and another that is an ordinary MATLAB array, then MATLAB interprets both as Galois arrays in the same field. That is, it implicitly invokes the gf function on the ordinary MATLAB array. This implicit invocation simplifies your syntax because you can omit some references to the gf function. For an example of the simplification, see Example: Addition and Subtraction.
| Representing Elements of Galois Fields | Example: Creating Galois Field Variables | ![]() |
© 1994-2005 The MathWorks, Inc.