gen2par
Convert between parity-check and generator matrices
Syntax
Description
Examples
Convert Parity-Check Matrix for a Hamming Code to Generator Matrix
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
G
— Generator matrix
k-by-n matrix of binary values
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
H
— Parity-check matrix
(n-k)-by-n matrix of
binary values
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
H
— Parity-check matrix
(n-k)-by-n matrix of
binary values
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
G
— Generator matrix
k-by-n matrix of binary values
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 and Parity-Check matrices
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 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- 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)