| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Communications Toolbox |
| Contents | Index |
| Learn more about Communications Toolbox |
wt = gfweight(genmat)
wt = gfweight(genmat,'gen')
wt = gfweight(parmat,'par')
wt = gfweight(genpoly,n)
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.
wt = gfweight(genmat) returns the minimum distance of the linear block code whose generator matrix is genmat.
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 row vector that gives the coefficients of the generator polynomial in order of ascending powers.
The commands below illustrate three different ways to compute the minimum distance of a (7,4) cyclic code.
n = 7;
% Generator polynomial of (7,4) cyclic code
genpoly = cyclpoly(n,4);
[parmat, genmat] = cyclgen(n,genpoly);
wts = [gfweight(genmat,'gen'),gfweight(parmat,'par'),...
gfweight(genpoly,n)]The output is
wts =
3 3 3
hammgen, cyclpoly, bchgenpoly, Block Coding
![]() | gftuple | gray2bin | ![]() |

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |