gen2par
Convert between parity-check and generator matrices
Syntax
Description
Examples
Convert the parity-check matrix for a Hamming code into the corresponding generator matrix and back again.
Create the parity-check matrix.
parmat = hammgen(3)
parmat = 3×7
1 0 0 1 0 1 1
0 1 0 1 1 1 0
0 0 1 0 1 1 1
Convert the parity-check matrix into the corresponding generator matrix.
genmat = gen2par(parmat)
genmat = 4×7
1 1 0 1 0 0 0
0 1 1 0 1 0 0
1 1 1 0 0 1 0
1 0 1 0 0 0 1
Convert the generator matrix back again. The output, parmat2
, should be the same as the original matrix, parmat
.
parmat2 = gen2par(genmat)
parmat2 = 3×7
1 0 0 1 0 1 1
0 1 0 1 1 1 0
0 0 1 0 1 1 1
Input Arguments
Generator matrix, specified as a k-by-n matrix of binary values. The standard form of a generator matrix for a [n,k] binary linear block code is [Ik P] or [P Ik], where Ik is the identity matrix of size k.
Data Types: single
| double
Parity-check matrix, specified as a (n-k)-by-n matrix of binary values. The standard form of a parity-check matrix for a [n,k] binary linear block code is [-P' In-k] or [In-k -P'], where In-k is the identity matrix of size (n-k).
Data Types: single
| double
Output Arguments
Parity-check matrix, returned as a
(n-k)-by-n matrix of binary
values corresponding to the generator matrix G
. The standard form
of a parity-check matrix for a [n,k] binary linear
block code is [P ' In-k] or
[In-k -P '], where
In-k is the identity matrix of size
(n-k)
Data Types: single
| double
Generator matrix, returned as a k-by-n matrix
of binary values corresponding to the parity-check matrix H
. The
standard form of a generator matrix for a [n,k]
binary linear block code is [Ik
P] or [P
Ik], where
Ik is the identity matrix of size
k.
Data Types: single
| double
More About
Generator matrices and parity-check matrices are parameters that are required in order to process [n,k] generic linear block codes. For more information, see Configure Parameters for Linear Block Codes.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)