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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)