Function File: h = hammgen (m)
Function File: h = hammgen (m, p)
Function File: [h, g] = hammgen (…)
Function File: [h, g, n, k] = hammgen (…)

Produce the parity check and generator matrices of a Hamming code. The variable m defines the [n,k] Hamming code where n = 2 ^ m - 1 and k = n - m. m must be between 3 and 16.

The parity check matrix is generated relative to the primitive polynomial of GF(2^m). If p is specified the default primitive polynomial of GF(2^m) is overridden. p must be a valid primitive polynomial of the correct order for GF(2^m).

The parity check matrix is returned in the m by n matrix h, and if requested the generator matrix is returned in the k by n matrix g.

See also: gen2par.

Package: communications