]> Creatis software - CreaPhase.git/blob - octave_packages/communications-1.1.1/egolaygen.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / communications-1.1.1 / egolaygen.m
1 ## Copyright (C) 2007 Muthiah Annamalai <muthiah.annamalai@uta.edu>
2 ##
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
6 ## version.
7 ##
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 ## details.
12 ##
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
15
16 ## -*- texinfo -*-
17 ## @deftypefn {Function File} {}  egolaygen ()
18 ## 
19 ## Returns the Extended Golay code (24,12) generator matrix,
20 ## which can correct upto 3 errors. The second argument is the partiy
21 ## check matrix, for this code.
22 ##
23 ## @end deftypefn
24 ## @seealso{egolaydec,egolayenc}
25
26 function [G,P]=egolaygen()
27   I=eye(12);
28   P=[1 0 0 0 1 1 1 0 1 1 0 1;
29      0 0 0 1 1 1 0 1 1 0 1 1;
30      0 0 1 1 1 0 1 1 0 1 0 1;
31      0 1 1 1 0 1 1 0 1 0 0 1;
32      1 1 1 0 1 1 0 1 0 0 0 1;
33      1 1 0 1 1 0 1 0 0 0 1 1;
34      1 0 1 1 0 1 0 0 0 1 1 1;
35      0 1 1 0 1 0 0 0 1 1 1 1;
36      1 1 0 1 0 0 0 1 1 1 0 1;
37      1 0 1 0 0 0 1 1 1 0 1 1;
38      0 1 0 0 0 1 1 1 0 1 1 1;
39      1 1 1 1 1 1 1 1 1 1 1 0;];
40   G=[P I]; %generator.
41 end