Main Content

gfweight

Calculate minimum distance of linear block code

Description

wt = gfweight(genmat) returns the minimum distance of the linear block code whose generator matrix is genmat.

example

wt = gfweight(genmat,'gen') returns the minimum distance of the linear block code whose generator matrix is genmat.

wt = gfweight(parmat,'par') returns the minimum distance of the linear block code whose parity-check matrix is parmat.

wt = gfweight(genpoly,n) returns the minimum distance of the cyclic code whose codeword length is n and whose generator polynomial is represented by genpoly. genpoly is a polynomial character vector or a row vector that gives the coefficients of the generator polynomial in order of ascending powers.

Examples

collapse all

Calculate the minimum distance of a cyclic code using several methods.

Create the generate polynomial for a (7,4) cyclic code.

n = 7;
genpoly = cyclpoly(n,4);

Calculate the minimum distance for the cyclic code using:

  1. Generator polynomial genmat

  2. Parity check matrix parmat

  3. Generator polynomial genpoly

  4. Generator polynomial specified as a character vector

[parmat, genmat] = cyclgen(n,genpoly);
wts = [gfweight(genmat,'gen') gfweight(parmat,'par'),...
    gfweight(genpoly,n) gfweight('1+x2+x3',n)]
wts = 1×4

     3     3     3     3

Input Arguments

collapse all

Generator matrix of a linear block code, specified as a numeric matrix.

Data Types: double

Parity-check matrix of a linear block code, specified as a numeric matrix.

Data Types: double

Coefficients of generator polynomial, specified as a character vector or a numeric row vector in ascending order.

Data Types: char | double

Code word length, specified as a positive integer.

Data Types: double

Output Arguments

collapse all

Minimum distance of specified code, specified as a positive integer.

The minimum distance, or minimum weight, of a linear block code is defined as the smallest positive number of nonzero entries in any n-tuple that is a codeword.

Data Types: double

Version History

Introduced before R2006a