Documentation

This is machine translation

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

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.

gf

Create Galois field array

Syntax

x_gf = gf(x,m)
x_gf = gf(x,m,prim_poly)
x_gf = gf(x)

Description

x_gf = gf(x,m) creates a Galois field array from the matrix x. The Galois field has 2^m elements, where m is an integer between 1 and 16. The elements of x must be integers between 0 and 2^m-1. The output x_gf is a variable that MATLAB recognizes as a Galois field array, rather than an array of integers. As a result, when you manipulate x_gf using operators or functions such as + or det, MATLAB works within the Galois field you have specified.

x_gf = gf(x,m,prim_poly) is the same as the previous syntax, except it uses the primitive polynomial prim_poly to define the field. prim_poly is a polynomial character vector or the integer representation of a primitive polynomial. For example, the number 37 represents the polynomial D^5+D^2+1 because the binary form of 37 is 1 0 0 1 0 1. For more information about the primitive polynomial, see Specifying the Primitive Polynomial.

x_gf = gf(x) creates a GF(2) array from the matrix x. Each element of x must be 0 or 1.

Default Primitive Polynomials

The table below lists the primitive polynomial that gf uses by default for each Galois field GF(2^m). To use a different primitive polynomial, specify prim_poly as an input argument when you invoke gf.

mDefault Primitive PolynomialInteger Representation
1 D + 1 3
2 D^2 + D + 1 7
3 D^3 + D + 1 11
4 D^4 + D + 1 19
5 D^5 + D^2 + 1 37
6 D^6 + D + 1 67
7 D^7 + D^3 + 1 137
8 D^8 + D^4 + D^3 + D^2 + 1 285
9 D^9 + D^4 + 1 529
10 D^10 + D^3 + 1 1033
11 D^11 + D^2 + 1 2053
12 D^12 + D^6 + D^4 + D + 1 4179
13 D^13 + D^4 + D^3 + D + 1 8219
14 D^14 + D^10 + D^6 + D + 1 17475
15 D^15 + D + 1 32771
16 D^16 + D^12 + D^3 + D + 1 69643

Examples

collapse all

Set the order of the Galois field to 16, where the order equals $2^m$. The elements of x must range from 0 to $2^m-1$.

m = 4;
x = [3 2 9];
y = gf(x,m)
 
y = GF(2^4) array. Primitive polynomial = D^4+D+1 (19 decimal)
 
Array elements = 
 
   3   2   9

Create a sequence of integers. Create a Galois field array, where m = 5.

x = [17 8 11 27];
y = gf(x,5)
 
y = GF(2^5) array. Primitive polynomial = D^5+D^2+1 (37 decimal)
 
Array elements = 
 
   17    8   11   27

Determine all possible primitive polynomials for GF(2^5).

pp = primpoly(5,'all')
 
Primitive polynomial(s) = 
 
D^5+D^2+1
D^5+D^3+1
D^5+D^3+D^2+D^1+1
D^5+D^4+D^2+D^1+1
D^5+D^4+D^3+D^1+1
D^5+D^4+D^3+D^2+1

pp =

    37
    41
    47
    55
    59
    61

Generate a GF array using the primitive polynomial that has a decimal equivalent of 59.

z = gf(x,5,'D5+D4+D3+D+1')
 
z = GF(2^5) array. Primitive polynomial = D^5+D^4+D^3+D+1 (59 decimal)
 
Array elements = 
 
   17    8   11   27

See Also

Introduced before R2006a

Was this topic helpful?