1This is comms.info, produced by makeinfo version 6.7 from comms.texi.
2
3
4File: comms.info,  Node: Top,  Next: Introduction,  Up: (dir)
5
6Communications Package for Octave
7*********************************
8
9* Menu:
10
11* Introduction::
12* Random Signals::
13* Source Coding::
14* Block Coding::
15* Convolutional Coding::
16* Modulations::
17* Special Filters::
18* Galois Fields::
19* Function Reference::
20
21
22File: comms.info,  Node: Introduction,  Next: Random Signals,  Prev: Top,  Up: Top
23
241 Introduction
25**************
26
27This is the manual for the Communications Package for GNU Octave.  All
28functions provided by this package are described in this manual.  In
29addition many functions from Octave and other Octave packages are useful
30to or required by this package, and so they may also be explained or
31shown in examples in this manual.
32
33   This documentation is a work in progress, you are invited to help
34improve it and submit patches.
35
36
37File: comms.info,  Node: Random Signals,  Next: Source Coding,  Prev: Introduction,  Up: Top
38
392 Random Signals
40****************
41
42The purpose of the functions described here is to create and add random
43noise to a signal, to create random data and to analyze the eventually
44errors in a received signal.  The functions to perform these tasks can
45be considered as either related to the creation or analysis of signals
46and are treated separately below.
47
48   It should be noted that the examples below are based on the output of
49a random number generator, and so the user can not expect to exactly
50recreate the examples below.
51
52* Menu:
53
54* Signal Creation::
55* Signal Analysis::
56
57
58File: comms.info,  Node: Signal Creation,  Next: Signal Analysis,  Up: Random Signals
59
602.1 Signal Creation
61===================
62
63The signal creation functions here fall into to two classes.  Those that
64treat discrete data and those that treat continuous data.  The basic
65function to create discrete data is 'randint', that creates a random
66matrix of equi-probable integers in a desired range.  For example
67
68     octave:1> a = randint (3, 3, [-1, 1])
69     a =
70
71        0   1   0
72       -1  -1   1
73        0   1   1
74
75creates a 3-by-3 matrix of random integers in the range -1 to 1.  To
76allow for repeated analysis with the same random data, the function
77'randint' allows the seed-value of the random number generator to be
78set.  For instance
79
80     octave:1> a = randint (3, 3, [-1, 1], 1)
81     a =
82
83        0   1   1
84        0  -1   0
85        1  -1  -1
86
87will always produce the same set of random data.  The range of the
88integers to produce can either be a two element vector or an integer.
89In the case of a two element vector all elements within the defined
90range can be produced.  In the case of an integer range M, 'randint'
91returns the equi-probable integers in the range [0:2^M-1].
92
93   The function 'randsrc' differs from 'randint' in that it allows a
94random set of symbols to be created with a given probability.  The
95symbols can be real, complex or even characters.  However characters and
96scalars can not be mixed.  For example
97
98     octave:1> a = randsrc (2, 2, "ab");
99     octave:2> b = randsrc (4, 4, [1, 1i, -1, -1i]);
100
101are both legal, while
102
103     octave:1> a = randsrc (2, 2, [1, "a"]);
104
105is not legal.  The alphabet from which the symbols are chosen can be
106either a row vector or two row matrix.  In the case of a row vector, all
107of the elements of the alphabet are chosen with an equal probability.
108In the case of a two row matrix, the values in the second row define the
109probability that each of the symbols are chosen.  For example
110
111     octave:1> a = randsrc (5, 5, [1, 1i, -1, -1i; 0.6 0.2 0.1 0.1])
112     a =
113
114        1 + 0i   0 + 1i   0 + 1i   0 + 1i   1 + 0i
115        1 + 0i   1 + 0i   0 + 1i   0 + 1i   1 + 0i
116       -0 - 1i   1 + 0i  -1 + 0i   1 + 0i   0 + 1i
117        1 + 0i   1 + 0i   1 + 0i   1 + 0i   1 + 0i
118       -1 + 0i  -1 + 0i   1 + 0i   1 + 0i   1 + 0i
119
120defines that the symbol '1' has a 60% probability, the symbol '1i' has a
12120% probability and the remaining symbols have 10% probability each.
122The sum of the probabilities must equal one.  Like 'randint', 'randsrc'
123accepts a fourth argument as the seed of the random number generator
124allowing the same random set of data to be reproduced.
125
126   The function 'randerr' allows a matrix of random bit errors to be
127created, for binary encoded messages.  By default, 'randerr' creates
128exactly one errors per row, flagged by a non-zero value in the returned
129matrix.  That is
130
131     octave:1> a = randerr (5, 10)
132     a =
133
134        0   1   0   0   0   0   0   0   0   0
135        0   0   1   0   0   0   0   0   0   0
136        0   0   1   0   0   0   0   0   0   0
137        0   0   0   0   0   0   0   0   0   1
138        0   0   0   0   0   0   0   0   0   1
139
140   The number of errors per row can be specified as the third argument
141to 'randerr'.  This argument can be either a scalar, a row vector or a
142two row matrix.  In the case of a scalar value, exactly this number of
143errors will be created per row in the returned matrix.  In the case of a
144row vector, each element of the row vector gives a possible number of
145equi-probable bit errors.  The second row of a two row matrix defines
146the probability of each number of errors occurring.  For example
147
148     octave:1> n = 15; k = 11; nsym = 100;
149     octave:2> msg = randint (nsym, k);       ## Binary vector of message
150     octave:3> code = encode (msg, n, k, "bch");
151     octave:4> berrs = randerr (nsym, n, [0, 1; 0.7, 0.3]);
152     octave:5> noisy = mod (code + berrs, 2)  ## Add errors to coded message
153
154creates a vector MSG, encodes it with a [15,11] BCH code, and then add
155either none or one error per symbol with the chances of an error being
15630%.  As previously, 'randerr' accepts a fourth argument as the seed of
157the random number generator allowing the same random set of data to be
158reproduced.
159
160   All of the above functions work on discrete random signals.  The
161functions 'wgn' and 'awgn' create and add white Gaussian noise to
162continuous signals.  The function 'wgn' creates a matrix of white
163Gaussian noise of a certain power.  A typical call to 'wgn' is then
164
165     octave:1> nse = wgn (10, 10, 0);
166
167which creates a 10-by-10 matrix of noise with a root mean squared power
168of 0dBW relative to an impedance of 1 Ohm.
169
170   This effectively means that an equivalent result to the above can be
171obtained with
172
173     octave:1> nse = randn (10, 10);
174
175   The reference impedance and units of power to the function 'wgn' can
176however be modified, for example
177
178     octave:1> nse_30dBm_50Ohm = wgn (10000, 1, 30, 50, "dBm");
179     octave:2> nse_0dBW_50Ohm = wgn (10000, 1, 0, 50, "dBW");
180     octave:3> nse_1W_50Ohm = wgn (10000, 1, 1, 50, "linear");
181     octave:4> [std(nse_30dBm_50Ohm), std(nse_0dBW_50Ohm), std(nse_1W_50Ohm)]
182     ans =
183
184        7.0805   7.1061   7.0730
185
186   Each of these produces a 1W signal referenced to a 50 Ohm impedance.
187MATLAB uses the misnomer "dB" for "dBW", so "dB" is an accepted type for
188'wgn' and is treated as a synonym for "dBW".
189
190   In all cases, the returned matrix V, will be related to the input
191power P and the impedance Z as
192
193   P = sum (V(:) .^ 2 ) / IMP Watts
194
195   By default 'wgn' produces real vectors of white noise.  However, it
196can produce both real and complex vectors like
197
198     octave:1> rnse = wgn (10000, 1, 0, "dBm", "real");
199     octave:2> cnse = wgn (10000, 1, 0, "dBm", "complex");
200     octave:3> [std(rnse), std(real (cnse)), std(imag (cnse)), std(cnse)]
201     ans =
202
203        0.031615   0.022042   0.022241   0.031313
204
205which shows that with a complex return value that the total power is the
206same as a real vector, but that it is equally shared between the real
207and imaginary parts.  As previously, 'wgn' accepts a fourth numerical
208argument as the seed of the random number generator allowing the same
209random set of data to be reproduced.  That is
210
211     octave:1> nse = wgn (10, 10, 0, 0);
212
213will always produce the same set of data.
214
215   The final function to deal with the creation of random signals is
216'awgn', that adds noise at a certain level relative to a desired signal.
217This function adds noise at a certain level to a desired signal.  An
218example call to 'awgn' is
219
220     octave:1> x = [0:0.1:2*pi];
221     octave:2> y = sin (x);
222     octave:3> noisy = awgn (y, 10, "measured")
223
224which adds noise with a 10dB signal-to-noise ratio to the measured power
225in the desired signal.  By default 'awgn' assumes that the desired
226signal is at 0dBW, and the noise is added relative to this assumed
227power.  This behavior can be modified by the third argument to 'awgn'.
228If the third argument is a numerical value, it is assumed to define the
229power in the input signal, otherwise if the third argument is the string
230"measured", as above, the power in the signal is measured prior to the
231addition of the noise.
232
233   The final argument to 'awgn' defines the definition of the power and
234signal-to-noise ratio in a similar manner to 'wgn'.  This final argument
235can be either "dB" or "linear".  In the first case the numerical value
236of the input power is assumed to be in dBW and the signal-to-noise ratio
237in dB. In the second case, the power is assumed to be in Watts and the
238signal-to-noise ratio is expressed as a ratio.
239
240   The return value of 'awgn' will be in the same form as the input
241signal.  In addition if the input signal is real, the additive noise
242will be real.  Otherwise the additive noise will also be complex and the
243noise will be equally split between the real and imaginary parts.
244
245   As previously the seed to the random number generator can be
246specified as the last argument to 'awgn' to allow repetition of the same
247scenario.  That is
248
249     octave:1> x = [0:0.1:2*pi];
250     octave:2> y = sin (x);
251     octave:3> noisy = awgn (y, 10, "dB", 0, "measured")
252
253which uses the seed-value of 0 for the random number generator.
254
255
256File: comms.info,  Node: Signal Analysis,  Prev: Signal Creation,  Up: Random Signals
257
2582.2 Signal Analysis
259===================
260
261It is important to be able to evaluate the performance of a
262communications system in terms of its bit-error and symbol-error rates.
263Two functions 'biterr' and 'symerr' exist within this package to
264calculate these values, both taking as arguments the expected and the
265actually received data.  The data takes the form of matrices or vectors,
266with each element representing a single symbol.  They are compared in
267the following manner
268
269Both matrices
270     In this case both matrices must be the same size and then by
271     default the return values are the overall number of errors and the
272     overall error rate.
273One column vector
274     In this case the column vector is used for comparison column-wise
275     with the matrix.  The return values are row vectors containing the
276     number of errors and the error rate for each column-wise
277     comparison.  The number of rows in the matrix must be the same as
278     the length of the column vector.
279One row vector
280     In this case the row vector is used for comparison row-wise with
281     the matrix.  The return values are column vectors containing the
282     number of errors and the error rate for each row-wise comparison.
283     The number of columns in the matrix must be the same as the length
284     of the row vector.
285
286   For the bit-error comparison, the size of the symbol is assumed to be
287the minimum number of bits needed to represent the largest element in
288the two matrices supplied.  However, the number of bits per symbol can
289(and in the case of random data should) be specified.  As an example of
290the use of 'biterr' and 'symerr', consider the example
291
292     octave:1> m = 8;
293     octave:2> msg = randint (10, 10, 2^m);
294     octave:3> noisy = mod (msg + diag (1:10), 2^m);
295     octave:4> [berr, brate] = biterr (msg, noisy, m)
296     berr = 32
297     brate = 0.040000
298     octave:5> [serr, srate] = symerr (msg, noisy)
299     serr = 10
300     srate = 0.10000
301
302which creates a 10-by-10 matrix adds 10 symbols errors to the data and
303then finds the bit and symbol error-rates.
304
305   Two other means of displaying the integrity of a signal are the
306eye-diagram and the scatterplot.  Although the functions 'eyediagram'
307and 'scatterplot' have different appearance, the information presented
308is similar and so are their inputs.  The difference between 'eyediagram'
309and 'scatterplot' is that 'eyediagram' segments the data into time
310intervals and plots the in-phase and quadrature components of the signal
311against this time interval.  While 'scatterplot' uses a parametric plot
312of quadrature versus in-phase components.
313
314   Both functions can accept real or complex signals in the following
315forms.
316
317A real vector
318     In this case the signal is assumed to be real and represented by
319     the vector X.
320A complex vector
321     In this case the in-phase and quadrature components of the signal
322     are assumed to be the real and imaginary parts of the signal.
323A matrix with two columns
324     In this case the first column represents the in-phase and the
325     second the quadrature components of a complex signal.
326
327   An example of the use of the function 'eyediagram' is
328
329     octave:1> n = 50;
330     octave:2> ovsp = 50;
331     octave:3> x = 1:n;
332     octave:4> xi = 1:1/ovsp:n-0.1;
333     octave:5> y = randsrc (1, n, [1 + 1i, 1 - 1i, -1 - 1i, -1 + 1i]);
334     octave:6> yi = interp1 (x, y, xi);
335     octave:7> noisy = awgn (yi, 15, "measured");
336     octave:8> eyediagram (noisy, ovsp);
337
338   Similarly an example of the use of the function 'scatterplot' is
339
340     octave:1> n = 200;
341     octave:2> ovsp = 5;
342     octave:3> x = 1:n;
343     octave:4> xi = 1:1/ovsp:n-0.1;
344     octave:5> y = randsrc (1, n, [1 + 1i, 1 - 1i, -1 - 1i, -1 + 1i]);
345     octave:6> yi = interp1 (x, y, xi);
346     octave:7> noisy = awgn (yi, 15, "measured");
347     octave:8> f = scatterplot (noisy, 1, 0, "b");
348     octave:9> hold on;
349     octave:10> scatterplot (noisy, ovsp, 0, "r+", f);
350
351
352File: comms.info,  Node: Source Coding,  Next: Block Coding,  Prev: Random Signals,  Up: Top
353
3543 Source Coding
355***************
356
357* Menu:
358
359* Quantization::
360* PCM Coding::
361* Arithmetic Coding::
362* Dynamic Range Compression::
363
364
365File: comms.info,  Node: Quantization,  Next: PCM Coding,  Up: Source Coding
366
3673.1 Quantization
368================
369
370An important aspect of converting an analog signal to the digital domain
371is quantization.  This is the process of mapping a continuous signal to
372a set of defined values.  Octave contains two functions to perform
373quantization, 'lloyds' creates an optimal mapping of the continuous
374signal to a fixed number of levels and 'quantiz' performs the actual
375quantization.
376
377   The set of quantization points to use is represented by a
378partitioning table (TABLE) of the data and the signal levels (CODES to
379which they are mapped.  The partitioning TABLE is monotonically
380increasing and if x falls within the range given by two points of this
381table then it is mapped to the corresponding code as seen in Table 1.
382
383          Table 1: Table quantization partitioning and coding
384
385        x < table(1)                  codes(1)
386        table(1) <= x < table(2)      codes(2)
387        ...                           ...
388        table(i-1) <= x < table(i)    codes(i)
389        ...                           ...
390        table(n-1) <= x < table(n)    codes(n)
391        table(n-1) <= x               codes(n+1)
392
393   These partition and coding tables can either be created by the user
394of using the function 'lloyds'.  For instance the use of a linear
395mapping can be seen in the following example.
396
397     octave:1> m = 8;
398     octave:2> n = 1024;
399     octave:3> table = 2*[0:m-1]/m - 1 + 1/m;
400     octave:4> codes = 2*[0:m]/m - 1;
401     octave:5> x = 4*pi*[0:(n-1)]/(n-1);
402     octave:6> y = cos (x);
403     octave:7> [i, z] = quantiz (y, table, codes);
404
405   If a training signal is known that well represents the expected
406signals, the quantization levels can be optimized using the 'lloyds'
407function.  For example the above example can be continued
408
409     octave:8> [table2, codes2] = lloyds (y, table, codes);
410     octave:9> [i, z2] = quantiz (y, table2, codes2);
411
412to use the mapping suggested by the function 'lloyds'.  It should be
413noted that the mapping given by 'lloyds' is highly dependent on the
414training signal used.  So if this signal does not represent a realistic
415signal to be quantized, then the partitioning suggested by 'lloyds' will
416be sub-optimal.
417
418
419File: comms.info,  Node: PCM Coding,  Next: Arithmetic Coding,  Prev: Quantization,  Up: Source Coding
420
4213.2 PCM Coding
422==============
423
424The DPCM function 'dpcmenco', 'dpcmdeco' and 'dpcmopt' implement a form
425of predictive quantization, where the predictability of the signal is
426used to further compress it.  These functions are not yet implemented.
427
428
429File: comms.info,  Node: Arithmetic Coding,  Next: Dynamic Range Compression,  Prev: PCM Coding,  Up: Source Coding
430
4313.3 Arithmetic Coding
432=====================
433
434The arithmetic coding functions 'arithenco' and 'arithdeco' are not yet
435implemented.
436
437
438File: comms.info,  Node: Dynamic Range Compression,  Prev: Arithmetic Coding,  Up: Source Coding
439
4403.4 Dynamic Range Compression
441=============================
442
443The final source coding function is 'compand' which is used to compress
444and expand the dynamic range of a signal.  For instance consider a
445logarithm quantized by a linear partitioning.  Such a partitioning is
446very poor for this large dynamic range.  'compand' can then be used to
447compress the signal prior to quantization, with the signal being
448expanded afterwards.  For example
449
450     octave:1> mu = 1.95;
451     octave:2> x = [0.01:0.01:2];
452     octave:3> y = log (x);
453     octave:4> V = max (abs (y));
454     octave:5> [i, z, d] = quantiz (y, [-4.875:0.25:0.875], [-5:0.25:1]);
455     octave:6> c = compand (y, minmu, V, "mu/compressor");
456     octave:7> [i2, c2] = quantiz (c, [-4.875:0.25:0.875], [-5:0.25:1]);
457     octave:8> z2 = compand (c2, minmu, max (abs (c2)), "mu/expander");
458     octave:9> d2 = sumsq (y - z2) / length (y);
459     octave:10> [d, d2]
460     ans =
461
462        0.0053885   0.0029935
463
464which demonstrates that the use of 'compand' can significantly reduce
465the distortion due to the quantization of signals with a large dynamic
466range.
467
468
469File: comms.info,  Node: Block Coding,  Next: Convolutional Coding,  Prev: Source Coding,  Up: Top
470
4714 Block Coding
472**************
473
474The error-correcting codes available in this package are discussed here.
475These codes work with blocks of data, with no relation between one block
476and the next.  These codes create codewords based on the messages to
477transmit that contain redundant information that allow the recovery of
478the original message in the presence of errors.
479
480* Menu:
481
482* Data Formats::
483* Binary Block Codes::
484* BCH Codes::
485* Reed-Solomon Codes::
486
487
488File: comms.info,  Node: Data Formats,  Next: Binary Block Codes,  Up: Block Coding
489
4904.1 Data Formats
491================
492
493All of the codes described in this section are binary and share similar
494data formats.  The exception is the Reed-Solomon coder which has a
495significantly longer codeword length in general and therefore uses a
496different representation to efficiently pass data.  The user should
497refer to the section about the Reed-Solomon codes for the data format
498used for Reed-Solomon codes.
499
500   In general K bits of data are considered to represent a single
501message symbol.  These K bits are coded into N bits of data representing
502the codeword.  The data can therefore be grouped in one of three
503manners, to emphasis this grouping into bits, messages and codewords
504
505A binary vector
506     Each element of the vector is either one or zero.  If the data
507     represents an uncoded message the vector length should be an
508     integer number of K in length.
509A binary matrix
510     In this case the data is ones and zeros grouped into rows, with
511     each representing a single message or codeword.  The number of
512     columns in the matrix should be equal to K in the case of a uncoded
513     message or N in the case of a coded message.
514A non-binary vector
515     In this case each element of the vector represents a message or
516     codeword in an integer format.  The bits of the message or codeword
517     are represented by the bits of the vector elements with the
518     least-significant bit representing the first element in the message
519     or codeword.
520
521   An example demonstrating the relationship between the three data
522formats can be seen below.
523
524     octave:1> k = 4;
525     octave:2> bin_vec = randint (k*10, 1);         # Binary vector format
526     octave:3> bin_mat = reshape (bin_vec, k, 10)'; # Binary matrix format
527     octave:4> dec_vec = bi2de (bin_mat);           # Decimal vector format
528
529   The functions within this package will return data in the same format
530to which it is given.  It should be noted that internally the binary
531matrix format is used, and thus if the message or codeword length is
532large it is preferable to use the binary format to avoid internal
533rounding errors.
534
535
536File: comms.info,  Node: Binary Block Codes,  Next: BCH Codes,  Prev: Data Formats,  Up: Block Coding
537
5384.2 Binary Block Codes
539======================
540
541All of the codes presented here can be characterized by their
542
543Generator Matrix
544     A K-by-N matrix G to generate the codewords C from the messages T
545     by the matrix multiplication C = T * G.
546Parity Check Matrix
547     A 'N-K'-by-N matrix H to check the parity of the received symbols.
548     If H * R = S != 0, then an error has been detected.  S can be used
549     with the syndrome table to correct this error
550Syndrome Table
551     A 2^K-by-N matrix ST with the relationship of the error vectors to
552     the non-zero parities of the received symbols.  That is, if the
553     received symbol is represented as R = mod (T + E, 2), then the
554     error vector E is ST(S).
555
556   It is assumed for most of the functions in this package that the
557generator matrix will be in a 'standard' form.  That is the generator
558matrix can be represented by
559
560      g(1,1)  g(1,2)  ...  g(1,k)  1  0  ...  0
561      g(2,1)  g(2,2)       g(2,k)  0  1  ...  0
562        .                    .     .          .
563        .                    .     .          .
564        .                    .     .          .
565      g(k,1)  g(k,2)  ...  g(k,k)  0  0  ...  1
566
567or
568
569       1  0  ...  0  g(1,1)  g(1,2)  ...  g(1,k)
570       0  1  ...  0  g(2,1)  g(2,2)       g(2,k)
571       .          .     .                   .
572       .          .     .                   .
573       .          .     .                   .
574       0  0  ...  1  g(k,1)  g(k,2)  ...  g(k,k)
575
576and similarly the parity check matrix can be represented by a
577combination of an identity matrix and a square matrix.
578
579   Some of the codes can also have their representation in terms of a
580generator polynomial that can be used to create the generator and parity
581check matrices.  In the case of BCH codes, this generator polynomial is
582used directly in the encoding and decoding without ever explicitly
583forming the generator or parity check matrix.
584
585   The user can create their own generator and parity check matrices, or
586they can rely on the functions 'hammgen', 'cyclgen' and 'cyclpoly'.  The
587function 'hammgen' creates parity check and generator matrices for
588Hamming codes, while 'cyclpoly' and 'cyclgen' create generator
589polynomials and matrices for generic cyclic codes.  An example of their
590use is
591
592     octave:1> m = 3;
593     octave:2> n = 2^m - 1;
594     octave:2> k = 4;
595     octave:3> [par, gen] = hammgen (m);
596     octave:4> [par2, gen2] = cyclgen (n, cyclpoly (n, k));
597
598which create identical parity check and generator matrices for the [7,4]
599Hamming code.
600
601   The syndrome table of the codes can be created with the function
602'syndtable', in the following manner
603
604     octave:1> [par, gen] = hammgen (3);
605     octave:2> st = syndtable (par);
606
607   There exists two auxiliary functions 'gen2par' and 'gfweight', that
608convert between generator and parity check matrices and calculate the
609Hamming distance of the codes.  For instance
610
611     octave:1> par = hammgen (3);
612     octave:2> gen = gen2par (par);
613     octave:3> gfweight (gen)
614     ans = 3
615
616   It should be noted that for large values of N, the generator, parity
617check and syndrome table matrices are very large.  There is therefore an
618internal limitation on the size of the block codes that can be created
619that limits the codeword length N to less than 64.  This is still
620excessively large for the syndrome table, so use caution with these
621codes.  These limitations do not apply to the Reed-Solomon or BCH codes.
622
623   The top-level encode and decode functions are 'encode' and 'decode',
624which can be used with all codes, except the Reed-Solomon code.  The
625basic call to both of these functions passes the message to code/decode,
626the codeword length, the message length and the type of coding to use.
627There are four basic types that are available with these functions
628
629"linear"
630     Generic linear block codes
631"cyclic"
632     Cyclic linear block codes
633"hamming"
634     Hamming codes
635"bch"
636     Bose Chaudhuri Hocquenghem (BCH) block codes
637
638   It is not possible to distinguish between a binary vector and a
639decimal vector coding of the messages that just happens to only have
640ones and zeros.  Therefore the functions 'encode' and 'decode' must be
641told the format of the messages in the following manner.
642
643     octave:1> m = 3;
644     octave:2> n = 7;
645     octave:3> k = 4;
646     octave:4> msg_bin = randint (10, k);
647     octave:5> cbin = encode (msg_bin, n, k, "hamming/binary");
648     octave:5> cdec = encode (bi2de (msg), n, k, "hamming/decimal");
649
650which codes a binary matrix and a non-binary vector representation of a
651message, returning the coded message in the same format.  The functions
652'encode' and 'decode' by default accept binary coded messages.
653Therefore "hamming" is equivalent to "hamming/binary".
654
655   Except for the BCH codes, the function 'encode' and 'decode'
656internally create the generator, parity check and syndrome table
657matrices.  Therefore if repeated calls to 'encode' and 'decode' are
658made, it will often be faster to create these matrices externally and
659pass them as an argument.  For example
660
661     n = 15;
662     k = 11;
663     [par, gen] = hammgen (4);
664     code1 = code2 = zeros (100, 15)
665     for i = 1:100
666       msg = get_msg (i);
667       code1(i,:) = encode (msg, n, k, "linear", gen);  # This is faster
668       code2(i,:) = encode (msg, n, k, "hamming");      # than this !!!
669     endfor
670
671   In the case of the BCH codes the low-level functions described in the
672next section are used directly by the 'encode' and 'decode' functions.
673
674
675File: comms.info,  Node: BCH Codes,  Next: Reed-Solomon Codes,  Prev: Binary Block Codes,  Up: Block Coding
676
6774.3 BCH Codes
678=============
679
680The BCH coder used here is based on code written by Robert
681Morelos-Zaragoza (r.morelos-zaragoza@ieee.org).  This code was
682originally written in C and has been converted for use as an Octave
683oct-file.
684
685   Called without arguments, 'bchpoly' returns a table of valid BCH
686error correcting codes and their error-correction capability.  The first
687returned column of 'bchpoly' is the codeword length, the second the
688message length and the third the error correction capability of the
689code.  Called with one argument, 'bchpoly' returns similar output, but
690only for the specified codeword length.  In this manner codes with
691codeword length greater than 511 can be found.
692
693   In general the codeword length is of the form '2^M - 1', where M is
694an integer.  However if [N,K] is a valid BCH code, then it is also
695possible to use a shortened BCH form of the form '[N-X,K-X]'.
696
697   With two or more arguments, 'bchpoly' is used to find the generator
698polynomial of a valid BCH code.  For instance
699
700     octave:1> bchpoly (15, 7)
701     ans =
702
703        1   0   0   0   1   0   1   1   1
704
705     octave:2> bchpoly (14, 6)
706     ans =
707
708        1   0   0   0   1   0   1   1   1
709
710show that the generator polynomial of a [15,7] BCH code with the default
711primitive polynomial is
712
713   1 + X ^ 4 + X ^ 6 + X ^ 7 + X ^ 8
714
715   Using a different primitive polynomial to define the Galois Field
716over which the BCH code is defined results in a different generator
717polynomial as can be seen in the example.
718
719     octave:1> bchpoly ([1 1 0 0 1], 7)
720     ans =
721
722        1   0   0   0   1   0   1   1   1
723
724     octave:2> bchpoly ([1 0 0 1 1], 7)
725     ans =
726
727        1   1   1   0   1   0   0   0   1
728
729   It is recommend not to convert the generator polynomials created by
730'bchpoly' into generator and parity check matrices with the BCH codes,
731as the underlying BCH software is faster than the generic coding
732software and can treat significantly longer codes.
733
734   As well as using the 'encode' and 'decode' functions previously
735discussed, the user can directly use the low-level BCH functions
736'bchenco' and 'bchdeco'.  In this case the messages must be in the
737format of a binary matrix with K columns
738
739     octave:1> n = 31;
740     octave:2> pgs = bchpoly (n);
741     octave:3> pg = pgs(floor (rand () * (rows (pgs) + 1)),:);  # Pick a poly
742     octave:4> k = pg(2);
743     octave:5> t = pg(3);
744     octave:6> msg = randint (10, k);
745     octave:7> code = bchenco (msg, n, k);
746     octave:8> noisy = code + [ones(10, 1), zeros(10, n-1)];
747     octave:9> dec = bchdeco (code, k, t);
748
749
750File: comms.info,  Node: Reed-Solomon Codes,  Prev: BCH Codes,  Up: Block Coding
751
7524.4 Reed-Solomon Codes
753======================
754
755* Menu:
756
757* Representation of Reed-Solomon Messages::
758* Creating and Decoding Messages::
759* Shortened Reed-Solomon Codes::
760
761
762File: comms.info,  Node: Representation of Reed-Solomon Messages,  Next: Creating and Decoding Messages,  Up: Reed-Solomon Codes
763
7644.4.1 Representation of Reed-Solomon Messages
765---------------------------------------------
766
767The Reed-Solomon coder used in this package is based on code written by
768Phil Karn (http://www.ka9q.net/code/fec).  This code was originally
769written in C and has been converted for use as an Octave oct-file.
770
771   Reed-Solomon codes are based on Galois Fields of even characteristics
772GF(2^M). Many of the properties of Galois Fields are therefore important
773when considering Reed-Solomon coders.
774
775   The representation of the symbols of the Reed-Solomon code differs
776from the other block codes, in that the other block codes use a binary
777representation, while the Reed-Solomon code represents each m-bit symbol
778by an integer.  The elements of the message and codeword must be
779elements of the Galois Field corresponding to the Reed-Solomon code.
780Thus to code a message with a [7,5] Reed-Solomon code an example is
781
782     octave:1> m = 3;
783     octave:2> n = 7;
784     octave:3> k = 5;
785     octave:4> msg = gf (floor (2^m * rand (2, k)), m)
786     msg =
787     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
788
789     Array elements =
790
791        5   0   6   3   2
792        4   1   3   1   2
793
794     octave:5> code = rsenc (msg, n, k)
795     code =
796     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
797
798     Array elements =
799
800        5   0   6   3   2   3   5
801        4   1   3   1   2   6   3
802
803   The variable N is the codeword length of the Reed-Solomon coder,
804while K is the message length.  It should be noted that K should be less
805than N and that 'N - K' should be even.  The error correcting capability
806of the Reed-Solomon code is then '(N - K)/2' symbols.  M is the number
807of bits per symbol, and is related to N by 'N = 2^M - 1'.  For a valid
808Reed-Solomon coder, M should be between 3 and 16.
809
810
811File: comms.info,  Node: Creating and Decoding Messages,  Next: Shortened Reed-Solomon Codes,  Prev: Representation of Reed-Solomon Messages,  Up: Reed-Solomon Codes
812
8134.4.2 Creating and Decoding Messages
814------------------------------------
815
816The Reed-Solomon encoding function requires at least three arguments.
817The first MSG is the message in encodes, the second is N the codeword
818length and K is the message length.  Therefore MSG must have K columns
819and the output will have N columns of symbols.
820
821   The message itself is many up of elements of a Galois Field GF(2^M).
822Normally, The order of the Galois Field (M), is related to the codeword
823length by 'N = 2^M - 1'.  Another important parameter when determining
824the behavior of the Reed-Solomon coder is the primitive polynomial of
825the Galois Field (see 'gf').  Thus the messages
826
827     octave:1> msg0 = gf ([0, 1, 2, 3], 3);
828     octave:2> msg1 = gf ([0, 1, 2, 3], 3, 13);
829
830will not result in the same Reed-Solomon coding.  Finally, the parity of
831the Reed-Solomon code are generated with the use of a generator
832polynomial.  The parity symbols are then generated by treating the
833message to encode as a polynomial and finding the remainder of the
834division of this polynomial by the generator polynomial.  Therefore the
835generator polynomial must have as many roots as 'N - K'.  Whether the
836parity symbols are placed before or afterwards the message will then
837determine which end of the message is the most-significant term of the
838polynomial representing the message.  The parity symbols are therefore
839different in these two cases.  The position of the parity symbols can be
840chosen by specifying "beginning" or "end" to 'rsenc' and 'rsdec'.  By
841default the parity symbols are placed after the message.
842
843   Valid generator polynomials can be constructed with the 'rsgenpoly'
844function.  The roots of the generator polynomial are then defined by
845
846     G = (X - A^(B*S)) * (X - A^((B+1)*S)) * ... * (X - A^((B+2*T-1)*S)).
847
848where T is '(N - K)/2', A is the primitive element of the Galois Field,
849B is the first consecutive root, and S is the step between roots.
850Generator polynomial of this form are constructed by 'rsgenpoly' and can
851be passed to both 'rsenc' and 'rsdec'.  It is also possible to pass the
852B and S values directly to 'rsenc' and 'rsdec'.  In the case of 'rsdec'
853passing B and S can make the decoding faster.
854
855   Consider the example below.
856
857     octave:1> m = 8;
858     octave:2> n = 2^m - 1;
859     octave:3> k = 223;
860     octave:4> prim = 391;
861     octave:5> b = 112;
862     octave:6> s = 11;
863     octave:7> gg = rsgenpoly (n, k, prim, b, s);
864     octave:8> msg = gf (floor (2^m * rand (17, k)), m, prim);
865     octave:9> code = rsenc (msg, n, k, gg);
866     octave:10> noisy = code + [toeplitz([ones(1,17)], zeros(1,17)), zeros(17,238)];
867     octave:11> [dec, nerr] = rsdec (msg, n, k, b, s);
868     octave:12> nerr'
869     ans =
870
871         1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   -1
872
873     octave:13> any (msg' != dec')
874     ans =
875
876        0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1
877
878   This is an interesting example in that it demonstrates many of the
879additional arguments of the Reed-Solomon functions.  In particular this
880example approximates the CCSDS standard Reed-Solomon coder, lacking only
881the dual-basis lookup tables used in this standard.  The CCSDS uses
882non-default values to all of the basic functions involved in the
883Reed-Solomon encoding, since it has a non-default primitive polynomial,
884generator polynomial, etc.
885
886   The example creates 17 message blocks and adds between 1 and 17 error
887symbols to these block.  As can be seen NERR gives the number of errors
888corrected.  In the case of 17 introduced errors NERR equals -1,
889indicating a decoding failure.  This is normal as the correction ability
890of this code is up to 16 error symbols.  Comparing the input message and
891the decoding it can be seen that as expected, only the case of 17 errors
892has not been correctly decoded.
893
894
895File: comms.info,  Node: Shortened Reed-Solomon Codes,  Prev: Creating and Decoding Messages,  Up: Reed-Solomon Codes
896
8974.4.3 Shortened Reed-Solomon Codes
898----------------------------------
899
900In general the codeword length of the Reed-Solomon coder is chosen so
901that it is related directly to the order of the Galois Field by the
902formula 'N = 2^M - 1'.  Although, the underlying Reed-Solomon coding
903must operate over valid codeword length, there are sometimes reasons to
904assume that the codeword length will be shorter.  In this case the
905message is padded with zeros before coding, and the zeros are stripped
906from the returned block.  For example consider the shortened [6,4]
907Reed-Solomon below
908
909     octave:1> m = 3;
910     octave:2> n = 6;
911     octave:3> k = 4;
912     octave:4> msg = gf (floor (2^m * rand (2, k)), m)
913     msg =
914     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
915
916     Array elements =
917
918        7   0   2   5
919        1   5   7   1
920
921     octave:5> code = rsenc (msg, n, k)
922     code =
923     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
924
925     Array elements =
926
927        7   0   2   5   2   3
928        1   5   7   1   0   2
929
930
931File: comms.info,  Node: Convolutional Coding,  Next: Modulations,  Prev: Block Coding,  Up: Top
932
9335 Convolutional Coding
934**********************
935
936Some initial support for convolutional codes is provided by the
937functions described in this chapter.  Convolutional codes are different
938from block codes in that the sequence of preceding symbols is taken into
939account when computing the output symbol of the coder.
940
941* Menu:
942
943* Trellis Structure::
944* Convolutional Encoding::
945
946
947File: comms.info,  Node: Trellis Structure,  Next: Convolutional Encoding,  Up: Convolutional Coding
948
9495.1 Trellis Structure
950=====================
951
952Like block codes, convolutional codes can be described by a set of
953generator polynomials.  Each polynomial describes the combination of
954current and previous input symbols used to compute one output bit of the
955encoder.
956
957   The state transitions and outputs of a convolutional encoder can also
958be described by a trellis diagram.  This diagram describes the
959transitions between states and the outputs of the encoder as a function
960of the current state and the current input symbol.  A trellis structure
961can be created from a set of generator polynomials, specified as octal
962numbers by convention,
963
964     octave:1> g0 = 13;
965     octave:2> g1 = 17;
966     octave:3> trellis = poly2trellis (4, [g0, g1]);
967
968where G0 and G1 are the two polynomials of a rate 1/2 encoder with a
969constraint length of 4.  The returned trellis structure contains the
970following fields
971
972'numInputSymbols'
973     The number of possible input symbols in the input sequence.
974'numOutputSymbols'
975     The number of possible output symbols in the encoded sequence.
976'numStates'
977     The number of possible states that the encoder can take.
978'nextStates'
979     The state transition table for the encoder.  Each row contains the
980     (zero-based) indices of the states reachable from the state
981     represented by that row for each possible input symbol.
982'outputs'
983     The output table for the encoder.  Each row contains the
984     (octal-encoded) output symbols produced by the encoder in the state
985     represented by that row for each possible input symbol.
986
987   To check if a variable references a structure that is a valid trellis
988describing a convolutional encoder, use the 'istrellis' function.
989
990
991File: comms.info,  Node: Convolutional Encoding,  Prev: Trellis Structure,  Up: Convolutional Coding
992
9935.2 Convolutional Encoding
994==========================
995
996The convolutional encoding function takes the message to be encoded and
997a trellis describing the encoder.  The message must be a binary vector
998containing an even number of symbols.  For example, using the encoder
999from the previous section,
1000
1001     octave:1> trellis = poly2trellis (4, [13, 17]);
1002     octave:2> msg = [1 1 0 1 1 0 0 0];
1003     octave:3> out = convenc (msg, trellis)
1004     out =
1005
1006        1   1   1   0   1   0   1   1   0   1   1   0   0   0   1   1
1007
1008   The initial state of the encoder can also be passed in to 'convenc',
1009and the ending state can be read with an optional output argument.
1010Encoding a different vector with a different initial state using the
1011same encoder,
1012
1013     octave:4> msg = [0 1 1 0 1 0 1 1];
1014     octave:5> [out, state] = convenc (msg, trellis, [], 4)
1015     out =
1016
1017        0   1   0   0   0   1   1   0   1   1   1   0   0   0   0   1
1018
1019     state =  6
1020
1021returns both the encoded array and the final state of the convolutional
1022encoder.  This can be used to encode data in blocks, for example, saving
1023and restoring the internal state of the encoder for each subsequent
1024input block.
1025
1026
1027File: comms.info,  Node: Modulations,  Next: Special Filters,  Prev: Convolutional Coding,  Up: Top
1028
10296 Modulations
1030*************
1031
1032To be written.
1033
1034   Currently have functions amodce, ademodce, apkconst, demodmap,
1035modmap, qaskdeco, qaskenco, genqammod, pamdemod, pammod, pskdemod and
1036pskmod.
1037
1038
1039File: comms.info,  Node: Special Filters,  Next: Galois Fields,  Prev: Modulations,  Up: Top
1040
10417 Special Filters
1042*****************
1043
1044To be written.
1045
1046
1047File: comms.info,  Node: Galois Fields,  Next: Function Reference,  Prev: Special Filters,  Up: Top
1048
10498 Galois Fields
1050***************
1051
1052* Menu:
1053
1054* Galois Field Basics::
1055* Manipulating Galois Fields::
1056
1057
1058File: comms.info,  Node: Galois Field Basics,  Next: Manipulating Galois Fields,  Up: Galois Fields
1059
10608.1 Galois Field Basics
1061=======================
1062
1063A Galois Field is a finite algebraic field.  This package implements a
1064Galois Field type in Octave having 2^M members where M is an integer
1065between 1 and 16.  Such fields are denoted as GF(2^M) and are used in
1066error correcting codes in communications systems.  Galois Fields having
1067odd numbers of elements are not implemented.
1068
1069   The _primitive element_ of a Galois Field has the property that all
1070elements of the Galois Field can be represented as a power of this
1071element.  The _primitive polynomial_ is the minimum polynomial of some
1072primitive element in GF(2^M) and is irreducible and of order M. This
1073means that the primitive element is a root of the primitive polynomial.
1074
1075   The elements of the Galois Field GF(2^M) are represented as the
1076values 0 to 2^M -1 by Octave.  The first two elements represent the zero
1077and unity values of the Galois Field and are unique in all fields.  The
1078element represented by 2 is the primitive element of the field and all
1079elements can be represented as combinations of the primitive element and
1080unity as follows
1081
1082Integer                  Binary                   Element of GF(2^M)
10830                        000                      '0'
10841                        001                      '1'
10852                        010                      'A'
10863                        011                      'A + 1'
10874                        100                      'A^2'
10885                        101                      'A^2 + 1'
10896                        110                      'A^2 + A'
10907                        111                      'A^2 + A + 1'
1091
1092   It should be noted that there is often more than a single primitive
1093polynomial of GF(2^M). Each Galois Field over a different primitive
1094polynomial represents a different realization of the Field.  The
1095representations above however rest valid.
1096
1097* Menu:
1098
1099* Creating Galois Fields::
1100* Primitive Polynomials::
1101* Accessing Internal Fields::
1102* Function Overloading::
1103* Known Problems::
1104
1105
1106File: comms.info,  Node: Creating Galois Fields,  Next: Primitive Polynomials,  Up: Galois Field Basics
1107
11088.1.1 Creating Galois Fields
1109----------------------------
1110
1111To work with a Galois Field GF(2^M) in Octave, you must first create a
1112variable that Octave recognizes as a Galois Field.  This is done with
1113the function 'gf (A, M)' as follows.
1114
1115     octave:1> a = [0:7];
1116     octave:2> b = gf (a, 4)
1117     b =
1118     GF(2^4) array. Primitive Polynomial = D^4+D+1 (decimal 19)
1119
1120     Array elements =
1121
1122        0   1   2   3   4   5   6   7
1123
1124   This creates an array B with 8 elements that Octave recognizes as a
1125Galois Field.  The field is created with the default primitive
1126polynomial for the field GF(2^4).  It can be verified that a variable is
1127in fact a Galois Field with the functions 'isgalois' or 'whos'.
1128
1129     octave:3> isgalois (a)
1130     ans = 0
1131     octave:4> isgalois (b)
1132     ans = 1
1133     octave:5> whos
1134     Variables in the current scope:
1135
1136        Attr Name        Size                     Bytes  Class
1137        ==== ====        ====                     =====  =====
1138             a           1x8                         24  double
1139             b           1x8                         32  galois
1140
1141     Total is 16 elements using 56 bytes
1142
1143   It is also possible to create a Galois Field with an arbitrary
1144primitive polynomial.  However, if the polynomial is not a primitive
1145polynomial of the field, and error message is returned.  For instance.
1146
1147     octave:1> a = [0:7];
1148     octave:2> b = gf (a, 4, 25)
1149     b =
1150     GF(2^4) array. Primitive Polynomial = D^4+D^3+1 (decimal 25)
1151
1152     Array elements =
1153
1154        0   1   2   3   4   5   6   7
1155
1156     octave:3> c = gf (a, 4, 21)
1157     error: gf: primitive polynomial (21) of Galois Field must be irreducible
1158
1159   The function 'gftable' is included for compatibility with MATLAB.  In
1160MATLAB this function is used to create the lookup tables used to
1161accelerate the computations over the Galois Field and store them to a
1162file.  However Octave stores these parameters for all of the fields
1163currently in use and so this function is not required, although it is
1164silently accepted.
1165
1166
1167File: comms.info,  Node: Primitive Polynomials,  Next: Accessing Internal Fields,  Prev: Creating Galois Fields,  Up: Galois Field Basics
1168
11698.1.2 Primitive Polynomials
1170---------------------------
1171
1172The function 'gf (A, M)' creates a Galois Field using the default
1173primitive polynomial.  However there exists many possible primitive
1174polynomials for most Galois Fields.  Two functions exist for identifying
1175primitive polynomials, 'isprimitive' and 'primpoly'.  'primpoly (M,
1176OPT)' is used to identify the primitive polynomials of the fields
1177GF(2^M). For example
1178
1179     octave:1> primpoly (4)
1180
1181     Primitive polynomial(s) =
1182
1183     D^4+D+1
1184
1185     ans = 19
1186
1187identifies the default primitive polynomials of the field GF(2^M), which
1188is the same as 'primpoly (4, "min")'.  All of the primitive polynomials
1189of a field can be identified with the function 'primpoly (M, "all")'.
1190For example
1191
1192     octave:1> primpoly (4, "all")
1193
1194     Primitive polynomial(s) =
1195
1196     D^4+D+1
1197     D^4+D^3+1
1198
1199     ans =
1200
1201        19   25
1202
1203while 'primpoly (M, "max")' returns the maximum primitive polynomial of
1204the field, which for the case above is 25.  The function 'primpoly' can
1205also be used to identify the primitive polynomials having only a certain
1206number of non-zero terms.  For instance
1207
1208     octave:1> primpoly (5, 3)
1209
1210     Primitive polynomial(s) =
1211
1212     D^5+D^2+1
1213     D^5+D^3+1
1214
1215     ans =
1216
1217        37   41
1218
1219identifies the polynomials with only three terms that can be used as
1220primitive polynomials of GF(2^5).  If no primitive polynomials existing
1221having the requested number of terms then 'primpoly' returns an empty
1222vector.  That is
1223
1224     octave:1> primpoly (5, 2)
1225     warning: primpoly: No primitive polynomial satisfies the given constraints
1226
1227     ans = [](1x0)
1228
1229   As can be seen above, 'primpoly' displays the polynomial forms the
1230the polynomials that it finds.  This output can be suppressed with the
1231"nodisplay" option, while the returned value is left unchanged.
1232
1233     octave:1> primpoly (4, "all", "nodisplay")
1234     ans =
1235
1236        19   25
1237
1238   'isprimitive (A)' identifies whether the elements of A can be used as
1239primitive polynomials of the Galois Fields GF(2^M). Consider as an
1240example the fields GF(2^4).  The primitive polynomials of these fields
1241must have an order m and so their integer representation must be between
124216 and 31.  Therefore 'isprimitive' can be used in a similar manner to
1243'primpoly' as follows
1244
1245     octave:1> find (isprimitive (16:31)) + 15
1246     ans =
1247
1248        19   25
1249
1250which finds all of the primitive polynomials of GF(2^4).
1251
1252
1253File: comms.info,  Node: Accessing Internal Fields,  Next: Function Overloading,  Prev: Primitive Polynomials,  Up: Galois Field Basics
1254
12558.1.3 Accessing Internal Fields
1256-------------------------------
1257
1258Once a variable has been defined as a Galois Field, the parameters of
1259the field of this structure can be obtained by adding a suffix to the
1260variable.  Valid suffixes are '.m', '.prim_poly' and '.x', which return
1261the order of the Galois Field, its primitive polynomial and the data the
1262variable contains respectively.  For instance
1263
1264     octave:1> a = [0:7];
1265     octave:2> b = gf (a, 4);
1266     octave:3> b.m
1267     ans = 4
1268     octave:4> b.prim_poly
1269     ans = 19
1270     octave:5> c = b.x;
1271     octave:6> whos
1272     Variables in the current scope:
1273
1274        Attr Name        Size                     Bytes  Class
1275        ==== ====        ====                     =====  =====
1276             a           1x8                         24  double
1277             b           1x8                         32  galois
1278             c           1x8                         64  double
1279
1280     Total is 24 elements using 120 bytes
1281
1282   Please note that it is explicitly forbidden to modify the Galois
1283field by accessing these variables.  For instance
1284
1285     octave:1> a = gf ([0:7], 3);
1286     octave:2> a.prim_poly = 13;
1287
1288is explicitly forbidden.  The result of this will be to replace the
1289Galois array A with a structure A with a single element called
1290'.prim_poly'.  To modify the order or primitive polynomial of a field, a
1291new field must be created and the data copied.  That is
1292
1293     octave:1> a = gf ([0:7], 3);
1294     octave:2> a = gf (a.x, a.m, 13);
1295
1296
1297File: comms.info,  Node: Function Overloading,  Next: Known Problems,  Prev: Accessing Internal Fields,  Up: Galois Field Basics
1298
12998.1.4 Function Overloading
1300--------------------------
1301
1302An important consideration in the use of the Galois Field package is
1303that many of the internal functions of Octave, such as 'roots', can not
1304accept Galois Fields as an input.  This package therefore uses Octave
1305classes to _overload_ the internal Octave functions with equivalent
1306functions that work with Galois Fields, so that the standard function
1307names can be used.
1308
1309   The version of the function that is chosen is determined by the first
1310argument of the function.  This is a temporary situation until the
1311Galois Field class constructor can be rewritten to allow the use of the
1312'superiorto' function to define the galois class with a higher
1313precedence.  So, considering the 'filter' function, if the first
1314argument is a _Matrix_, then the normal version of the function is
1315called regardless of whether the other arguments of the function are
1316Galois vectors or not.
1317
1318   Other Octave functions work correctly with Galois Fields and so
1319overloaded versions are not necessary.  This include such functions as
1320'size' and 'polyval'.
1321
1322   It is also useful to use the '.x' option discussed in the previous
1323section, to extract the raw data of the Galois field for use with some
1324functions.  An example is
1325
1326     octave:1> a = minpol (gf (14, 5));
1327     octave:2> b = de2bi (a.x, [], "left-msb");
1328
1329converts the polynomial form of the minimum polynomial of 14 in GF(2^5)
1330into an integer.  Finally help for the Galois specific versions of the
1331functions must explicitly call the correct function as
1332
1333     octave:1> help @galois/conv
1334
1335
1336File: comms.info,  Node: Known Problems,  Prev: Function Overloading,  Up: Galois Field Basics
1337
13388.1.5 Known Problems
1339--------------------
1340
1341Please review the following list of known problems with the Galois type
1342before reporting a bug against this package.
1343
1344Saving and loading Galois variables
1345
1346     Saving a Galois variable to a file is as simple as
1347
1348          octave:1> a = gf (...);
1349          octave:2> save a.mat a
1350
1351     where A is any Galois variable.  Galois variables can be saved in
1352     the Octave binary and ASCII formats, as well as the HDF5 format.
1353     To load a Galois variable from a file, the Galois type must already
1354     be registered to the Octave interpreter prior to the call to
1355     'load'.  If no Galois variables have been created yet, you will
1356     have to do something like
1357
1358          octave:1> dummy = gf (1);
1359          octave:2> load a.mat
1360
1361Logarithm of zero does not return NaN
1362     The logarithm of zero in a Galois field is not defined.  However,
1363     to avoid segmentation faults in later calculations the logarithm of
1364     zero is defined as '2^M - 1', whose value is not the logarithm of
1365     any other value in the Galois field.  A warning is also shown to
1366     tell the user about the problem.  For example
1367
1368          octave:1> m = 3;
1369          octave:2> a = log (gf ([0:2^m-1], m))
1370          warning: log of zero undefined in Galois field
1371          a =
1372          GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1373
1374          Array elements =
1375
1376             7   0   1   3   2   6   4   5
1377
1378     To fix this problem would require a major rewrite of all code,
1379     adding an exception for the case of NaN to all basic operators.
1380     These exceptions will certainly slow the code down.
1381
1382Speed
1383     The code was written piecemeal with no attention to optimization.
1384     Some operations may be slower than they could be.  Contributions
1385     are welcome.
1386
1387
1388File: comms.info,  Node: Manipulating Galois Fields,  Prev: Galois Field Basics,  Up: Galois Fields
1389
13908.2 Manipulating Galois Fields
1391==============================
1392
1393* Menu:
1394
1395* Expressions manipulation and assignment::
1396* Unary operations::
1397* Arithmetic operations::
1398* Comparison operations::
1399* Polynomial manipulations::
1400* Linear Algebra::
1401* Signal Processing::
1402
1403
1404File: comms.info,  Node: Expressions manipulation and assignment,  Next: Unary operations,  Up: Manipulating Galois Fields
1405
14068.2.1 Expressions, manipulation and assignment
1407----------------------------------------------
1408
1409Galois variables can be treated in similar manner to other variables
1410within Octave.  For instance Galois fields can be accessed using index
1411expressions in a similar manner to all other Octave matrices.  For
1412example
1413
1414     octave:1> a = gf ([[0:7]; [7:-1:0]], 3)
1415     a =
1416     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1417
1418     Array elements =
1419
1420        0   1   2   3   4   5   6   7
1421        7   6   5   4   3   2   1   0
1422
1423     octave:2> b = a(1,:)
1424     b =
1425     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1426
1427     Array elements =
1428
1429        0   1   2   3   4   5   6   7
1430
1431   Galois arrays can equally use indexed assignments.  That is, the data
1432in the array can be partially replaced, on the condition that the two
1433fields are identical.  An example is
1434
1435     octave:1> a = gf (ones (2, 8), 3);
1436     octave:2> b = gf (zeros (1, 8), 3);
1437     octave:3> a(1,:) = b
1438     a =
1439     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1440
1441     Array elements =
1442
1443        0   0   0   0   0   0   0   0
1444        1   1   1   1   1   1   1   1
1445
1446   Implicit conversions between normal matrices and Galois arrays are
1447possible.  For instance data can be directly copied from a Galois array
1448to a real matrix as follows.
1449
1450     octave:1> a = gf (ones (2, 8), 3);
1451     octave:2> b = zeros (2, 8);
1452     octave:3> b(2,:) = a(2,:)
1453     b =
1454
1455        0   0   0   0   0   0   0   0
1456        1   1   1   1   1   1   1   1
1457
1458   The inverse is equally possible, with the proviso that the data in
1459the matrix is valid in the Galois field.  For instance
1460
1461     octave:1> a = gf ([0:7], 3);
1462     octave:2> a(1) = 1;
1463
1464is valid, while
1465
1466     octave:1> a = gf ([0:7], 3);
1467     octave:2> a(1) = 8;
1468
1469is not, since 8 is not an element of GF(2^3).  This is a basic rule of
1470manipulating Galois arrays.  That is matrices and scalars can be used in
1471conjunction with a Galois array as long as they contain valid data
1472within the Galois field.  In this case they will be assumed to be of the
1473same field.
1474
1475   Galois arrays can also be concatenated with real matrices or with
1476other Galois arrays in the same field.  For example
1477
1478     octave:1> a = [gf([0:7], 3); gf([7:-1:0], 3)];
1479     octave:2> b = [a, a];
1480     octave:3> c = [a, eye(2)];
1481     octave:3> whos
1482     Variables in the current scope:
1483
1484        Attr Name        Size                     Bytes  Class
1485        ==== ====        ====                     =====  =====
1486             a           2x8                         64  galois
1487             b           2x16                       128  galois
1488             c           2x10                        80  galois
1489
1490     Total is 68 elements using 272 bytes
1491
1492   Other basic manipulations of Galois arrays are
1493
1494'isempty'
1495     Returns true if the Galois array is empty.
1496
1497'size'
1498     Returns the number of rows and columns in the Galois array.
1499
1500'length'
1501     Returns the length of a Galois vector, or the maximum of rows or
1502     columns of Galois arrays.
1503
1504'find'
1505     Find the indexes of the non-zero elements of a Galois array.
1506
1507'diag'
1508     Create a diagonal Galois array from a Galois vector, or extract a
1509     diagonal from a Galois array.
1510
1511'reshape'
1512     Change the shape of the Galois array.
1513
1514
1515File: comms.info,  Node: Unary operations,  Next: Arithmetic operations,  Prev: Expressions manipulation and assignment,  Up: Manipulating Galois Fields
1516
15178.2.2 Unary operations
1518----------------------
1519
1520The same unary operators that are available for normal Octave matrices
1521are also available for Galois arrays.  These operations are
1522
1523'+X'
1524     Unary plus.  This operator has no effect on the operand.
1525
1526'-X'
1527     Unary minus.  Note that in a Galois Field this operator also has no
1528     effect on the operand.
1529
1530'!X'
1531     Returns true for zero elements of Galois Array.
1532
1533'X''
1534     Complex conjugate transpose.  As the Galois Field only contains
1535     integer values, this is equivalent to the transpose operator.
1536
1537'X.''
1538     Transpose of the Galois array.
1539
1540
1541File: comms.info,  Node: Arithmetic operations,  Next: Comparison operations,  Prev: Unary operations,  Up: Manipulating Galois Fields
1542
15438.2.3 Arithmetic operations
1544---------------------------
1545
1546The available arithmetic operations on Galois arrays are the same as on
1547other Octave matrices.  It should be noted that both operands must be in
1548the same Galois Field.  If one operand is a Galois array and the second
1549is a matrix or scalar, then the second operand is silently converted to
1550the same Galois Field.  The element(s) of these matrix or scalar must
1551however be valid members of the Galois field.  Thus
1552
1553     octave:1> a = gf ([0:7], 3);
1554     octave:2> b = a + [0:7];
1555
1556is valid, while
1557
1558     octave:1> a = gf ([0:7], 3);
1559     octave:2> b = a + [1:8];
1560
1561is not, since 8 is not a valid element of GF(2^3).  The available
1562arithmetic operators are
1563
1564'X + Y'
1565     Addition.  If both operands are Galois arrays or matrices, the
1566     number of rows and columns must both agree.  If one operand is a is
1567     a Galois array with a single element or a scalar, its value is
1568     added to all the elements of the other operand.  The '+' operator
1569     on a Galois Field is equivalent to an exclusive-or on normal
1570     integers.
1571
1572'X .+ Y'
1573     Element by element addition.  This operator is equivalent to '+'.
1574
1575'X - Y'
1576     As both '+' and '-' in a Galois Field are equivalent to an
1577     exclusive-or for normal integers, '-' is equivalent to the '+'
1578     operator
1579
1580'X .- Y'
1581     Element by element subtraction.  This operator is equivalent to
1582     '-'.
1583
1584'X * Y'
1585     Matrix multiplication.  The number of columns of X must agree with
1586     the number of rows of Y.
1587
1588'X .* Y'
1589     Element by element multiplication.  If both operands are matrices,
1590     the number of rows and columns must both agree.
1591
1592'X / Y'
1593     Right division.  This is conceptually equivalent to the expression
1594
1595          (inverse (y') * x')'
1596
1597     but it is computed without forming the inverse of Y'.
1598
1599     If the matrix is singular then an error occurs.  If the matrix is
1600     under-determined, then a particular solution is found (but not
1601     minimum norm).  If the solution is over-determined, then an attempt
1602     is made to find a solution, but this is not guaranteed to work.
1603
1604'X ./ Y'
1605     Element by element right division.
1606
1607'X \ Y'
1608     Left division.  This is conceptually equivalent to the expression
1609
1610          inverse (x) * y
1611
1612     but it is computed without forming the inverse of X.
1613
1614     If the matrix is singular then an error occurs.  If the matrix is
1615     under-determined, then a particular solution is found (but not
1616     minimum norm).  If the solution is over-determined, then an attempt
1617     is made to find a solution, but this is not guaranteed to work.
1618
1619'X .\ Y'
1620     Element by element left division.  Each element of Y is divided by
1621     each corresponding element of X.
1622
1623'X ^ Y'
1624'X ** Y'
1625     Power operator.  If X and Y are both scalars, this operator returns
1626     X raised to the power Y.  Otherwise X must be a square matrix
1627     raised to an integer power.
1628
1629'X .^ Y'
1630'X .** Y'
1631     Element by element power operator.  If both operands are matrices,
1632     the number of rows and columns must both agree.
1633
1634
1635File: comms.info,  Node: Comparison operations,  Next: Polynomial manipulations,  Prev: Arithmetic operations,  Up: Manipulating Galois Fields
1636
16378.2.4 Comparison operations
1638---------------------------
1639
1640Galois variables can be tested for equality in the usual manner.  That
1641is
1642
1643     octave:1> a = gf ([0:7], 3);
1644     octave:2> a == ones (1, 8)
1645     ans =
1646
1647        0   1   0   0   0   0   0   0
1648
1649     octave:3> a != zeros (1, 8)
1650     ans =
1651
1652        0   1   1   1   1   1   1   1
1653
1654   Likewise, Galois vectors can be tested against scalar values (whether
1655they are Galois or not).  For instance
1656
1657     octave:4> a == 1
1658     ans =
1659
1660        0   1   0   0   0   0   0   0
1661
1662   To test if any or all of the values in a Galois array are non-zero,
1663the functions 'any' and 'all' can be used as normally.
1664
1665   In addition the comparison operators '>', '>=', '<' and '<=' are
1666available.  As elements of the Galois Field are modulus 2^M, all
1667elements of the field are both greater than and less than all others at
1668the same time.  Thus these comparison operators don't make that much
1669sense and are only included for completeness.  The comparison is done
1670relative to the integer value of the Galois Field elements.
1671
1672
1673File: comms.info,  Node: Polynomial manipulations,  Next: Linear Algebra,  Prev: Comparison operations,  Up: Manipulating Galois Fields
1674
16758.2.5 Polynomial manipulations
1676------------------------------
1677
1678A polynomial in GF(2^M) can be expressed as a vector in GF(2^M). For
1679instance if A is the _primitive element_, then the example
1680
1681     octave:1> poly = gf ([2, 4, 5, 1], 3);
1682
1683represents the polynomial
1684
1685     poly = A * x^3 + A^2 * x^2 + (A^2 + 1) * x + 1
1686
1687   Arithmetic can then be performed on these vectors.  For instance to
1688add to polynomials an example is
1689
1690     octave:1> poly1 = gf ([2, 4, 5, 1], 3);
1691     octave:2> poly2 = gf ([1, 2], 3);
1692     octave:3> sumpoly = poly1 + [0, 0, poly2]
1693     sumpoly =
1694     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1695
1696     Array elements =
1697
1698        2   4   4   3
1699
1700   Note that POLY2 must be zero padded to the same length as poly1 to
1701allow the addition to take place.
1702
1703   Multiplication and division of Galois polynomials is equivalent to
1704convolution and de-convolution of vectors of Galois elements.  Thus to
1705multiply two polynomials in GF(2^3).
1706
1707     octave:4> mulpoly = conv (poly1, poly2)
1708     mulpoly =
1709     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1710
1711     Array elements =
1712
1713        2   0   6   0   2
1714
1715   Likewise the division of two polynomials uses the de-convolution
1716function as follows
1717
1718     octave:5> [poly, remd] = deconv (mulpoly, poly2)
1719     poly =
1720     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1721
1722     Array elements =
1723
1724        2   4   5   1
1725
1726     remd =
1727     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1728
1729     Array elements =
1730
1731        0   0   0   0   0
1732
1733   Note that the remainder of this division is zero, as we performed the
1734inverse operation to the multiplication.
1735
1736   To evaluate a polynomial for a certain value in GF(2^M), use the
1737Octave function 'polyval'.
1738
1739     octave:1> poly1 = gf ([2, 4, 5, 1], 3);  ## a*x^3+a^2*x^2+(a^2+1)*x+1
1740     octave:2> x0 = gf ([0, 1, 2], 3);
1741     octave:3> y0 = polyval (poly1, x0);
1742     y0 =
1743     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1744
1745     Array elements =
1746
1747        1   2   0
1748
1749     octave:4> a = gf (2, 3);               ## The primitive element
1750     octave:5> y1 = a .* x0.^3 + a.^2 .* x0.^2 + (a.^2 + 1) .* x0 + 1
1751     y1 =
1752     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1753
1754     Array elements =
1755
1756        1   2   0
1757
1758   It is equally possible to find the roots of Galois polynomials with
1759the 'roots' function.  Using the polynomial above over GF(2^3), we can
1760find its roots in the following manner
1761
1762     octave:1> poly1 = gf ([2, 4, 5, 1], 3);
1763     octave:2> root1 = roots (poly1)
1764     root1 =
1765     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1766
1767     Array elements =
1768
1769        2
1770        5
1771        5
1772
1773   Thus the example polynomial has 3 roots in GF(2^3) with one root of
1774multiplicity 2.  We can check this answer with the 'polyval' function as
1775follows
1776
1777     octave:3> check1 = polyval (poly1, root1)
1778     check1 =
1779     GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1780
1781     Array elements =
1782
1783        0
1784        0
1785        0
1786
1787which as expected gives a zero vector.  It should be noted that both the
1788number of roots and their value, will depend on the chosen field.  Thus
1789for instance
1790
1791     octave:1> poly3 = gf ([2, 4, 5, 1], 3, 13);
1792     octave:2> root3 = roots (poly3)
1793     root3 =
1794     GF(2^3) array. Primitive Polynomial = D^3+D^2+1 (decimal 13)
1795
1796     Array elements =
1797
1798        5
1799
1800shows that in the field GF(2^3) with a different primitive polynomial,
1801has only one root exists.
1802
1803   The minimum polynomial of an element of GF(2^M) is the minimum degree
1804polynomial in GF(2), excluding the trivial zero polynomial, that has
1805that element as a root.  The fact that the minimum polynomial is in
1806GF(2) means that its coefficients are one or zero only.  The 'minpol'
1807function can be used to find the minimum polynomial as follows
1808
1809     octave:1> a = gf (2, 3);               ## The primitive element
1810     octave:2> b = minpol (a)
1811     b =
1812     GF(2) array.
1813
1814     Array elements =
1815
1816        1   0   1   1
1817
1818   Note that the minimum polynomial of the primitive element is the
1819primitive polynomial.  Elements of GF(2^M) sharing the same minimum
1820polynomial form a partitioning of the field.  This partitioning can be
1821found with the 'cosets' function as follows
1822
1823     octave:1> c = cosets (3)
1824     c =
1825     {
1826       [1,1] =
1827       GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1828
1829       Array elements =
1830
1831          1
1832
1833       [1,2] =
1834       GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1835
1836       Array elements =
1837
1838          2   4   6
1839
1840       [1,3] =
1841       GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
1842
1843       Array elements =
1844
1845          3   5   7
1846
1847     }
1848
1849which returns a cell array containing all of the elements of the
1850GF(2^3), partitioned into groups sharing the same minimum polynomial.
1851The function 'cosets' can equally accept a second argument defining the
1852primitive polynomial to use in its calculations (i.e.  'cosets (A, P)').
1853
1854
1855File: comms.info,  Node: Linear Algebra,  Next: Signal Processing,  Prev: Polynomial manipulations,  Up: Manipulating Galois Fields
1856
18578.2.6 Linear Algebra
1858--------------------
1859
1860The basic linear algebra operation of this package is the LU
1861factorization of a Galois array.  That is the Galois array A is
1862factorized in the following way
1863
1864     octave:2> [l, u, p] = lu (a)
1865
1866such that 'P * A = L * U'.  The matrix P contains row permutations of A,
1867such that L and U are strictly upper and low triangular.  The Galois
1868array A can be rectangular.
1869
1870   All other linear algebra operations within this package are based on
1871this LU factorization of a Galois array.  An important consequence of
1872this is that no solution can be found for singular matrices, only a
1873particular solution will be found for under-determined systems of
1874equation and the solution found for over-determined systems is not
1875always correct.  This is identical to the way MATLAB performs linear
1876algebra on Galois arrays.
1877
1878   For instance consider the under-determined linear equation
1879
1880     octave:1> A = gf ([2, 0, 3, 3; 3, 1, 3, 1; 3, 1, 1, 0], 2);
1881     octave:2> b = [0:2]';
1882     octave:3> x = A \ b;
1883
1884gives the solution 'X = [2, 0, 3, 2]'.  There are in fact 4 possible
1885solutions to this linear system; 'X = [3, 2, 2, 0]', 'X = [0, 3, 1, 1]',
1886'X = [2, 0, 3, 2]' and 'X = [1, 1, 0, 3]'.  No particular selection
1887criteria are applied to the chosen solution.
1888
1889   In addition, because singular matrices cannot be solved, unless you
1890know the matrix is not singular, you should test the determinant of the
1891matrix prior to solving the linear system.  For instance
1892
1893     octave:1> A = gf (floor (2^m * rand (3)), 2);
1894     octave:2> b = [0:2]';
1895     octave:3> if (det (A) != 0); x = A \ b; y = b' / A; endif;
1896     octave:4> r = rank (A);
1897
1898solves the linear systems 'A * X = B' and 'Y * A = B'.  Note that you do
1899not need to take into account rounding errors in the determinant, as the
1900determinant can only take values within the Galois Field.  So if the
1901determinant equals zero, the array is singular.
1902
1903
1904File: comms.info,  Node: Signal Processing,  Prev: Linear Algebra,  Up: Manipulating Galois Fields
1905
19068.2.7 Signal Processing with Galois Fields
1907------------------------------------------
1908
1909Signal processing functions such as filtering, convolution,
1910de-convolution and Fourier transforms can be performed over Galois
1911Fields.  For instance the 'filter' function can be used with Galois
1912vectors in the same manner as usual.  For instance
1913
1914     octave:1> b = gf ([2, 0, 0, 1, 0, 2, 0, 1], 2);
1915     octave:2> a = gf ([2, 0, 1, 1], 2);
1916     octave:3> x = gf ([1, zeros(1, 20)], 2);
1917     octave:4> y = filter (b, a, x)
1918     y =
1919     GF(2^2) array. Primitive Polynomial = D^2+D+1 (decimal 7)
1920
1921     Array elements =
1922
1923        1   0   3   0   2   3   1   0   1   3   3   1   0   1   3   3   1   0   1   3   3
1924
1925gives the impulse response of the filter defined by A and B.
1926
1927   Two equivalent ways are given to perform the convolution of two
1928Galois vectors.  Firstly the function 'conv' can be used, or
1929alternatively the function 'convmtx' can be used.  The first of these
1930function is identical to the convolution function over real vectors, and
1931has been described in the section about multiplying two Galois
1932polynomials.
1933
1934   In the case where many Galois vectors will be convolved with the same
1935vector, the second function 'convmtx' offers an alternative method to
1936calculate the convolution.  If A is a column vector and X is a column
1937vector of length N, then
1938
1939     octave:1> m = 3;
1940     octave:2> a = gf (floor (2^m * rand (4, 1)), m);
1941     octave:3> b = gf (floor (2^m * rand (4, 1)), m);
1942     octave:4> c0 = conv (a, b)';
1943     octave:5> c1 = convmtx (a, length (b)) * b;
1944     octave:6> check = all (c0 == c1)
1945     check = 1
1946
1947shows the equivalence of the two functions.  The de-convolution function
1948has been previously described above.
1949
1950   The final signal processing function available in this package are
1951the functions to perform Fourier transforms over a Galois field.  Three
1952functions are available, 'fft', 'ifft' and 'dftmtx'.  The first two
1953functions use the third to perform their work.  Given an element A of
1954the Galois field GF(2^M), 'dftmtx' returns the '2^M - 1' square matrix
1955used in the Fourier transforms with respect to A.  The minimum
1956polynomial of A must be primitive in GF(2^M). In the case of the 'fft'
1957function 'dftmtx' is called with the primitive element of the Galois
1958Field as an argument.  As an example
1959
1960     octave:1> m = 4;
1961     octave:2> n = 2^m - 1;
1962     octave:2> alph = gf (2, m);
1963     octave:3> x = gf (floor (2^m * rand (n, 1)), m);
1964     octave:4> y0 = fft (x);
1965     octave:5> y1 = dftmtx (alph) * x;
1966     octave:6> z0 = ifft (y0);
1967     octave:7> z1 = dftmtx (1/alph) * y1;
1968     octave:8> check = all (y0 == y1) & all (z0 == x) & all (z1 == x)
1969     check = 1
1970
1971   In all cases, the length of the vector to be transformed must be '2^M
1972-1'.  As the 'dftmtx' creates a matrix representing the Fourier
1973transform, to limit the computational task only Fourier transforms in
1974GF(2^M), where M is less than or equal to 8, are supported.
1975
1976
1977File: comms.info,  Node: Function Reference,  Prev: Galois Fields,  Up: Top
1978
19799 Function Reference
1980********************
1981
19829.1 Functions Alphabetically
1983============================
1984
1985* Menu:
1986
1987* ademodce::	Baseband demodulator for analog signals.
1988* amdemod::	Creates the AM demodulation of the signal S sampled at
1989		frequency FS with carrier frequency FC
1990* ammod::	Creates the AM modulation of the amplitude signal X with
1991		carrier frequency FC
1992* amodce::	Baseband modulator for analog signals.
1993* apkconst::	Plots a ASK/PSK signal constellation.
1994* awgn::	Add white Gaussian noise to a voltage signal
1995* bchdeco::	Decodes the coded message CODE using a BCH coder.
1996* bchenco::	Encodes the message MSG using a [N,K] BCH coding.
1997* bchpoly::	Calculates the generator polynomials for a BCH coder.
1998* berconfint::	Returns Bit Error Rate, BER, and confidence interval,
1999		INTERVAL, for the number of errors R and number of
2000		transmitted bits N with a confidence level of LEVEL.
2001* bi2de::	Convert bit matrix to a vector of integers
2002* bin2gray::	Creates a Gray encoded data Y with the same size as input X
2003* biterr::	Compares two matrices and returns the number of bit errors
2004		and the bit error rate.
2005* bsc:: 	Send DATA into a binary symmetric channel with probability
2006		P of error one each symbol
2007* comms::	Manual and test code for the Octave Communications toolbox.
2008* compand::	Compresses and expanding the dynamic range of a signal
2009		using a mu-law or or A-law algorithm
2010* conv::	Convolve two Galois vectors
2011* convenc::	Encode the binary vector MSG with the convolutional encoder
2012		described by the trellis structure T
2013* convmtx::	Create matrix to perform repeated convolutions with the
2014		same vector in a Galois Field.
2015* cosets::	Finds the elements of GF(2^M) with primitive polynomial
2016		PRIM, that share the same minimum polynomial.
2017* cyclgen::	Produce the parity check and generator matrix of a cyclic
2018		code.
2019* cyclpoly::	This function returns the cyclic generator polynomials of
2020		the code [N,K].
2021* de2bi::	Convert a non-negative integer to bit vector
2022* decode::	Top level block decoder.
2023* deconv::	Deconvolve two Galois vectors
2024* deintrlv::	Restore elements of DATA according to ELEMENTS See also:
2025		intrlv
2026* demodmap::	Demapping of an analog signal to a digital signal.
2027* det:: 	Compute the determinant of the Galois array A
2028* dftmtx::	Form a matrix, that can be used to perform Fourier
2029		transforms in a Galois Field
2030* diag::	Return a diagonal matrix with Galois vector V on diagonal K
2031		The second argument is optional.
2032* dpcmdeco::	Decode using differential pulse code modulation (DPCM)
2033* dpcmenco::	Encode using differential pulse code modulation (DPCM)
2034* dpcmopt::	Optimize the DPCM parameters and codebook
2035* egolaydec::	Decode Extended Golay code
2036* egolayenc::	Encode with Extended Golay code
2037* egolaygen::	Extended Golay code generator matrix
2038* encode::	Top level block encoder.
2039* exp:: 	Compute the anti-logarithm for each element of X for a
2040		Galois array
2041* eyediagram::	Plot the eye-diagram of a signal.
2042* fft:: 	If X is a column vector, finds the FFT over the primitive
2043		element of the Galois Field of X.
2044* fibodeco::	Returns the decoded Fibonacci value from the binary vectors
2045		CODE Universal codes like Fibonacci codes have a useful
2046		synchronization property, only for 255 maximum value we
2047		have designed these routines.
2048* fiboenco::	Returns the cell-array of encoded Fibonacci value from the
2049		column vectors NUM Universal codes like Fibonacci codes
2050		have a useful synchronization property, only for 255
2051		maximum value we have designed these routines.
2052* fibosplitstream:: Returns the split data stream at the word boundaries
2053		Assuming the stream was originally encoded using 'fiboenco'
2054		and this routine splits the stream at the points where "11"
2055		occur together & gives us the code-words which can later be
2056		decoded from the 'fibodeco' This however doesn't mean that
2057		we intend to verify if all the codewords are correct, and
2058		in fact the last symbol in the return list can or can not
2059		be a valid codeword
2060* filter::	Digital filtering of vectors in a Galois Field.
2061* finddelay::	Estimate the delay between times series X and time series Y
2062		by correlating and finding the peak.
2063* fmdemod::	Creates the FM demodulation of the signal S sampled at
2064		frequency FS with carrier frequency FC
2065* fmmod::	Creates the FM modulation S of the message signal M with
2066		carrier frequency FC
2067* gen2par::	Converts binary generator matrix GEN to the parity check
2068		matrix PAR and visa-versa.
2069* genqamdemod:: General quadrature amplitude demodulation.
2070* genqammod::	Modulates an information sequence of integers X in the
2071		range '[0 ... M-1]' onto a quadrature amplitude modulated
2072		signal Y, where 'M = length (c) - 1' and C is a 1D vector
2073		specifying the signal constellation mapping to be used.
2074* gf::		#endif
2075* gftable::	This function exists for compatibility with matlab.
2076* gfweight::	Calculate the minimum weight or distance of a linear block
2077		code.
2078* golombdeco::	Returns the Golomb decoded signal vector using CODE and M
2079		Compulsory m is need to be specified.
2080* golombenco::	Returns the Golomb coded signal as cell array Also total
2081		length of output code in bits can be obtained This function
2082		uses a M need to be supplied for encoding signal vector
2083		into a Golomb coded vector.
2084* hammgen::	Produce the parity check and generator matrices of a
2085		Hamming code.
2086* helscanintrlv:: NROWS-by-NCOLS See also: helscandeintrlv
2087* huffmandeco:: Decode signal encoded by 'huffmanenco'
2088* huffmandict:: Builds a Huffman code, given a probability list.
2089* huffmanenco:: Returns the Huffman encoded signal using DICT.
2090* ifft::	If X is a column vector, finds the IFFT over the primitive
2091		element of the Galois Field of X.
2092* intrlv::	Interleaved elements of DATA according to ELEMENTS See
2093		also: deintrlv
2094* inv:: 	Compute the inverse of the square matrix A.
2095* inverse::	See inv
2096* isequal::	Return true if all of X1, X2, ... are equal See also:
2097		isequalwithequalnans
2098* isgalois::	Return 1 if the value of the expression EXPR is a Galois
2099		Field.
2100* isprimitive:: Returns 1 is the polynomial represented by A is a primitive
2101		polynomial of GF(2).
2102* istrellis::	Return true if T is a valid trellis structure
2103* lloyds::	Optimize the quantization table and codes to reduce
2104		distortion.
2105* log:: 	Compute the natural logarithm for each element of X for a
2106		Galois array
2107* lu::		Compute the LU decomposition of A in a Galois Field.
2108* lz77deco::	Lempel-Ziv 77 source algorithm decoding implementation.
2109* lz77enco::	Lempel-Ziv 77 source algorithm implementation.
2110* matdeintrlv:: Restore elements of DATA with a temporary matrix of size
2111		NROWS-by-NCOLS See also: matintrlv
2112* matintrlv::	Interleaved elements of DATA with a temporary matrix of
2113		size NROWS-by-NCOLS See also: matdeintrlv
2114* minpol::	Finds the minimum polynomial for elements of a Galois
2115		Field.
2116* modmap::	Mapping of a digital signal to an analog signal.
2117* oct2dec::	Convert octal to decimal values
2118* pamdemod::	Demodulates a pulse amplitude modulated signal X into an
2119		information sequence of integers in the range '[0 ... M-1]'
2120		PHI controls the initial phase and TYPE controls the
2121		constellation mapping.
2122* pammod::	Modulates an information sequence of integers X in the
2123		range '[0 ... M-1]' onto a pulse amplitude modulated signal
2124		Y PHI controls the initial phase and TYPE controls the
2125		constellation mapping.
2126* poly2trellis:: Convert convolutional code generator polynomials into
2127		trellis form
2128* primpoly::	Finds the primitive polynomials in GF(2^M).
2129* prod::	Product of elements along dimension DIM of Galois array.
2130* pskdemod::	Demodulates a complex-baseband phase shift keying modulated
2131		signal into an information sequence of integers in the
2132		range '[0 ... M-1]'.
2133* pskmod::	Modulates an information sequence of integers X in the
2134		range '[0 ... M-1]' onto a complex baseband phase shift
2135		keying modulated signal Y.
2136* qamdemod::	Create the QAM demodulation of x with a size of alphabet m
2137		See also: qammod, pskmod, pskdemod
2138* qammod::	Create the QAM modulation of x with a size of alphabet m
2139		See also: qamdemod, pskmod, pskdemod
2140* qaskdeco::	Demaps an analog signal using a square QASK constellation.
2141* qaskenco::	Map a digital signal using a square QASK constellation.
2142* qfunc::	Compute the Q function See also: erfc, erf
2143* qfuncinv::	Compute the inverse Q function See also: erfc, erf
2144* quantiz::	Quantization of an arbitrary signal relative to a
2145		partitioning
2146* randdeintrlv:: Restore elements of DATA with a random permutation See
2147		also: randintrlv, intrlv, deintrlv
2148* randerr::	Generate a matrix of random bit errors.
2149* randint::	Generate a matrix of random binary numbers.
2150* randintrlv::	Interleaves elements of DATA with a random permutation See
2151		also: intrlv, deintrlv
2152* randsrc::	Generate a matrix of random symbols.
2153* rank::	Compute the rank of the Galois array A by counting the
2154		independent rows and columns
2155* rcosfir::	Implements a cosine filter or root cosine filter impulse
2156		response
2157* reedmullerdec:: Decode the received code word VV using the RM-generator
2158		matrix G, of order R, M, returning the code-word C.
2159* reedmullerenc:: Definition type construction of Reed-Muller code, of
2160		order R, length 2^M.
2161* reedmullergen:: Definition type construction of Reed-Muller code, of
2162		order R, length 2^M.
2163* reshape::	Return a matrix with M rows and N columns whose elements
2164		are taken from the Galois array A.
2165* ricedeco::	Returns the Rice decoded signal vector using CODE and K
2166		Compulsory K is need to be specified A restrictions is that
2167		a signal set must strictly be non-negative The value of
2168		code is a cell array of row-vectors which have the encoded
2169		rice value for a single sample.
2170* riceenco::	Returns the Rice encoded signal using K or optimal K
2171		Default optimal K is chosen between 0-7.
2172* rledeco::	Returns decoded run-length MESSAGE.
2173* rleenco::	Returns run-length encoded MESSAGE.
2174* roots::	For a vector V with N components, return the roots of the
2175		polynomial over a Galois Field
2176* rsdec::	Decodes the message contained in CODE using a [N,K]
2177		Reed-Solomon code.
2178* rsdecof::	Decodes an ASCII file using a Reed-Solomon coder.
2179* rsenc::	Encodes the message MSG using a [N,K] Reed-Solomon coding.
2180* rsencof::	Encodes an ASCII file using a Reed-Solomon coder.
2181* rsgenpoly::	Creates a generator polynomial for a Reed-Solomon coding
2182		with message length of K and codelength of N.
2183* scatterplot:: Display the scatter plot of a signal.
2184* shannonfanodeco:: Returns the original signal that was Shannon-Fano
2185		encoded.
2186* shannonfanodict:: Returns the code dictionary for source using
2187		Shannon-Fano algorithm Dictionary is built from
2188		SYMBOL_PROBABILITIES using the Shannon-Fano scheme.
2189* shannonfanoenco:: Returns the Shannon-Fano encoded signal using DICT This
2190		function uses a DICT built from the 'shannonfanodict' and
2191		uses it to encode a signal list into a Shannon-Fano code
2192		Restrictions include a signal set that strictly belongs in
2193		the 'range [1,N]' with 'N = length (dict)'.
2194* sqrt::	Compute the square root of X, element by element, in a
2195		Galois Field See also: exp
2196* sum:: 	Sum of elements along dimension DIM of Galois array.
2197* sumsq::	Sum of squares of elements along dimension DIM of Galois
2198		array If DIM is omitted, it defaults to 1 (column-wise sum
2199		of squares)
2200* symerr::	Compares two matrices and returns the number of symbol
2201		errors and the symbol error rate.
2202* syndtable::	Create the syndrome decoding table from the parity check
2203		matrix H.
2204* systematize:: Given G, extract P parity check matrix.
2205* vec2mat::	Converts the vector V into a C column matrix with row
2206		priority arrangement and with the final column padded with
2207		the value D to the correct length.
2208* wgn:: 	Returns a M-by-N matrix Y of white Gaussian noise.
2209
2210
2211File: comms.info,  Node: ademodce,  Next: amdemod,  Up: Function Reference
2212
22139.1.1 ademodce
2214--------------
2215
2216 -- Function File: Y = ademodce (X, FS, "amdsb-tc", offset)
2217 -- Function File: Y = ademodce (X, FS, "amdsb-tc/costas", offset)
2218 -- Function File: Y = ademodce (X, FS, "amdsb-sc")
2219 -- Function File: Y = ademodce (X, FS, "amdsb-sc/costas")
2220 -- Function File: Y = ademodce (X, FS, "amssb")
2221 -- Function File: Y = ademodce (X, FS, "qam")
2222 -- Function File: Y = ademodce (X, FS, "qam/cmplx")
2223 -- Function File: Y = ademodce (X, FS, "fm", DEV)
2224 -- Function File: Y = ademodce (X, FS, "pm", DEV)
2225 -- Function File: Y = ademodce (X, [FS, IPHS], ...)
2226 -- Function File: Y = ademodce (..., NUM, DEN)
2227
2228     Baseband demodulator for analog signals.  The input signal is
2229     specified by X, its sampling frequency by FS and the type of
2230     modulation by the third argument, TYP.  The default values of FS is
2231     1 and TYP is "amdsb-tc"
2232
2233     If the argument FS is a two element vector, the first element
2234     represents the sampling rate and the second the initial phase
2235
2236     The different types of demodulations that are available are
2237
2238     "am"
2239     "amdsb-tc"
2240          Double-sideband with carrier
2241     "amdsb-tc/costas"
2242          Double-sideband with carrier and Costas phase locked loop
2243     "amdsb-sc"
2244          Double-sideband with suppressed carrier
2245     "amssb"
2246          Single-sideband with frequency domain Hilbert filtering
2247     "qam"
2248          Quadrature amplitude demodulation.  In-phase in odd-columns
2249          and quadrature in even-columns
2250     "qam/cmplx"
2251          Quadrature amplitude demodulation with complex return value
2252     "fm"
2253          Frequency demodulation
2254     "pm"
2255          Phase demodulation
2256
2257     Additional arguments are available for the demodulations
2258     "amdsb-tc", "fm", "pm".  These arguments are
2259
2260     'offset'
2261          The offset in the input signal for the transmitted carrier
2262     'dev'
2263          The deviation of the phase and frequency modulation
2264
2265     It is possible to specify a low-pass filter, by the numerator NUM
2266     and denominator DEN that will be applied to the returned vector
2267
2268     See also: ademodce, dmodce
2269
2270
2271File: comms.info,  Node: amdemod,  Next: ammod,  Prev: ademodce,  Up: Function Reference
2272
22739.1.2 amdemod
2274-------------
2275
2276 -- Function File: M = amdemod (S, FC, FS)
2277     Creates the AM demodulation of the signal S sampled at frequency FS
2278     with carrier frequency FC
2279
2280     Inputs:
2281        * S: AM modulated signal
2282
2283        * FC: carrier frequency
2284
2285        * FS: sampling frequency
2286
2287     Output:
2288        * M: AM demodulation of the signal
2289
2290     Demo
2291          demo amdemod
2292     See also: ammod, fmmod, fmdemod
2293
2294
2295File: comms.info,  Node: ammod,  Next: amodce,  Prev: amdemod,  Up: Function Reference
2296
22979.1.3 ammod
2298-----------
2299
2300 -- Function File: Y = ammod (X, FC, FS)
2301     Creates the AM modulation of the amplitude signal X with carrier
2302     frequency FC
2303
2304     Inputs:
2305        * X: amplitude message signal
2306
2307        * FC: carrier frequency
2308
2309        * FS: sampling frequency
2310
2311     Output:
2312          Y: The AM modulation of X
2313     Demo
2314          demo ammod
2315     See also: amdemod, fmmod, fmdemod
2316
2317
2318File: comms.info,  Node: amodce,  Next: apkconst,  Prev: ammod,  Up: Function Reference
2319
23209.1.4 amodce
2321------------
2322
2323 -- Function File: Y = amodce (X, FS, "amdsb-tc", offset)
2324 -- Function File: Y = amodce (X, FS, "amdsb-sc")
2325 -- Function File: Y = amodce (X, FS, "amssb")
2326 -- Function File: Y = amodce (X, FS, "amssb/time", NUM, DEN)
2327 -- Function File: Y = amodce (X, FS, "qam")
2328 -- Function File: Y = amodce (X, FS, "fm", DEV)
2329 -- Function File: Y = amodce (X, FS, "pm", DEV)
2330 -- Function File: Y = amodce (X, [FS, IPHS], ...)
2331
2332     Baseband modulator for analog signals.  The input signal is
2333     specified by X, its sampling frequency by FS and the type of
2334     modulation by the third argument, TYP.  The default values of FS is
2335     1 and TYP is "amdsb-tc"
2336
2337     If the argument FS is a two element vector, the first element
2338     represents the sampling rate and the second the initial phase
2339
2340     The different types of modulations that are available are
2341
2342     "am"
2343     "amdsb-tc"
2344          Double-sideband with carrier
2345     "amdsb-sc"
2346          Double-sideband with suppressed carrier
2347     "amssb"
2348          Single-sideband with frequency domain Hilbert filtering
2349     "amssb/time"
2350          Single-sideband with time domain filtering.  Hilbert filter is
2351          used by default, but the filter can be specified
2352     "qam"
2353          Quadrature amplitude modulation
2354     "fm"
2355          Frequency modulation
2356     "pm"
2357          Phase modulation
2358
2359     Additional arguments are available for the modulations "amdsb-tc",
2360     "fm", "pm" and "amssb/time".  These arguments are
2361
2362     'offset'
2363          The offset in the input signal for the transmitted carrier
2364     'dev'
2365          The deviation of the phase and frequency modulation
2366     'num'
2367     'den'
2368          The numerator and denominator of the filter transfer function
2369          for the time domain filtering of the SSB modulation
2370
2371     See also: ademodce, dmodce
2372
2373
2374File: comms.info,  Node: apkconst,  Next: awgn,  Prev: amodce,  Up: Function Reference
2375
23769.1.5 apkconst
2377--------------
2378
2379 -- Function File: apkconst (NSIG)
2380 -- Function File: apkconst (NSIG, AMP)
2381 -- Function File: apkconst (NSIG, AMP, PHS)
2382 -- Function File: apkconst (..., "n")
2383 -- Function File: apkconst (..., STR)
2384 -- Function File: Y = apkconst (...)
2385
2386     Plots a ASK/PSK signal constellation.  Argument NSIG is a real
2387     vector whose length determines the number of ASK radii in the
2388     constellation The values of vector NSIG determine the number of
2389     points in each ASK radii
2390
2391     By default the radii of each ASK modulated level is given by the
2392     index of NSIG.  The amplitudes can be defined explicitly in the
2393     variable AMP, which is a vector of the same length as NSIG
2394
2395     By default the first point in each ASK radii has zero phase, and
2396     following points are coding in an anti-clockwise manner.  If PHS is
2397     defined then it is a vector of the same length as NSIG defining the
2398     initial phase in each ASK radii
2399
2400     In addition 'apkconst' takes two string arguments "n" and STR If
2401     the string "n" is included in the arguments, then a number is
2402     printed next to each constellation point giving the symbol value
2403     that would be mapped to this point by the 'modmap' function.  The
2404     argument STR is a plot style string (example "r+") and determines
2405     the default gnuplot point style to use for plot points in the
2406     constellation
2407
2408     If 'apkconst' is called with a return argument, then no plot is
2409     created.  However the return value is a vector giving the in-phase
2410     and quadrature values of the symbols in the constellation See also:
2411     dmod, ddemod, modmap, demodmap
2412
2413
2414File: comms.info,  Node: awgn,  Next: bchdeco,  Prev: apkconst,  Up: Function Reference
2415
24169.1.6 awgn
2417----------
2418
2419 -- Function File: Y = awgn (X, SNR)
2420 -- Function File: Y = awgn (X, SNR, PWR)
2421 -- Function File: Y = awgn (X, SNR, PWR, SEED)
2422 -- Function File: Y = awgn (..., TYPE)
2423
2424     Add white Gaussian noise to a voltage signal
2425
2426     The input X is assumed to be a real or complex voltage signal.  The
2427     returned value Y will be the same form and size as X but with
2428     Gaussian noise added.  Unless the power is specified in PWR, the
2429     signal power is assumed to be 0dBW, and the noise of SNR dB will be
2430     added with respect to this.  If PWR is a numeric value then the
2431     signal X is assumed to be PWR dBW, otherwise if PWR is "measured",
2432     then the power in the signal will be measured and the noise added
2433     relative to this measured power
2434
2435     If SEED is specified, then the random number generator seed is
2436     initialized with this value
2437
2438     By default the SNR and PWR are assumed to be in dB and dBW
2439     respectively.  This default behavior can be chosen with TYPE set to
2440     "dB". In the case where TYPE is set to "linear", PWR is assumed to
2441     be in Watts and SNR is a ratio See also: randn, wgn
2442
2443
2444File: comms.info,  Node: bchdeco,  Next: bchenco,  Prev: awgn,  Up: Function Reference
2445
24469.1.7 bchdeco
2447-------------
2448
2449 -- Loadable Function: MSG = bchdeco (CODE, K, T)
2450 -- Loadable Function: MSG = bchdeco (CODE, K, T, PRIM)
2451 -- Loadable Function: MSG = bchdeco (..., PARPOS)
2452 -- Loadable Function: [MSG, ERR] = bchdeco (...)
2453 -- Loadable Function: [MSG, ERR, CCODE] = bchdeco (...)
2454     Decodes the coded message CODE using a BCH coder.  The message
2455     length of the coder is defined in variable K, and the error
2456     correction capability of the code is defined in T.
2457
2458     The variable CODE is a binary array with N columns and an arbitrary
2459     number of rows.  Each row of CODE represents a single symbol to be
2460     decoded by the BCH coder.  The decoded message is returned in the
2461     binary array MSG containing K columns and the same number of rows
2462     as CODE.
2463
2464     The use of 'bchdeco' can be seen in the following short example.
2465
2466          m = 3; n = 2^m -1; k = 4; t = 1;
2467          msg = randint (10, k);
2468          code = bchenco (msg, n, k);
2469          noisy = mod (randerr (10,n) + code, 2);
2470          [dec, err] = bchdeco (msg, k, t);
2471
2472     Valid codes can be found using 'bchpoly'.  In general the codeword
2473     length N should be of the form '2^M-1', where m is an integer.
2474     However, shortened BCH codes can be used such that if '[2^M-1,K]'
2475     is a valid code '[2^M-1-X,K-X]' is also a valid code using the same
2476     generator polynomial.
2477
2478     By default the BCH coding is based on the properties of the Galois
2479     Field GF(2^M).  The primitive polynomial used in the Galois can be
2480     overridden by a primitive polynomial in PRIM.  Suitable primitive
2481     polynomials can be constructed with 'primpoly'.  The form of PRIM
2482     maybe be either a integer representation of the primitive
2483     polynomial as given by 'primpoly', or a binary representation that
2484     might be constructed like
2485
2486          m = 3;
2487          prim = de2bi (primpoly (m));
2488
2489     By default the parity symbols are assumed to be placed at the
2490     beginning of the coded message.  The variable PARPOS controls this
2491     positioning and can take the values '"beginning\"' or '\"end\"'.
2492     See also: bchpoly, bchenco, decode, primpoly
2493
2494
2495File: comms.info,  Node: bchenco,  Next: bchpoly,  Prev: bchdeco,  Up: Function Reference
2496
24979.1.8 bchenco
2498-------------
2499
2500 -- Loadable Function: CODE = bchenco (MSG, N, K)
2501 -- Loadable Function: CODE = bchenco (MSG, N, K, G)
2502 -- Loadable Function: CODE = bchenco (..., PARPOS)
2503     Encodes the message MSG using a [N,K] BCH coding.  The variable MSG
2504     is a binary array with K columns and an arbitrary number of rows.
2505     Each row of MSG represents a single symbol to be coded by the BCH
2506     coder.  The coded message is returned in the binary array CODE
2507     containing N columns and the same number of rows as MSG.
2508
2509     The use of 'bchenco' can be seen in the following short example.
2510
2511          m = 3; n = 2^m -1; k = 4;
2512          msg = randint (10,k);
2513          code = bchenco (msg, n, k);
2514
2515     Valid codes can be found using 'bchpoly'.  In general the codeword
2516     length N should be of the form '2^M-1', where m is an integer.
2517     However, shortened BCH codes can be used such that if '[2^M-1,K]'
2518     is a valid code '[2^M-1-X,K-X]' is also a valid code using the same
2519     generator polynomial.
2520
2521     By default the generator polynomial used in the BCH coding is based
2522     on the properties of the Galois Field GF(2^M).  This default
2523     generator polynomial can be overridden by a polynomial in G.
2524     Suitable generator polynomials can be constructed with 'bchpoly'.
2525
2526     By default the parity symbols are placed at the beginning of the
2527     coded message.  The variable PARPOS controls this positioning and
2528     can take the values '"beginning\"' or '\"end\"'.  See also:
2529     bchpoly, bchdeco, encode
2530
2531
2532File: comms.info,  Node: bchpoly,  Next: berconfint,  Prev: bchenco,  Up: Function Reference
2533
25349.1.9 bchpoly
2535-------------
2536
2537 -- Function File: P = bchpoly ()
2538 -- Function File: P = bchpoly (N)
2539 -- Function File: P = bchpoly (N, K)
2540 -- Function File: P = bchpoly (PRIM, K)
2541 -- Function File: P = bchpoly (N, K, PRIM)
2542 -- Function File: P = bchpoly (..., PROBE)
2543 -- Function File: [P, F] = bchpoly (...)
2544 -- Function File: [P, F, C] = bchpoly (...)
2545 -- Function File: [P, F, C, PAR] = bchpoly (...)
2546 -- Function File: [P, F, C, PAR, T] = bchpoly (...)
2547
2548     Calculates the generator polynomials for a BCH coder.  Called with
2549     no input arguments 'bchpoly' returns a list of all of the valid BCH
2550     codes for the codeword length 7, 15, 31, 63, 127, 255 and 511.  A
2551     three column matrix is returned with each row representing a
2552     separate valid BCH code.  The first column is the codeword length,
2553     the second the message length and the third the error correction
2554     capability of the code
2555
2556     Called with a single input argument, 'bchpoly' returns the valid
2557     BCH codes for the specified codeword length N.  The output format
2558     is the same as above
2559
2560     When called with two or more arguments, 'bchpoly' calculates the
2561     generator polynomial of a particular BCH code.  The generator
2562     polynomial is returned in P as a vector representation of a
2563     polynomial in GF(2).  The terms of the polynomial are listed
2564     least-significant term first
2565
2566     The desired BCH code can be specified by its codeword length N and
2567     its message length K.  Alternatively, the primitive polynomial over
2568     which to calculate the polynomial can be specified as PRIM If a
2569     vector representation of the primitive polynomial is given, then
2570     PRIM can be specified as the first argument of two arguments, or as
2571     the third argument.  However, if an integer representation of the
2572     primitive polynomial is used, then the primitive polynomial must be
2573     specified as the third argument
2574
2575     When called with two or more arguments, 'bchpoly' can also return
2576     the factors F of the generator polynomial P, the cyclotomic coset
2577     for the Galois field over which the BCH code is calculated, the
2578     parity check matrix PAR and the error correction capability T.  It
2579     should be noted that the parity check matrix is calculated with
2580     'cyclgen' and limitations in this function means that the parity
2581     check matrix is only available for codeword length up to 63.  For
2582     codeword length longer than this PAR returns an empty matrix
2583
2584     With a string argument PROBE defined, the action of 'bchpoly' is to
2585     calculate the error correcting capability of the BCH code defined
2586     by N, K and PRIM and return it in P.  This is similar to a call to
2587     'bchpoly' with zero or one argument, except that only a single code
2588     is checked.  Any string value for PROBE will force this action
2589
2590     In general the codeword length N can be expressed as '2^M-1', where
2591     M is an integer.  However, if [N,K] is a valid BCH code, then a
2592     shortened BCH code of the form [N-X,K-X] can be created with the
2593     same generator polynomial
2594
2595     See also: cyclpoly, encode, decode, cosets
2596
2597
2598File: comms.info,  Node: berconfint,  Next: bi2de,  Prev: bchpoly,  Up: Function Reference
2599
26009.1.10 berconfint
2601-----------------
2602
2603 -- Function File: BER = berconfint (R, N)
2604 -- Function File: [BER, INTERVAL] = berconfint (R, N)
2605 -- Function File: [BER, INTERVAL] = berconfint (R, N, LEVEL)
2606
2607     Returns Bit Error Rate, BER, and confidence interval, INTERVAL, for
2608     the number of errors R and number of transmitted bits N with a
2609     confidence level of LEVEL.  By default LEVEL is 0.95
2610
2611     The confidence interval is the Wilson one (without continuity
2612     correction) for a proportion.  By contrast, Matlab appears to
2613     return the Clopper–Pearson confidence interval
2614
2615     Reference: Robert G. Newcombe (1998), "Two‐sided confidence
2616     intervals for the single proportion: comparison of seven methods",
2617     Statistics in Medicine 17(8):857-872
2618
2619
2620File: comms.info,  Node: bi2de,  Next: bin2gray,  Prev: berconfint,  Up: Function Reference
2621
26229.1.11 bi2de
2623------------
2624
2625 -- Function File: D = bi2de (B)
2626 -- Function File: D = bi2de (B, F)
2627 -- Function File: D = bi2de (B, P)
2628 -- Function File: D = bi2de (B, P, F)
2629
2630     Convert bit matrix to a vector of integers
2631
2632     Each row of the matrix B is treated as a single integer represented
2633     in binary form.  The elements of B, must therefore be '0' or '1'
2634
2635     If P is defined then it is treated as the base of the decomposition
2636     and the elements of B must then lie between '0' and 'p-1'
2637
2638     The variable F defines whether the first or last element of B is
2639     considered to be the most-significant.  Valid values of F are
2640     "right-msb" or "left-msb".  By default F is "right-msb"
2641
2642     See also: de2bi
2643
2644
2645File: comms.info,  Node: bin2gray,  Next: biterr,  Prev: bi2de,  Up: Function Reference
2646
26479.1.12 bin2gray
2648---------------
2649
2650 -- Function File: [Y, MAPPING] = bin2gray (X, TYPE, M)
2651     Creates a Gray encoded data Y with the same size as input X
2652
2653     Input:
2654        * X Binary matrix data
2655
2656        * TYPE: The modulation type choices available:'qam',
2657          'pam','psk','dpsk', and 'fsk'
2658
2659        * M: The modualtion order must be a power of 2
2660
2661     Output:
2662        * Y: The gray data of the X data
2663        * MAPPING: This provides the gray labesfor the given modulation
2664
2665     Example
2666          y = bin2gray ([0:3], 'qam', 16)
2667          y =
2668
2669              0
2670              1
2671              3
2672              2
2673
2674     Example with matrix
2675          y = bin2gray ([0:3; 12:15], 'qam', 16)
2676          y =
2677
2678              0    1    3    2
2679              8    9   11   10
2680     See also: qammod
2681
2682
2683File: comms.info,  Node: biterr,  Next: bsc,  Prev: bin2gray,  Up: Function Reference
2684
26859.1.13 biterr
2686-------------
2687
2688 -- Function File: [NUM, RATE] = biterr (A, B)
2689 -- Function File: [NUM, RATE] = biterr (..., K)
2690 -- Function File: [NUM, RATE] = biterr (..., FLAG)
2691 -- Function File: [NUM, RATE IND] = biterr (...)
2692
2693     Compares two matrices and returns the number of bit errors and the
2694     bit error rate.  The binary representations of the variables A and
2695     B are treated and A and B can be either:
2696
2697     Both matrices
2698          In this case both matrices must be the same size and then by
2699          default the return values NUM and RATE are the overall number
2700          of bit errors and the overall bit error rate
2701     One column vector
2702          In this case the column vector is used for bit error
2703          comparison column-wise with the matrix.  The returned values
2704          NUM and RATE are then row vectors containing the number of bit
2705          errors and the bit error rate for each of the column-wise
2706          comparisons.  The number of rows in the matrix must be the
2707          same as the length of the column vector
2708     One row vector
2709          In this case the row vector is used for bit error comparison
2710          row-wise with the matrix.  The returned values NUM and RATE
2711          are then column vectors containing the number of bit errors
2712          and the bit error rate for each of the row-wise comparisons.
2713          The number of columns in the matrix must be the same as the
2714          length of the row vector
2715
2716     This behavior can be overridden with the variable FLAG.  FLAG can
2717     take the value "column-wise", "row-wise" or "overall".  A
2718     column-wise comparison is not possible with a row vector and
2719     visa-versa
2720
2721     By default the number of bits in each symbol is assumed to be give
2722     by the number required to represent the maximum value of A and B
2723     The number of bits to represent a symbol can be overridden by the
2724     variable K
2725
2726
2727File: comms.info,  Node: bsc,  Next: comms,  Prev: biterr,  Up: Function Reference
2728
27299.1.14 bsc
2730----------
2731
2732 -- Function File: Y = bsc (DATA, P)
2733     Send DATA into a binary symmetric channel with probability P of
2734     error one each symbol
2735
2736
2737File: comms.info,  Node: comms,  Next: compand,  Prev: bsc,  Up: Function Reference
2738
27399.1.15 comms
2740------------
2741
2742 -- Function File: comms ("help")
2743 -- Function File: comms ("info")
2744 -- Function File: comms ("info", MOD)
2745 -- Function File: comms ("test")
2746 -- Function File: comms ("test", MOD)
2747
2748     Manual and test code for the Octave Communications toolbox.  There
2749     are 5 possible ways to call this function
2750
2751     'comms ("help")'
2752          Display this help message.  Called with no arguments, this
2753          function also displays this help message
2754     'comms ("info")'
2755          Open the Communications toolbox manual
2756     'comms ("info", MOD)'
2757          Open the Communications toolbox manual at the section
2758          specified by MOD
2759     'comms ("test")'
2760          Run all of the test code for the Communications toolbox
2761     'comms ("test", MOD)'
2762          Run only the test code for the Communications toolbox in the
2763          module MOD
2764
2765     Valid values for the variable MOD are
2766
2767     "all"
2768          All of the toolbox
2769     "random"
2770          The random signal generation and analysis package
2771     "source"
2772          The source coding functions of the package
2773     "block"
2774          The block coding functions
2775     "convol"
2776          The convolution coding package
2777     "modulation"
2778          The modulation package
2779     "special"
2780          The special filter functions
2781     "galois"
2782          The Galois fields package
2783
2784     Please note that this function file should be used as an example of
2785     the use of this toolbox
2786
2787
2788File: comms.info,  Node: compand,  Next: conv,  Prev: comms,  Up: Function Reference
2789
27909.1.16 compand
2791--------------
2792
2793 -- Function File: Y = compand (X, MU, V, "mu/compressor")
2794 -- Function File: Y = compand (X, MU, V, "mu/expander")
2795 -- Function File: Y = compand (X, MU, V, "A/compressor")
2796 -- Function File: Y = compand (X, MU, V, "A/expander")
2797
2798     Compresses and expanding the dynamic range of a signal using a
2799     mu-law or or A-law algorithm
2800
2801     The mu-law compressor/expander for reducing the dynamic range, is
2802     used if the fourth argument of 'compand' starts with "mu/".
2803     Whereas the A-law compressor/expander is used if 'compand' starts
2804     with "A/" The mu-law algorithm uses the formulation
2805
2806
2807                  V log (1 + \mu/V |x|)
2808              y = -------------------- sgn(x)
2809                      log (1 + \mu)
2810
2811
2812     while the A-law algorithm used the formulation
2813
2814
2815                  /    A / (1 + log A) x,               0 <= |x| <= V/A
2816                  |
2817              y = <    V ( 1 + log (A/V |x|) )
2818                  |    ----------------------- sgn(x),  V/A < |x| <= V
2819                  \        1 + log A
2820
2821     Neither converts from or to audio file ulaw format.  Use mu2lin or
2822     lin2mu instead
2823
2824     See also: m2ulin, lin2mu
2825
2826
2827File: comms.info,  Node: conv,  Next: convenc,  Prev: compand,  Up: Function Reference
2828
28299.1.17 conv
2830-----------
2831
2832 -- Function File: conv (A, B)
2833     Convolve two Galois vectors
2834
2835     'y = conv (a, b)' returns a vector of length equal to 'length (a) +
2836     length (b) - 1' If A and B are polynomial coefficient vectors,
2837     'conv' returns the coefficients of the product polynomial See also:
2838     deconv
2839
2840
2841File: comms.info,  Node: convenc,  Next: convmtx,  Prev: conv,  Up: Function Reference
2842
28439.1.18 convenc
2844--------------
2845
2846 -- Function File: Y = convenc (MSG, T)
2847 -- Function File: Y = convenc (MSG, T, PUNCT)
2848 -- Function File: Y = convenc (MSG, T, PUNCT, S0)
2849 -- Function File: [Y, STATE_END] = convenc (...)
2850     Encode the binary vector MSG with the convolutional encoder
2851     described by the trellis structure T
2852
2853     The rate k/n convolutional encoder encodes k bits at a time from
2854     the input vector and produces n bits at a time into the output
2855     vector.  The input MSG must have a length that is a multiple of k
2856
2857     If the initial state S0 is specified, it indicates the internal
2858     state of the encoder when the first k input bits are fed in.  The
2859     default value of S0 is 0
2860
2861     The optional output argument STATE_END indicates the internal state
2862     of the encoder after the last bits are encoded.  This allows the
2863     state of the encoder to be saved and applied to the next call to
2864     'convenc' to process data in blocks
2865
2866     See also: poly2trellis
2867
2868
2869File: comms.info,  Node: convmtx,  Next: cosets,  Prev: convenc,  Up: Function Reference
2870
28719.1.19 convmtx
2872--------------
2873
2874 -- Function File: convmtx (A, N)
2875
2876     Create matrix to perform repeated convolutions with the same vector
2877     in a Galois Field.  If A is a column vector and X is a column
2878     vector of length N, in a Galois Field then
2879
2880     'convmtx (A, N) * X'
2881
2882     gives the convolution of of A and X and is the same as 'conv (A,
2883     X)'.  The difference is if many vectors are to be convolved with
2884     the same vector, then this technique is possibly faster
2885
2886     Similarly, if A is a row vector and X is a row vector of length N,
2887     then
2888
2889     'X * convmtx (A, N)'
2890
2891     is the same as 'conv (X, A)' See also: conv
2892
2893
2894File: comms.info,  Node: cosets,  Next: cyclgen,  Prev: convmtx,  Up: Function Reference
2895
28969.1.20 cosets
2897-------------
2898
2899 -- Function File: cosets (M, PRIM)
2900
2901     Finds the elements of GF(2^M) with primitive polynomial PRIM, that
2902     share the same minimum polynomial.  Returns a cell array of the
2903     partitioning of GF(2^M)
2904
2905
2906File: comms.info,  Node: cyclgen,  Next: cyclpoly,  Prev: cosets,  Up: Function Reference
2907
29089.1.21 cyclgen
2909--------------
2910
2911 -- Loadable Function: H = cyclgen (N, P)
2912 -- Loadable Function: H = cyclgen (N, P, TYP)
2913 -- Loadable Function: [H, G] = cyclgen (...)
2914 -- Loadable Function: [H, G, K] = cyclgen (...)
2915     Produce the parity check and generator matrix of a cyclic code.
2916     The parity check matrix is returned as a M by N matrix,
2917     representing the [N,K] cyclic code.  M is the order of the
2918     generator polynomial P and the message length K is given by 'N -
2919     M'.
2920
2921     The generator polynomial can either be a vector of ones and zeros,
2922     and length M representing,
2923
2924          P(1) + P(2) * x + P(3) * x^2 + ... + P(M) * x^(m-1)
2925
2926     The terms of the polynomial are stored least-significant term
2927     first.  Alternatively, P can be an integer representation of the
2928     same polynomial.
2929
2930     The form of the parity check matrix is determined by TYP.  If TYP
2931     is 'system', a systematic parity check matrix is produced.  If TYP
2932     is 'nosys' and non-systematic parity check matrix is produced.
2933
2934     If requested 'cyclgen' also returns the K by N generator matrix G.
2935     See also: hammgen, gen2par, cyclpoly
2936
2937
2938File: comms.info,  Node: cyclpoly,  Next: de2bi,  Prev: cyclgen,  Up: Function Reference
2939
29409.1.22 cyclpoly
2941---------------
2942
2943 -- Loadable Function: Y = cyclpoly (N, K)
2944 -- Loadable Function: Y = cyclpoly (N, K, OPT)
2945 -- Loadable Function: Y = cyclpoly (N, K, OPT, REP)
2946     This function returns the cyclic generator polynomials of the code
2947     [N,K].  By default the polynomial with the smallest weight is
2948     returned.  However this behavior can be overridden with the OPT
2949     flag.  Valid values of OPT are:
2950
2951     '"all\"'
2952          Returns all of the polynomials of the code [N,K]
2953     '\"min\"'
2954          Returns the polynomial of minimum weight of the code [N,K]
2955     '\"max\"'
2956          Returns the polynomial of the maximum weight of the code [N,K]
2957     L
2958          Returns the polynomials having exactly the weight L
2959
2960     The polynomials are returns as row-vectors in the variable Y.  Each
2961     row of Y represents a polynomial with the least-significant term
2962     first.  The polynomials can be returned with an integer
2963     representation if REP is '\"integer\"'.  The default behavior is
2964     given if REP is '\"polynomial\"'.  See also: gf, isprimitive
2965
2966
2967File: comms.info,  Node: de2bi,  Next: decode,  Prev: cyclpoly,  Up: Function Reference
2968
29699.1.23 de2bi
2970------------
2971
2972 -- Function File: B = de2bi (D)
2973 -- Function File: B = de2bi (D, N)
2974 -- Function File: B = de2bi (D, N, P)
2975 -- Function File: B = de2bi (D, ..., F)
2976
2977     Convert a non-negative integer to bit vector
2978
2979     The variable D must be a vector of non-negative integers.  'de2bi'
2980     then returns a matrix where each row represents the binary
2981     representation of elements of D.  If N is defined then the returned
2982     matrix will have N columns.  This number of columns can be either
2983     larger than the minimum needed and zeros will be added to the msb
2984     of the binary representation or smaller than the minimum in which
2985     case the least-significant part of the element is returned
2986
2987     If P is defined then it is used as the base for the decomposition
2988     of the returned values.  That is the elements of the returned value
2989     are between '0' and 'p-1'.  (P must have a value of 2 or higher.)
2990
2991     The variable F defines whether the first or last element of B is
2992     considered to be the most-significant.  Valid values of F are
2993     "right-msb" or "left-msb".  By default F is "right-msb"
2994
2995     See also: bi2de
2996
2997
2998File: comms.info,  Node: decode,  Next: deconv,  Prev: de2bi,  Up: Function Reference
2999
30009.1.24 decode
3001-------------
3002
3003 -- Function File: MSG = decode (CODE, N, K)
3004 -- Function File: MSG = decode (CODE, N, K, TYP)
3005 -- Function File: MSG = decode (CODE, N, K, TYP, OPT1)
3006 -- Function File: MSG = decode (CODE, N, K, TYP, OPT1, OPT2)
3007 -- Function File: [MSG, ERR] = decode (...)
3008 -- Function File: [MSG, ERR, CCODE] = decode (...)
3009 -- Function File: [MSG, ERR, CCODE, CERR] = decode (...)
3010
3011     Top level block decoder.  This function makes use of the lower
3012     level functions such as 'cyclpoly', 'cyclgen', 'hammgen', and
3013     'bchenco'.  The coded message to decode is pass in CODE, the
3014     codeword length is N and the message length is K.  This function is
3015     used to decode messages using either:
3016
3017     A [n,k] linear block code defined by a generator matrix
3018     A [n,k] cyclic code defined by a generator polynomial
3019     A [n,k] Hamming code defined by a primitive polynomial
3020     A [n,k] BCH code code defined by a generator polynomial
3021
3022     The type of coding to use is defined by the variable TYP.  This
3023     variable is a string taking one of the values
3024
3025     '"linear"'
3026     '"linear/binary"'
3027          A linear block code is assumed with the message MSG being in a
3028          binary format.  In this case the argument OPT1 is the
3029          generator matrix, and is required.  Additionally, OPT2
3030          containing the syndrome lookup table (see 'syndtable') can
3031          also be passed
3032     '"cyclic"'
3033     '"cyclic/binary"'
3034          A cyclic code is assumed with the message MSG being in a
3035          binary format.  The generator polynomial to use can be defined
3036          in OPT1 The default generator polynomial to use will be
3037          'cyclpoly (N, K)'.  Additionally, OPT2 containing the syndrome
3038          lookup table (see 'syndtable') can also be passed
3039     '"hamming"'
3040     '"hamming/binary"'
3041          A Hamming code is assumed with the message MSG being in a
3042          binary format.  In this case N must be of an integer of the
3043          form '2^M-1', where M is an integer.  In addition K must be
3044          'N-M'.  The primitive polynomial to use can be defined in
3045          OPT1.  The default primitive polynomial to use is the same as
3046          defined by 'hammgen'.  The variable OPT2 should not be defined
3047     '"bch"'
3048     '"bch/binary"'
3049          A BCH code is assumed with the message MSG being in a binary
3050          format.  The primitive polynomial to use can be defined in
3051          OPT2 The error correction capability of the code can also be
3052          defined in OPT1.  Use the empty matrix [] to let the error
3053          correction capability take the default value
3054
3055     In addition the argument "binary" above can be replaced with
3056     "decimal", in which case the message is assumed to be a decimal
3057     vector, with each value representing a symbol to be coded.  The
3058     binary format can be in two forms
3059
3060     'An X-by-N matrix'
3061          Each row of this matrix represents a symbol to be decoded
3062     'A vector with length divisible by N'
3063          The coded symbols are created from groups of N elements of
3064          this vector
3065
3066     The decoded message is return in MSG.  The number of errors
3067     encountered is returned in ERR.  If the coded message format is
3068     "decimal" or a "binary" matrix, then ERR is a column vector having
3069     a length equal to the number of decoded symbols.  If CODE is a
3070     "binary" vector, then ERR is the same length as MSG and indicated
3071     the number of errors in each symbol.  If the value ERR is positive
3072     it indicates the number of errors corrected in the corresponding
3073     symbol.  A negative value indicates an uncorrectable error.  The
3074     corrected code is returned in CCODE in a similar format to the
3075     coded message MSG.  The variable CERR contains similar data to ERR
3076     for CCODE
3077
3078     It should be noted that all internal calculations are performed in
3079     the binary format.  Therefore for large values of N, it is
3080     preferable to use the binary format to pass the messages to avoid
3081     possible rounding errors.  Additionally, if repeated calls to
3082     'decode' will be performed, it is often faster to create a
3083     generator matrix externally with the functions 'hammgen' or
3084     'cyclgen', rather than let 'decode' recalculate this matrix at each
3085     iteration.  In this case TYP should be "linear".  The exception to
3086     this case is BCH codes, where the required syndrome table is too
3087     large.  The BCH decoder, decodes directly from the polynomial never
3088     explicitly forming the syndrome table
3089
3090     See also: encode, cyclgen, cyclpoly, hammgen, bchdeco, bchpoly,
3091     syndtable
3092
3093
3094File: comms.info,  Node: deconv,  Next: deintrlv,  Prev: decode,  Up: Function Reference
3095
30969.1.25 deconv
3097-------------
3098
3099 -- Function File: deconv (Y, A)
3100     Deconvolve two Galois vectors
3101
3102     '[b, r] = deconv (y, a)' solves for B and R such that 'y = conv (a,
3103     b) + r'
3104
3105     If Y and A are polynomial coefficient vectors, B will contain the
3106     coefficients of the polynomial quotient and R will be a remainder
3107     polynomial of lowest order See also: conv
3108
3109
3110File: comms.info,  Node: deintrlv,  Next: demodmap,  Prev: deconv,  Up: Function Reference
3111
31129.1.26 deintrlv
3113---------------
3114
3115 -- Function File: DEINTRLVD = deintrlv (DATA, ELEMENTS)
3116     Restore elements of DATA according to ELEMENTS See also: intrlv
3117
3118
3119File: comms.info,  Node: demodmap,  Next: det,  Prev: deintrlv,  Up: Function Reference
3120
31219.1.27 demodmap
3122---------------
3123
3124 -- Function File: z = demodmap (Y, FD, FS, "ask", M)
3125 -- Function File: z = demodmap (Y, FD, FS, "fsk", M, TONE)
3126 -- Function File: z = demodmap (Y, FD, FS, "msk")
3127 -- Function File: z = demodmap (Y, FD, FS, "psk", M)
3128 -- Function File: z = demodmap (Y, FD, FS, "qask", M)
3129 -- Function File: z = demodmap (Y, FD, FS, "qask/cir", NSIG, AMP, PHS)
3130 -- Function File: z = demodmap (Y, FD, FS, "qask/arb", INPHASE, QUADR)
3131 -- Function File: z = demodmap (Y, FD, FS, "qask/arb", MAP)
3132 -- Function File: z = demodmap (Y, [FD, OFF], ...)
3133
3134     Demapping of an analog signal to a digital signal.  The function
3135     'demodmap' must have at least three input arguments and one output
3136     argument.  Argument Y is a complex variable representing the analog
3137     signal to be demapped.  The variables FD and FS are the sampling
3138     rate of the of digital signal and the sampling rate of the analog
3139     signal respectively.  It is required that 'FS/FD' is an integer
3140
3141     The available mapping of the digital signal are
3142
3143     "ask"
3144          Amplitude shift keying
3145     "fsk"
3146          Frequency shift keying
3147     "msk"
3148          Minimum shift keying
3149     "psk"
3150          Phase shift keying
3151     "qask"
3152     "qsk"
3153     "qam"
3154          Quadrature amplitude shift keying
3155
3156     In addition the "qask", "qsk" and "qam" method can be modified with
3157     the flags "/cir" or "/arb".  That is "qask/cir" and "qask/arb", etc
3158     are valid methods and give circular- and arbitrary-qask mappings
3159     respectively.  Also the method "fsk" and "msk" can be modified with
3160     the flag "/max", in which case Y is assumed to be a matrix with M
3161     columns, representing the symbol correlations
3162
3163     The variable M is the order of the modulation to use.  By default
3164     this is 2, and in general should be specified
3165
3166     For "qask/cir", the additional arguments are the same as for
3167     'apkconst', and you are referred to 'apkconst' for the definitions
3168     of the additional variables
3169
3170     For "qask/arb", the additional arguments INPHASE and QUADR give the
3171     in-phase and quadrature components of the mapping, in a similar
3172     mapping to the outputs of 'qaskenco' with one argument.  Similar
3173     MAP represents the in-phase and quadrature components of the
3174     mapping as the real and imaginary parts of the variable MAP See
3175     also: modmap, ddemodce, ademodce, apkconst, qaskenco
3176
3177
3178File: comms.info,  Node: det,  Next: dftmtx,  Prev: demodmap,  Up: Function Reference
3179
31809.1.28 det
3181----------
3182
3183 -- Loadable Function: D = det (A)
3184     Compute the determinant of the Galois array A
3185
3186
3187File: comms.info,  Node: dftmtx,  Next: diag,  Prev: det,  Up: Function Reference
3188
31899.1.29 dftmtx
3190-------------
3191
3192 -- Function File: D = dftmtx (A)
3193
3194     Form a matrix, that can be used to perform Fourier transforms in a
3195     Galois Field
3196
3197     Given that A is an element of the Galois Field GF(2^m), and that
3198     the minimum value for K for which 'A ^ K' is equal to one is '2^m -
3199     1', then this function produces a K-by-K matrix representing the
3200     discrete Fourier transform over a Galois Field with respect to A.
3201     The Fourier transform of a column vector is then given by 'dftmtx
3202     (A) * X'
3203
3204     The inverse Fourier transform is given by 'dftmtx (1 / A)'
3205
3206
3207File: comms.info,  Node: diag,  Next: dpcmdeco,  Prev: dftmtx,  Up: Function Reference
3208
32099.1.30 diag
3210-----------
3211
3212 -- Loadable Function: diag (V, K)
3213     Return a diagonal matrix with Galois vector V on diagonal K The
3214     second argument is optional.  If it is positive, the vector is
3215     placed on the K-th super-diagonal.  If it is negative, it is placed
3216     on the -K-th sub-diagonal.  The default value of K is 0, and the
3217     vector is placed on the main diagonal.  For example,
3218
3219          diag (gf ([1, 2, 3], 2), 1)
3220          ans =
3221          GF(2^2) array. Primitive Polynomial = D^2+D+1 (decimal 7)
3222
3223          Array elements =
3224
3225             0   1   0   0
3226             0   0   2   0
3227             0   0   0   3
3228             0   0   0   0
3229
3230
3231
3232File: comms.info,  Node: dpcmdeco,  Next: dpcmenco,  Prev: diag,  Up: Function Reference
3233
32349.1.31 dpcmdeco
3235---------------
3236
3237 -- Function File: SIG = dpcmdeco (INDX, CODEBOOK, PREDICTOR)
3238     Decode using differential pulse code modulation (DPCM)
3239
3240     'sig = dpcmdeco (indx, codebook, predictor)'
3241          Decode the signal coded by DPCM Use the prediction model and
3242          the coded prediction error given by a codebook and the index
3243          of each sample in this codebook
3244
3245     See also: dpcmenco, dpcmopt
3246
3247
3248File: comms.info,  Node: dpcmenco,  Next: dpcmopt,  Prev: dpcmdeco,  Up: Function Reference
3249
32509.1.32 dpcmenco
3251---------------
3252
3253 -- Function File: QIDX = dpcmenco (SIG, CODEBOOK, PARTITION, PREDICTOR)
3254 -- Function File: [QIDX, Q] = dpcmenco (SIG, CODEBOOK, PARTITION,
3255          PREDICTOR)
3256 -- Function File: [QIDX, Q, D] = dpcmenco (...)
3257     Encode using differential pulse code modulation (DPCM)
3258
3259     'qidx = dpcmenco (sig, codebook, partition, predictor)'
3260          Determine position of the prediction error in a strictly
3261          monotonic table (partition) The predictor vector describes a
3262          m-th order prediction for the output according to the
3263          following equation y(k) = p(1)sig(k-1) + p(2)sig(k-2) + ...  +
3264          p(m-1)sig(k-m+1) + p(m)sig(k-m) , where the predictor vector
3265          is given by predictor = [0, p(1), p(2), p(3),..., p(m-1),
3266          p(m)]
3267
3268     '[qidx, q] = dpcmenco (sig, codebook, partition, predictor)'
3269          Also return the quantized values
3270
3271     '[qidx, q, d] = dpcmenco (...)'
3272          Also compute distortion: mean squared distance of original sig
3273          from the corresponding quantized values
3274
3275     See also: dpcmdeco, dpcmopt, quantiz
3276
3277
3278File: comms.info,  Node: dpcmopt,  Next: egolaydec,  Prev: dpcmenco,  Up: Function Reference
3279
32809.1.33 dpcmopt
3281--------------
3282
3283 -- Function File: PREDICTOR = dpcmopt (TRAINING_SET, ORD)
3284 -- Function File: [PREDICTOR, PARTITION, CODEBOOK] = dpcmopt
3285          (TRAINING_SET, ORD, CB)
3286     Optimize the DPCM parameters and codebook
3287
3288     It uses the Levinson-Durbin algorithm to find the all-pole IIR
3289     filter using the autocorrelation sequence.  After the best
3290     predictor is found, it uses the Lloyds algorithm to find the best
3291     codebook and partition for the interval
3292
3293     'predictor = dpcmopt (training_set, ord)'
3294          Optimize the DPCM parameters using the Levinson-Durbin
3295          algorithm The predictor vector describes a m-th order
3296          prediction for the output according to the following equation
3297          y(k) = p(1)sig(k-1) + p(2)sig(k-2) + ...  + p(m-1)sig(k-m+1) +
3298          p(m)sig(k-m) where the predictor vector is given by predictor
3299          = [0, p(1), p(2), p(3),..., p(m-1), p(m)]
3300
3301          training_set is the training data used to find the best
3302          predictor
3303
3304          ord is the order of the desired prediction model
3305
3306     '[predictor, partition, codebook] = dpcmopt (training_set,ord,cb)'
3307          Optimize the DPCM parameters and also uses the Lloyds
3308          algorithm to find the best codebook and partition for the
3309          given training signal
3310
3311          cb might be the initial codebook used by Lloyds algorithm or
3312          the length of the desired codebook
3313
3314     See also: dpcmenco, dpcmdeco, levinson, lloyds
3315
3316
3317File: comms.info,  Node: egolaydec,  Next: egolayenc,  Prev: dpcmopt,  Up: Function Reference
3318
33199.1.34 egolaydec
3320----------------
3321
3322 -- Function File: [C, ERR] = egolaydec (R)
3323     Decode Extended Golay code
3324
3325     Given R, the received Extended Golay code, this function tries to
3326     decode it using the Extended Golay code parity check matrix
3327     Extended Golay code (24,12) which can correct up to 3 errors
3328
3329     The received code R, needs to be of length Nx24, for encoding.  We
3330     can decode several codes at once, if they are stacked as a matrix
3331     of 24 columns, each code in a separate row
3332
3333     The generator used in here is same as obtained from the function
3334     'egolaygen'
3335
3336     The function returns C, the error-corrected code word from the
3337     received word.  If decoding failed, ERR value is 1, otherwise it is
3338     0
3339
3340     Extended Golay code (24,12) which can correct up to 3 errors.
3341     Decoding algorithm follows from Lin & Costello
3342
3343     Ref: Lin & Costello, pg 128, Ch4, "Error Control Coding", 2nd ed,
3344     Pearson
3345
3346          msg = rand (10, 12) > 0.5;
3347          c1 = egolayenc (msg);
3348          c1(:,1) = mod (c1(:,1) + 1, 2)
3349          c2 = egolaydec (c1)
3350
3351     See also: egolaygen, egolayenc
3352
3353
3354File: comms.info,  Node: egolayenc,  Next: egolaygen,  Prev: egolaydec,  Up: Function Reference
3355
33569.1.35 egolayenc
3357----------------
3358
3359 -- Function File: C = egolayenc (M)
3360     Encode with Extended Golay code
3361
3362     The message M, needs to be of size Nx12, for encoding We can encode
3363     several messages, into codes at once, if they are stacked in the
3364     order suggested
3365
3366     The generator used in here is same as obtained from the function
3367     'egolaygen'.  Extended Golay code (24,12) which can correct up to 3
3368     errors
3369
3370          msg = rand (10, 12) > 0.5;
3371          c = egolayenc (msg)
3372
3373     See also: egolaygen, egolaydec
3374
3375
3376File: comms.info,  Node: egolaygen,  Next: encode,  Prev: egolayenc,  Up: Function Reference
3377
33789.1.36 egolaygen
3379----------------
3380
3381 -- Function File: [G, P] = egolaygen ()
3382     Extended Golay code generator matrix
3383
3384     Returns G, the Extended Golay code (24,12) generator matrix, which
3385     can correct up to 3 errors.  P is the parity check matrix, for this
3386     code
3387
3388     See also: egolaydec, egolayenc
3389
3390
3391File: comms.info,  Node: encode,  Next: exp,  Prev: egolaygen,  Up: Function Reference
3392
33939.1.37 encode
3394-------------
3395
3396 -- Function File: CODE = encode (MSG, N, K)
3397 -- Function File: CODE = encode (MSG, N, K, TYP)
3398 -- Function File: CODE = encode (MSG, N, K, TYP, OPT)
3399 -- Function File: [CODE, ADDED] = encode (...)
3400
3401     Top level block encoder.  This function makes use of the lower
3402     level functions such as 'cyclpoly', 'cyclgen', 'hammgen', and
3403     'bchenco'.  The message to code is pass in MSG, the codeword length
3404     is N and the message length is K.  This function is used to encode
3405     messages using either:
3406
3407     A [n,k] linear block code defined by a generator matrix
3408     A [n,k] cyclic code defined by a generator polynomial
3409     A [n,k] Hamming code defined by a primitive polynomial
3410     A [n,k] BCH code code defined by a generator polynomial
3411
3412     The type of coding to use is defined by the variable TYP.  This
3413     variable is a string taking one of the values
3414
3415     '"linear"'
3416     '"linear/binary"'
3417          A linear block code is assumed with the coded message CODE
3418          being in a binary format.  In this case the argument OPT is
3419          the generator matrix, and is required
3420     '"cyclic"'
3421     '"cyclic/binary"'
3422          A cyclic code is assumed with the coded message CODE being in
3423          a binary format.  The generator polynomial to use can be
3424          defined in OPT The default generator polynomial to use will be
3425          'cyclpoly (N, K)'
3426     '"hamming"'
3427     '"hamming/binary"'
3428          A Hamming code is assumed with the coded message CODE being in
3429          a binary format.  In this case N must be of an integer of the
3430          form '2^M-1', where M is an integer.  In addition K must be
3431          'N-M'.  The primitive polynomial to use can be defined in OPT.
3432          The default primitive polynomial to use is the same as defined
3433          by 'hammgen'
3434     '"bch"'
3435     '"bch/binary"'
3436          A BCH code is assumed with the coded message CODE being in a
3437          binary format.  The generator polynomial to use can be defined
3438          in OPT The default generator polynomial to use will be
3439          'bchpoly (N, K)'
3440
3441     In addition the argument "binary" above can be replaced with
3442     "decimal", in which case the message is assumed to be a decimal
3443     vector, with each value representing a symbol to be coded.  The
3444     binary format can be in two forms
3445
3446     'An X-by-K matrix'
3447          Each row of this matrix represents a symbol to be coded
3448     'A vector'
3449          The symbols are created from groups of K elements of this
3450          vector If the vector length is not divisible by K, then zeros
3451          are added and the number of zeros added is returned in ADDED
3452
3453     It should be noted that all internal calculations are performed in
3454     the binary format.  Therefore for large values of N, it is
3455     preferable to use the binary format to pass the messages to avoid
3456     possible rounding errors.  Additionally, if repeated calls to
3457     'encode' will be performed, it is often faster to create a
3458     generator matrix externally with the functions 'hammgen' or
3459     'cyclgen', rather than let 'encode' recalculate this matrix at each
3460     iteration.  In this case TYP should be "linear".  The exception to
3461     this case is BCH codes, whose encoder is implemented directly from
3462     the polynomial and is significantly faster
3463
3464     See also: decode, cyclgen, cyclpoly, hammgen, bchenco, bchpoly
3465
3466
3467File: comms.info,  Node: exp,  Next: eyediagram,  Prev: encode,  Up: Function Reference
3468
34699.1.38 exp
3470----------
3471
3472 -- Loadable Function: exp (X)
3473     Compute the anti-logarithm for each element of X for a Galois array
3474
3475
3476File: comms.info,  Node: eyediagram,  Next: fft,  Prev: exp,  Up: Function Reference
3477
34789.1.39 eyediagram
3479-----------------
3480
3481 -- Function File: eyediagram (X, N)
3482 -- Function File: eyediagram (X, N, PER)
3483 -- Function File: eyediagram (X, N, PER, OFF)
3484 -- Function File: eyediagram (X, N, PER, OFF, STR)
3485 -- Function File: eyediagram (X, N, PER, OFF, STR, H)
3486 -- Function File: H = eyediagram (...)
3487
3488     Plot the eye-diagram of a signal.  The signal X can be either in
3489     one of three forms
3490
3491     A real vector
3492          In this case the signal is assumed to be real and represented
3493          by the vector X.  A single eye-diagram representing this
3494          signal is plotted
3495     A complex vector
3496          In this case the in-phase and quadrature components of the
3497          signal are plotted separately
3498     A matrix with two columns
3499          In this case the first column represents the in-phase and the
3500          second the quadrature components of a complex signal
3501
3502     Each line of the eye-diagram has N elements and the period is
3503     assumed to be given by PER.  The time axis is then [-PER/2 PER/2]
3504     By default PER is 1
3505
3506     By default the signal is assumed to start at -PER/2.  This can be
3507     overridden by the OFF variable, which gives the number of samples
3508     to delay the signal
3509
3510     The string STR is a plot style string (example "r+"), and by
3511     default is the default gnuplot line style
3512
3513     The figure handle to use can be defined by H.  If H is not given,
3514     then the next available figure handle is used.  The figure handle
3515     used in returned on HOUT See also: scatterplot
3516
3517
3518File: comms.info,  Node: fft,  Next: fibodeco,  Prev: eyediagram,  Up: Function Reference
3519
35209.1.40 fft
3521----------
3522
3523 -- Function File: fft (X)
3524
3525     If X is a column vector, finds the FFT over the primitive element
3526     of the Galois Field of X.  If X is in the Galois Field GF(2^M),
3527     then X must have '2^M - 1' elements
3528
3529
3530File: comms.info,  Node: fibodeco,  Next: fiboenco,  Prev: fft,  Up: Function Reference
3531
35329.1.41 fibodeco
3533---------------
3534
3535 -- Function File: fibodeco (CODE)
3536
3537     Returns the decoded Fibonacci value from the binary vectors CODE
3538     Universal codes like Fibonacci codes have a useful synchronization
3539     property, only for 255 maximum value we have designed these
3540     routines.  We assume user has partitioned the code into several
3541     unique segments based on the suffix property of unique strings "11"
3542     and we just decode the parts.  Partitioning the stream is as simple
3543     as identifying the "11" pairs that occur, at the terminating ends.
3544     This system implements the standard binary Fibonacci codes, which
3545     means that row vectors can only contain 0 or 1.  Ref:
3546     <http://en.wikipedia.org/wiki/Fibonacci_coding>
3547
3548          fibodeco ({[0 1 0 0 1 1]})
3549              => 10
3550          fibodeco ({[1 1], [0 1 1], [0 0 1 1], [1 0 1 1]})
3551              => [1, 2, 3, 4]
3552     See also: fiboenco
3553
3554
3555File: comms.info,  Node: fiboenco,  Next: fibosplitstream,  Prev: fibodeco,  Up: Function Reference
3556
35579.1.42 fiboenco
3558---------------
3559
3560 -- Function File: fiboenco (NUM)
3561
3562     Returns the cell-array of encoded Fibonacci value from the column
3563     vectors NUM Universal codes like Fibonacci codes have a useful
3564     synchronization property, only for 255 maximum value we have
3565     designed these routines.  We assume user has partitioned the code
3566     into several unique segments based on the suffix property of unique
3567     elements [1 1] and we just decode the parts.  Partitioning the
3568     stream is as simple as identifying the [1 1] pairs that occur, at
3569     the terminating ends.  This system implements the standard binary
3570     Fibonacci codes, which means that row vectors can only contain 0 or
3571     1.  Ref: http://en.wikipedia.org/wiki/Fibonacci_coding Ugly
3572     O(k.N^2) encoder.Ref: Wikipedia article accessed March, 2006
3573     <http://en.wikipedia.org/wiki/Fibonacci_coding>, UCI Data
3574     Compression Book, <http://www.ics.uci.edu/~dan/pubs/DC-Sec3.html>,
3575     (accessed October 2006)
3576
3577          fiboenco (10)
3578              => {[ 0 1 0 0 1 1]}
3579          fiboenco (1:4)
3580              => {[1 1], [0 1 1], [0 0 1 1], [1 0 1 1]}
3581     See also: fibodeco
3582
3583
3584File: comms.info,  Node: fibosplitstream,  Next: filter,  Prev: fiboenco,  Up: Function Reference
3585
35869.1.43 fibosplitstream
3587----------------------
3588
3589 -- Function File: fibosplitstream (CODE)
3590
3591     Returns the split data stream at the word boundaries Assuming the
3592     stream was originally encoded using 'fiboenco' and this routine
3593     splits the stream at the points where "11" occur together & gives
3594     us the code-words which can later be decoded from the 'fibodeco'
3595     This however doesn't mean that we intend to verify if all the
3596     codewords are correct, and in fact the last symbol in the return
3597     list can or can not be a valid codeword
3598
3599     A example use of 'fibosplitstream' would be
3600          fibodeco (fibosplitstream ([fiboenco(randint (1, 100, [0, 255])){:}]))
3601          fibodeco (fibosplitstream ([fiboenco(1:10){:}]))
3602     See also: fiboenco, fibodeco
3603
3604
3605File: comms.info,  Node: filter,  Next: finddelay,  Prev: fibosplitstream,  Up: Function Reference
3606
36079.1.44 filter
3608-------------
3609
3610 -- Loadable Function: y = filter (B, A, X)
3611 -- Loadable Function: [Y, SF] = filter (B, A, X, SI)
3612
3613     Digital filtering of vectors in a Galois Field.  Returns the
3614     solution to the following linear, time-invariant difference
3615     equation over a Galois Field:
3616
3617             N                   M
3618            SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k)      for 1<=n<=length(x)
3619            k=0                 k=0
3620
3621     where N=length(a)-1 and M=length(b)-1 An equivalent form of this
3622     equation is:
3623
3624                      N                   M
3625            y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k)  for 1<=n<=length(x)
3626                     k=1                 k=0
3627
3628     where c = a/a(1) and d = b/a(1)
3629
3630     If the fourth argument SI is provided, it is taken as the initial
3631     state of the system and the final state is returned as SF.  The
3632     state vector is a column vector whose length is equal to the length
3633     of the longest coefficient vector minus one If SI is not supplied,
3634     the initial state vector is set to all zeros
3635
3636
3637File: comms.info,  Node: finddelay,  Next: fmdemod,  Prev: filter,  Up: Function Reference
3638
36399.1.45 finddelay
3640----------------
3641
3642 -- Function File: D = finddelay (X, Y)
3643     Estimate the delay between times series X and time series Y by
3644     correlating and finding the peak.  The index of the peak
3645     correlation is returned in D
3646
3647     Inputs:
3648          X, Y: signals
3649
3650     Output:
3651          D: The delay between the two signals
3652
3653     Example:
3654          x = [0, 0, 1, 2, 3];
3655          y = [1, 2, 3];
3656          d = finddelay (x, y)
3657          d = -2
3658     See also: xcorr
3659
3660
3661File: comms.info,  Node: fmdemod,  Next: fmmod,  Prev: finddelay,  Up: Function Reference
3662
36639.1.46 fmdemod
3664--------------
3665
3666 -- Function File: M = fmdemod (S, FC, FS)
3667     Creates the FM demodulation of the signal S sampled at frequency FS
3668     with carrier frequency FC
3669
3670     Inputs:
3671        * S: FM modulated signal
3672
3673        * FC: carrier frequency
3674
3675        * FS: sampling frequency
3676
3677     Output:
3678          M: FM demodulation of the signal
3679
3680     See also: ammod, amdemod, fmmod
3681
3682
3683File: comms.info,  Node: fmmod,  Next: gen2par,  Prev: fmdemod,  Up: Function Reference
3684
36859.1.47 fmmod
3686------------
3687
3688 -- Function File: S = fmmod (M, FC, FS, FREQDEV)
3689     Creates the FM modulation S of the message signal M with carrier
3690     frequency FC
3691
3692     Inputs:
3693        * M: sinusoidal message signal
3694
3695        * FC: carrier frequency
3696
3697        * FS: sampling frequency
3698
3699        * FREQDEV: maximum absolute frequency deviation, assuming M is
3700          in [-1:1]
3701
3702     Output:
3703          S: The FM modulation of M
3704
3705     Demo
3706          demo fmmod
3707     See also: ammod, fmdemod, amdemod
3708
3709
3710File: comms.info,  Node: gen2par,  Next: genqamdemod,  Prev: fmmod,  Up: Function Reference
3711
37129.1.48 gen2par
3713--------------
3714
3715 -- Function File: PAR = gen2par (GEN)
3716 -- Function File: GEN = gen2par (PAR)
3717
3718     Converts binary generator matrix GEN to the parity check matrix PAR
3719     and visa-versa.  The input matrix must be in standard form That is
3720     a generator matrix must be k-by-n and in the form [eye(k) P] or [P
3721     eye(k)], and the parity matrix must be (n-k)-by-n and of the form
3722     [eye(n-k) P'] or [P' eye(n-k)]
3723
3724     See also: cyclgen, hammgen
3725
3726
3727File: comms.info,  Node: genqamdemod,  Next: genqammod,  Prev: gen2par,  Up: Function Reference
3728
37299.1.49 genqamdemod
3730------------------
3731
3732 -- Loadable Function: Y = genqamdemod (X, C)
3733     General quadrature amplitude demodulation.  The complex envelope
3734     quadrature amplitude modulated signal X is demodulated using a
3735     constellation mapping specified by the 1D vector C.
3736
3737
3738File: comms.info,  Node: genqammod,  Next: gf,  Prev: genqamdemod,  Up: Function Reference
3739
37409.1.50 genqammod
3741----------------
3742
3743 -- Function File: Y = genqammod (X, C)
3744
3745     Modulates an information sequence of integers X in the range '[0
3746     ... M-1]' onto a quadrature amplitude modulated signal Y, where 'M
3747     = length (c) - 1' and C is a 1D vector specifying the signal
3748     constellation mapping to be used.  An example of combined 4PAM-4PSK
3749     is
3750
3751          d = randint (1, 1e4, 8);
3752          c = [1+j -1+j -1-j 1-j 1+sqrt(3) j*(1+sqrt(3)) -1-sqrt(3) -j*(1+sqrt(3))];
3753          y = genqammod (d, c);
3754          z = awgn (y, 20);
3755          plot (z, "rx")
3756     See also: genqamdemod
3757
3758
3759File: comms.info,  Node: gf,  Next: gftable,  Prev: genqammod,  Up: Function Reference
3760
37619.1.51 gf
3762---------
3763
3764#endif "-*- texinfo -*- \
3765
3766
3767File: comms.info,  Node: gftable,  Next: gfweight,  Prev: gf,  Up: Function Reference
3768
37699.1.52 gftable
3770--------------
3771
3772 -- Function File: gftable (M, PRIMPOLY)
3773
3774     This function exists for compatibility with matlab.  As the Octave
3775     Galois fields store a copy of the lookup tables for every field in
3776     use internally, there is no need to use this function
3777
3778     See also: gf
3779
3780
3781File: comms.info,  Node: gfweight,  Next: golombdeco,  Prev: gftable,  Up: Function Reference
3782
37839.1.53 gfweight
3784---------------
3785
3786 -- Function File: W = gfweight (GEN)
3787 -- Function File: W = gfweight (GEN, "gen")
3788 -- Function File: W = gfweight (PAR, "par")
3789 -- Function File: W = gfweight (P, n)
3790
3791     Calculate the minimum weight or distance of a linear block code.
3792     The code can be either defined by its generator or parity check
3793     matrix, or its generator polynomial.  By default if the first
3794     argument is a matrix, it is assumed to be the generator matrix of
3795     the code.  The type of the matrix can be defined by a flag "gen"
3796     for the generator matrix or "par" for the parity check matrix
3797
3798     If the first argument is a vector, it is assumed that it defines
3799     the generator polynomial of the code.  In this case a second
3800     argument is required that defines the codeword length
3801
3802     See also: hammgen, cyclpoly, bchpoly
3803
3804
3805File: comms.info,  Node: golombdeco,  Next: golombenco,  Prev: gfweight,  Up: Function Reference
3806
38079.1.54 golombdeco
3808-----------------
3809
3810 -- Function File: golombdeco (CODE, M)
3811
3812     Returns the Golomb decoded signal vector using CODE and M
3813     Compulsory m is need to be specified.  A restrictions is that a
3814     signal set must strictly be non-negative.  The value of code is a
3815     cell array of row-vectors which have the encoded Golomb value for a
3816     single sample.  The Golomb algorithm is used to encode the "code"
3817     and only that can be meaningfully decoded.  CODE is assumed to have
3818     been of format generated by the function 'golombenco'.  Also the
3819     parameter M need to be a non-zero number, unless which it makes
3820     divide-by-zero errors This function works backward the Golomb
3821     algorithm see 'golombenco' for more details on that Reference:
3822     Solomon Golomb, Run length Encodings, 1966 IEEE Trans Info Theory
3823
3824     An example of the use of 'golombdeco' is
3825          golombdeco (golombenco (1:4, 2), 2)
3826              => [1 2 3 4]
3827     See also: golombenco
3828
3829
3830File: comms.info,  Node: golombenco,  Next: hammgen,  Prev: golombdeco,  Up: Function Reference
3831
38329.1.55 golombenco
3833-----------------
3834
3835 -- Function File: golombenco (SIG, M)
3836
3837     Returns the Golomb coded signal as cell array Also total length of
3838     output code in bits can be obtained This function uses a M need to
3839     be supplied for encoding signal vector into a Golomb coded vector.
3840     A restrictions is that a signal set must strictly be non-negative.
3841     Also the parameter M need to be a non-zero number, unless which it
3842     makes divide-by-zero errors The Golomb algorithm [1], is used to
3843     encode the data into unary coded quotient part which is represented
3844     as a set of 1's separated from the K-part (binary) using a zero.
3845     This scheme doesn't need any kind of dictionaries, it is a
3846     parameterized prefix codes Implementation is close to O(N^2), but
3847     this implementation *may be* sluggish, though correct.  Details of
3848     the scheme are, to encode the remainder(r of number N) using the
3849     floor(log2(m)) bits when rem is in range 0:(2^ceil(log2(m)) - N),
3850     and encode it as r+(2^ceil(log2(m)) - N), using total of
3851     2^ceil(log2(m)) bits in other instance it doesn't belong to case 1.
3852     Quotient is coded simply just using the unary code.  Also according
3853     to [2] Golomb codes are optimal for sequences using the Bernoulli
3854     probability model: P(n)=p^n-1.q & p+q=1, and when M=[1/log2(p)], or
3855     P=2^(1/M)
3856
3857     Reference: 1.  Solomon Golomb, Run length Encodings, 1966 IEEE
3858     Trans Info' Theory.  2.  Khalid Sayood, Data Compression, 3rd
3859     Edition
3860
3861     An example of the use of 'golombenco' is
3862          golombenco (1:4, 2)
3863              => {[0 1], [1 0 0], [1 0 1], [1 1 0 0]}
3864          golombenco (1:10, 2)
3865              => {[0 1], [1 0 0], [1 0 1], [1 1 0 0],
3866                  [1 1 0 1], [1 1 1 0 0], [1 1 1 0 1], [1 1 1 1 0 0],
3867                  [1 1 1 1 0 1], [1 1 1 1 1 0 0]}
3868     See also: golombdeco
3869
3870
3871File: comms.info,  Node: hammgen,  Next: helscanintrlv,  Prev: golombenco,  Up: Function Reference
3872
38739.1.56 hammgen
3874--------------
3875
3876 -- Function File: H = hammgen (M)
3877 -- Function File: H = hammgen (M, P)
3878 -- Function File: [H, G] = hammgen (...)
3879 -- Function File: [H, G, N, K] = hammgen (...)
3880
3881     Produce the parity check and generator matrices of a Hamming code.
3882     The variable M defines the [N,K] Hamming code where 'N = 2 ^ M - 1'
3883     and 'K = N - M' M must be between 3 and 16
3884
3885     The parity check matrix is generated relative to the primitive
3886     polynomial of GF(2^M).  If P is specified the default primitive
3887     polynomial of GF(2^M) is overridden.  P must be a valid primitive
3888     polynomial of the correct order for GF(2^M)
3889
3890     The parity check matrix is returned in the M by N matrix H, and if
3891     requested the generator matrix is returned in the K by N matrix G
3892
3893     See also: gen2par
3894
3895
3896File: comms.info,  Node: helscanintrlv,  Next: huffmandeco,  Prev: hammgen,  Up: Function Reference
3897
38989.1.57 helscanintrlv
3899--------------------
3900
3901 -- Function File: OUTDATA = helscanintrlv (DATA, NROWS, NCOLS, NSHIFT)
3902     NROWS-by-NCOLS See also: helscandeintrlv
3903
3904
3905File: comms.info,  Node: huffmandeco,  Next: huffmandict,  Prev: helscanintrlv,  Up: Function Reference
3906
39079.1.58 huffmandeco
3908------------------
3909
3910 -- Function File: SIG = huffmandeco (HCODE, DICT)
3911     Decode signal encoded by 'huffmanenco'
3912
3913     This function uses a dict built from the 'huffmandict' and uses it
3914     to decode a signal list into a Huffman list.  A restriction is that
3915     HCODE is expected to be a binary code
3916
3917     The returned SIG set that strictly belongs in the range '[1,N]'
3918     with 'N = length (DICT)'.  Also DICT can only be from the
3919     'huffmandict' routine.  Whenever decoding fails, those signal
3920     values a re indicated by '-1', and we successively try to restart
3921     decoding from the next bit that hasn't failed in decoding,
3922     ad-infinitum.  An example of the use of 'huffmandeco' is:
3923
3924          hd    = huffmandict (1:4, [0.5 0.25 0.15 0.10]);
3925          hcode = huffmanenco (1:4, hd);
3926          back  = huffmandeco (hcode, hd)
3927              => [1 2 3 4]
3928     See also: huffmandict, huffmanenco
3929
3930
3931File: comms.info,  Node: huffmandict,  Next: huffmanenco,  Prev: huffmandeco,  Up: Function Reference
3932
39339.1.59 huffmandict
3934------------------
3935
3936 -- Function File: huffmandict (SYMB, PROB)
3937 -- Function File: huffmandict (SYMB, PROB, TOGGLE)
3938 -- Function File: huffmandict (SYMB, PROB, TOGGLE, MINVAR)
3939
3940     Builds a Huffman code, given a probability list.  The Huffman codes
3941     per symbol are output as a list of strings-per-source symbol.  A
3942     zero probability symbol is NOT assigned any codeword as this symbol
3943     doesn't occur in practice anyway
3944
3945     TOGGLE is an optional argument with values 1 or 0, that starts
3946     building a code based on 1s or 0s, defaulting to 0.  Also MINVAR is
3947     a boolean value that is useful in choosing if you want to optimize
3948     buffer for transmission in the applications of Huffman coding,
3949     however it doesn't affect the type or average codeword length of
3950     the generated code.  An example of the use of 'huffmandict' is
3951
3952          huffmandict (symbols, [0.5 0.25 0.15 0.1], 1)
3953              => {[0], [1 0], [1 1 1], [1 1 0]}
3954          huffmandict (symbols, 0.25 * ones (1,4), 1)
3955              => {[1 1], [1 0], [0 1], [0 0]}
3956
3957          prob = [0.5 0 0.25 0.15 0.1];
3958          dict = huffmandict (1:5, prob, 1);
3959          entropy (prob)
3960              => 2.3219
3961          laverage (dict, prob)
3962              => 1.8500
3963
3964          x = [0.2 0.4 0.2 0.1 0.1];
3965          huffmandict (1, x, 0, true)
3966              => {[1 0], [0 0], [1 1], [0 1 0], [0 1 1]}
3967          huffmandict (1, x)
3968              => {[0 1], [1], [0 0 1], [0 0 0 0], [0 0 0 1]}
3969
3970     Reference: Dr.Rao's course EE5351 Digital Video Coding, at
3971     UT-Arlington See also: huffmandeco, huffmanenco
3972
3973
3974File: comms.info,  Node: huffmanenco,  Next: ifft,  Prev: huffmandict,  Up: Function Reference
3975
39769.1.60 huffmanenco
3977------------------
3978
3979 -- Function File: huffmanenco (SIG, DICT)
3980
3981     Returns the Huffman encoded signal using DICT.  This function uses
3982     a DICT built from the 'huffmandict' and uses it to encode a signal
3983     list into a Huffman list.  A restrictions is that a signal set must
3984     strictly belong in the range '[1,N]' with 'N = length (dict)' Also
3985     DICT can only be from the 'huffmandict' routine An example of the
3986     use of 'huffmanenco' is
3987
3988          hd = huffmandict (1:4, [0.5 0.25 0.15 0.10]);
3989          huffmanenco (1:4, hd)
3990              => [1 0 1 0 0 0 0 0 1]
3991     See also: huffmandict, huffmandeco
3992
3993
3994File: comms.info,  Node: ifft,  Next: intrlv,  Prev: huffmanenco,  Up: Function Reference
3995
39969.1.61 ifft
3997-----------
3998
3999 -- Function File: ifft (X)
4000
4001     If X is a column vector, finds the IFFT over the primitive element
4002     of the Galois Field of X.  If X is in the Galois Field GF(2^M),
4003     then X must have '2^M - 1' elements See also: ifft
4004
4005
4006File: comms.info,  Node: intrlv,  Next: inv,  Prev: ifft,  Up: Function Reference
4007
40089.1.62 intrlv
4009-------------
4010
4011 -- Function File: INTRLVD = intrlv (DATA, ELEMENTS)
4012     Interleaved elements of DATA according to ELEMENTS See also:
4013     deintrlv
4014
4015
4016File: comms.info,  Node: inv,  Next: inverse,  Prev: intrlv,  Up: Function Reference
4017
40189.1.63 inv
4019----------
4020
4021 -- Loadable Function: [X, RCOND] = inv (A)
4022     Compute the inverse of the square matrix A.  Return an estimate of
4023     the reciprocal condition number if requested, otherwise warn of an
4024     ill-conditioned matrix if the reciprocal condition number is small
4025
4026
4027File: comms.info,  Node: inverse,  Next: isequal,  Prev: inv,  Up: Function Reference
4028
40299.1.64 inverse
4030--------------
4031
4032 -- Loadable Function: [X, RCOND] = inverse (A)
4033     See inv
4034
4035
4036File: comms.info,  Node: isequal,  Next: isgalois,  Prev: inverse,  Up: Function Reference
4037
40389.1.65 isequal
4039--------------
4040
4041 -- Function File: isequal (X1, X2, ...)
4042     Return true if all of X1, X2, ... are equal See also:
4043     isequalwithequalnans
4044
4045
4046File: comms.info,  Node: isgalois,  Next: isprimitive,  Prev: isequal,  Up: Function Reference
4047
40489.1.66 isgalois
4049---------------
4050
4051 -- Loadable Function: isgalois (EXPR)
4052     Return 1 if the value of the expression EXPR is a Galois Field.
4053
4054
4055File: comms.info,  Node: isprimitive,  Next: istrellis,  Prev: isgalois,  Up: Function Reference
4056
40579.1.67 isprimitive
4058------------------
4059
4060 -- Loadable Function: Y = isprimitive (A)
4061     Returns 1 is the polynomial represented by A is a primitive
4062     polynomial of GF(2).  Otherwise it returns zero.
4063
4064     See also: gf, primpoly
4065
4066
4067File: comms.info,  Node: istrellis,  Next: lloyds,  Prev: isprimitive,  Up: Function Reference
4068
40699.1.68 istrellis
4070----------------
4071
4072 -- Function File: istrellis (T)
4073 -- Function File: [STATUS, TEXT] = istrellis (T)
4074
4075     Return true if T is a valid trellis structure
4076
4077     If called with two output arguments, TEXT contains a string
4078     indicating a reason if STATUS is false or an empty string if STATUS
4079     is true
4080
4081     See also: poly2trellis, struct
4082
4083
4084File: comms.info,  Node: lloyds,  Next: log,  Prev: istrellis,  Up: Function Reference
4085
40869.1.69 lloyds
4087-------------
4088
4089 -- Function File: [TABLE, CODES] = lloyds (SIG, INIT_CODES)
4090 -- Function File: [TABLE, CODES] = lloyds (SIG, LEN)
4091 -- Function File: [TABLE, CODES] = lloyds (SIG, ..., TOL)
4092 -- Function File: [TABLE, CODES] = lloyds (SIG, ..., TOL, TYPE)
4093 -- Function File: [TABLE, CODES, DIST] = lloyds (...)
4094 -- Function File: [TABLE, CODES, DIST, RELDIST] = lloyds (...)
4095
4096     Optimize the quantization table and codes to reduce distortion.
4097     This is based on the article by Lloyd
4098
4099     S. Lloyd _Least squared quantization in PCM_, IEEE Trans Inform
4100     Theory, Mar 1982, no 2, p129-137
4101
4102     which describes an iterative technique to reduce the quantization
4103     error by making the intervals of the table such that each interval
4104     has the same area under the PDF of the training signal SIG.  The
4105     initial codes to try can either be given in the vector INIT_CODES
4106     or as scalar LEN.  In the case of a scalar the initial codes will
4107     be an equi-spaced vector of length LEN between the minimum and
4108     maximum value of the training signal
4109
4110     The stopping criteria of the iterative algorithm is given by
4111
4112          abs(DIST(n) - DIST(n-1)) < max(TOL, abs(EPS*max(SIG))
4113
4114     By default TOL is 1.e-7.  The final input argument determines how
4115     the updated table is created.  By default the centroid of the
4116     values of the training signal that fall within the interval
4117     described by CODES are used to update TABLE.  If TYPE is any other
4118     string than "centroid", this behavior is overridden and TABLE is
4119     updated as follows
4120
4121          TABLE = (CODE(2:length(CODE)) + CODE(1:length(CODE-1))) / 2
4122
4123     The optimized values are returned as TABLE and CODE.  In addition
4124     the distortion of the optimized codes representing the training
4125     signal is returned as DIST.  The relative distortion in the final
4126     iteration is also returned as RELDIST
4127
4128     See also: quantiz
4129
4130
4131File: comms.info,  Node: log,  Next: lu,  Prev: lloyds,  Up: Function Reference
4132
41339.1.70 log
4134----------
4135
4136 -- Loadable Function: log (X)
4137     Compute the natural logarithm for each element of X for a Galois
4138     array
4139
4140
4141File: comms.info,  Node: lu,  Next: lz77deco,  Prev: log,  Up: Function Reference
4142
41439.1.71 lu
4144---------
4145
4146 -- Loadable Function: [L, U, P] = lu (A)
4147     Compute the LU decomposition of A in a Galois Field.  The result is
4148     returned in a permuted form, according to the optional return value
4149     P.  For example, given the matrix 'a = gf ([1, 2; 3, 4], 3)',
4150
4151          [l, u, p] = lu (a)
4152
4153     returns
4154
4155          l =
4156          GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
4157
4158          Array elements =
4159
4160             1   0
4161             6   1
4162
4163          u =
4164          GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
4165
4166          Array elements =
4167
4168             3   4
4169             0   7
4170
4171          p =
4172
4173          Permutation Matrix
4174
4175             0   1
4176             1   0
4177
4178
4179     Such that 'P * A = L * U'.  If the argument P is not included then
4180     the permutations are applied to L so that 'A = L * U'.  L is then a
4181     pseudo- lower triangular matrix.  The matrix A can be rectangular
4182
4183
4184File: comms.info,  Node: lz77deco,  Next: lz77enco,  Prev: lu,  Up: Function Reference
4185
41869.1.72 lz77deco
4187---------------
4188
4189 -- Function File: M = lz77deco (C, ALPH, LA, N)
4190     Lempel-Ziv 77 source algorithm decoding implementation.  Where
4191
4192     M
4193          message decoded (1xN)
4194     C
4195          encoded message (Mx3)
4196     ALPH
4197          size of alphabet
4198     LA
4199          lookahead buffer size
4200     N
4201          sliding window buffer size
4202     See also: lz77enco
4203
4204
4205File: comms.info,  Node: lz77enco,  Next: matdeintrlv,  Prev: lz77deco,  Up: Function Reference
4206
42079.1.73 lz77enco
4208---------------
4209
4210 -- Function File: C = lz77enco (M, ALPH, LA, N)
4211     Lempel-Ziv 77 source algorithm implementation.  Where
4212
4213     C
4214          encoded message (Mx3)
4215     ALPH
4216          size of alphabet
4217     LA
4218          lookahead buffer size
4219     N
4220          sliding window buffer size
4221     See also: lz77deco
4222
4223
4224File: comms.info,  Node: matdeintrlv,  Next: matintrlv,  Prev: lz77enco,  Up: Function Reference
4225
42269.1.74 matdeintrlv
4227------------------
4228
4229 -- Function File: INTRLVD = matdeintrlv (DATA, NROWS, NCOLS)
4230     Restore elements of DATA with a temporary matrix of size
4231     NROWS-by-NCOLS See also: matintrlv
4232
4233
4234File: comms.info,  Node: matintrlv,  Next: minpol,  Prev: matdeintrlv,  Up: Function Reference
4235
42369.1.75 matintrlv
4237----------------
4238
4239 -- Function File: INTRLVD = matintrlv (DATA, NROWS, NCOLS)
4240     Interleaved elements of DATA with a temporary matrix of size
4241     NROWS-by-NCOLS See also: matdeintrlv
4242
4243
4244File: comms.info,  Node: minpol,  Next: modmap,  Prev: matintrlv,  Up: Function Reference
4245
42469.1.76 minpol
4247-------------
4248
4249 -- Function File: minpol (V)
4250
4251     Finds the minimum polynomial for elements of a Galois Field.  For a
4252     vector V with N components, representing N values in a Galois Field
4253     GF(2^M), return the minimum polynomial in GF(2) representing those
4254     values
4255
4256
4257File: comms.info,  Node: modmap,  Next: oct2dec,  Prev: minpol,  Up: Function Reference
4258
42599.1.77 modmap
4260-------------
4261
4262 -- Function File: modmap (METHOD, ...)
4263 -- Function File: y = modmap (X, FD, FS, "ask", M)
4264 -- Function File: y = modmap (X, FD, FS, "fsk", M, TONE)
4265 -- Function File: y = modmap (X, FD, FS, "msk")
4266 -- Function File: y = modmap (X, FD, FS, "psk", M)
4267 -- Function File: y = modmap (X, FD, FS, "qask", M)
4268 -- Function File: y = modmap (X, FD, FS, "qask/cir", NSIG, AMP, PHS)
4269 -- Function File: y = modmap (X, FD, FS, "qask/arb", INPHASE, QUADR)
4270 -- Function File: y = modmap (X, FD, FS, "qask/arb", MAP)
4271
4272     Mapping of a digital signal to an analog signal.  With no output
4273     arguments 'modmap' plots the constellation of the mapping.  In this
4274     case the first argument must be the string METHOD defining one of
4275     "ask", "fsk", "msk", "qask", "qask/cir" or "qask/arb".  The
4276     arguments following the string METHOD are generally the same as
4277     those after the corresponding string in the function call without
4278     output arguments The exception is 'modmap ("msk", FD)'
4279
4280     With an output argument, Y is the complex mapped analog signal.  In
4281     this case the arguments X, FD and FS are required.  The variable X
4282     is the digital signal to be mapped, FD is the sampling rate of the
4283     of digital signal and the FS is the sampling rate of the analog
4284     signal.  It is required that 'FS/FD' is an integer
4285
4286     The available mapping of the digital signal are
4287
4288     "ask"
4289          Amplitude shift keying
4290     "fsk"
4291          Frequency shift keying
4292     "msk"
4293          Minimum shift keying
4294     "psk"
4295          Phase shift keying
4296     "qask"
4297     "qsk"
4298     "qam"
4299          Quadrature amplitude shift keying
4300
4301     In addition the "qask", "qsk" and "qam" method can be modified with
4302     the flags "/cir" or "/arb".  That is "qask/cir" and "qask/arb", etc
4303     are valid methods and give circular- and arbitrary-qask mappings
4304     respectively
4305
4306     The additional argument M is the order of the modulation to use M
4307     must be larger than the largest element of X.  The variable TONE is
4308     the FSK tone to use in the modulation
4309
4310     For "qask/cir", the additional arguments are the same as for
4311     'apkconst', and you are referred to 'apkconst' for the definitions
4312     of the additional variables
4313
4314     For "qask/arb", the additional arguments INPHASE and QUADR give the
4315     in-phase and quadrature components of the mapping, in a similar
4316     mapping to the outputs of 'qaskenco' with one argument.  Similar
4317     MAP represents the in-phase and quadrature components of the
4318     mapping as the real and imaginary parts of the variable MAP See
4319     also: demodmap, dmodce, amodce, apkconst, qaskenco
4320
4321
4322File: comms.info,  Node: oct2dec,  Next: pamdemod,  Prev: modmap,  Up: Function Reference
4323
43249.1.78 oct2dec
4325--------------
4326
4327 -- Function File: D = oct2dec (C)
4328
4329     Convert octal to decimal values
4330
4331     Each element of the octal matrix C is converted to a decimal value
4332
4333     See also: base2dec, bin2dec, dec2bin
4334
4335
4336File: comms.info,  Node: pamdemod,  Next: pammod,  Prev: oct2dec,  Up: Function Reference
4337
43389.1.79 pamdemod
4339---------------
4340
4341 -- Function File: Y = pamdemod (X, M)
4342 -- Function File: Y = pamdemod (X, M, PHI)
4343 -- Function File: Y = pamdemod (X, M, PHI, TYPE)
4344
4345     Demodulates a pulse amplitude modulated signal X into an
4346     information sequence of integers in the range '[0 ... M-1]' PHI
4347     controls the initial phase and TYPE controls the constellation
4348     mapping.  If TYPE is set to "Bin" will result in binary encoding,
4349     in contrast, if set to "Gray" will give Gray encoding An example of
4350     Gray-encoded 8-PAM is
4351
4352          d = randint (1, 1e4, 8);
4353          y = pammod (d, 8, 0, "gray");
4354          z = awgn (y, 20);
4355          d_est = pamdemod (z, 8, 0, "gray");
4356          plot (z, "rx")
4357          biterr (d, d_est)
4358     See also: pammod
4359
4360
4361File: comms.info,  Node: pammod,  Next: poly2trellis,  Prev: pamdemod,  Up: Function Reference
4362
43639.1.80 pammod
4364-------------
4365
4366 -- Function File: Y = pammod (X, M)
4367 -- Function File: Y = pammod (X, M, PHI)
4368 -- Function File: Y = pammod (X, M, PHI, TYPE)
4369
4370     Modulates an information sequence of integers X in the range '[0
4371     ... M-1]' onto a pulse amplitude modulated signal Y PHI controls
4372     the initial phase and TYPE controls the constellation mapping.  If
4373     TYPE is set to "Bin" will result in binary encoding, in contrast,
4374     if set to "Gray" will give Gray encoding An example of Gray-encoded
4375     8-PAM is
4376
4377          d = randint (1, 1e4, 8);
4378          y = pammod (d, 8, 0, "gray");
4379          z = awgn (y, 20);
4380          plot (z, "rx")
4381     See also: pamdemod
4382
4383
4384File: comms.info,  Node: poly2trellis,  Next: primpoly,  Prev: pammod,  Up: Function Reference
4385
43869.1.81 poly2trellis
4387-------------------
4388
4389 -- Function File: T = poly2trellis (M, G)
4390
4391     Convert convolutional code generator polynomials into trellis form
4392
4393     The arguments M and G together describe a rate k/n feedforward
4394     convolutional encoder.  The optional argument F adds feedback
4395     support The output T is a trellis structure describing the same
4396     encoder with the fields listed below
4397
4398     The vector M is a k-by-1 array containing the lengths of each of
4399     the shift registers for the k input bits to the encoder
4400
4401     The matrix G is a k-by-n octal-value matrix describing the
4402     generation of each of the n outputs from each of the k inputs.  For
4403     a particular entry of G, the least-significant bit corresponds to
4404     the most-delayed input bit in the kth shift-register
4405
4406     The optional vector F is a 1-by-k vector of octal numbers
4407     describing the feedback of each of the shift registers
4408
4409     The returned trellis structure contains the following fields:
4410
4411     'numInputSymbols'
4412          The number of k-bit input symbols possible, i.e.  2^k
4413
4414     'numOutputSymbols'
4415          The number of n-bit output symbols possible, i.e.  2^n
4416
4417     'numStates'
4418          The number of states in the trellis
4419
4420     'nextStates'
4421          The state transition table for the trellis.  The ith row
4422          contains the indices of the states reachable from the (i-1)th
4423          state for each possible input symbol
4424
4425     'outputs'
4426          A table of octal-encoded output values for the trellis.  The
4427          ith row contains values representing the output symbols
4428          produced in the (i-1)th state for each possible input symbol
4429
4430     Input symbols, output symbols, and encoder states are all
4431     interpreted with the lowest indices being the most significant bits
4432
4433     References:
4434
4435     [1] S. Lin and D. J. Costello, "Convolutional codes," in 'Error
4436     Control Coding', 2nd ed.  Upper Saddle River, NJ: Pearson, 2004,
4437     ch.  11, pp.  453-513
4438
4439     See also: istrellis
4440
4441
4442File: comms.info,  Node: primpoly,  Next: prod,  Prev: poly2trellis,  Up: Function Reference
4443
44449.1.82 primpoly
4445---------------
4446
4447 -- Loadable Function: Y = primpoly (M)
4448 -- Loadable Function: Y = primpoly (M, OPT)
4449 -- Loadable Function: Y = primpoly (..., "nodisplay\")
4450     Finds the primitive polynomials in GF(2^M).
4451
4452     The first form of this function returns the default primitive
4453     polynomial of GF(2^M).  This is the minimum primitive polynomial of
4454     the field.  The polynomial representation is printed and an integer
4455     representation of the polynomial is returned
4456
4457     The call 'primpoly (M, OPT)' returns one or more primitive
4458     polynomials.  The output of the function is dependent of the value
4459     of OPT.  Valid values of OPT are:
4460
4461     '\"all\"'
4462          Returns all of the primitive polynomials of GF(2^M)
4463     '\"min\"'
4464          Returns the minimum primitive polynomial of GF(2^M)
4465     '\"max\"'
4466          Returns the maximum primitive polynomial of GF(2^M)
4467     K
4468          Returns the primitive polynomials having exactly K non-zero
4469          terms
4470
4471     The call 'primpoly (..., \"nodisplay\")' disables the output of the
4472     polynomial forms of the primitives.  The return value is not
4473     affected.
4474
4475     See also: gf, isprimitive
4476
4477
4478File: comms.info,  Node: prod,  Next: pskdemod,  Prev: primpoly,  Up: Function Reference
4479
44809.1.83 prod
4481-----------
4482
4483 -- Loadable Function: prod (X, DIM)
4484     Product of elements along dimension DIM of Galois array.  If DIM is
4485     omitted, it defaults to 1 (column-wise products)
4486
4487
4488File: comms.info,  Node: pskdemod,  Next: pskmod,  Prev: prod,  Up: Function Reference
4489
44909.1.84 pskdemod
4491---------------
4492
4493 -- Function File: Y = pamdemod (X, M)
4494 -- Function File: Y = pamdemod (X, M, PHI)
4495 -- Function File: Y = pamdemod (X, M, PHI, TYPE)
4496
4497     Demodulates a complex-baseband phase shift keying modulated signal
4498     into an information sequence of integers in the range '[0 ...
4499     M-1]'.  PHI controls the initial phase and TYPE controls the
4500     constellation mapping.  If TYPE is set to "Bin" will result in
4501     binary encoding, in contrast, if set to "Gray" will give Gray
4502     encoding.  An example of Gray-encoded 8-PSK is
4503
4504          d = randint (1, 1e3, 8);
4505          y = pskmod (d, 8, 0, "gray");
4506          z = awgn (y, 20);
4507          d_est = pskdemod (z, 8, 0, "gray");
4508          plot (z, "rx")
4509          biterr (d, d_est)
4510     See also: pskmod
4511
4512
4513File: comms.info,  Node: pskmod,  Next: qamdemod,  Prev: pskdemod,  Up: Function Reference
4514
45159.1.85 pskmod
4516-------------
4517
4518 -- Function File: Y = pskmod (X, M)
4519 -- Function File: Y = pskmod (X, M, PHI)
4520 -- Function File: Y = pskmod (X, M, PHI, TYPE)
4521
4522     Modulates an information sequence of integers X in the range '[0
4523     ... M-1]' onto a complex baseband phase shift keying modulated
4524     signal Y.  PHI controls the initial phase and TYPE controls the
4525     constellation mapping.  If TYPE is set to "Bin" will result in
4526     binary encoding, in contrast, if set to "Gray" will give Gray
4527     encoding.  An example of Gray-encoded QPSK is
4528
4529          d = randint (1, 5e3, 4);
4530          y = pskmod (d, 4, 0, "gray");
4531          z = awgn (y, 30);
4532          plot (z, "rx")
4533     See also: pskdemod
4534
4535
4536File: comms.info,  Node: qamdemod,  Next: qammod,  Prev: pskmod,  Up: Function Reference
4537
45389.1.86 qamdemod
4539---------------
4540
4541 -- Function File: qamdemod (X, M)
4542     Create the QAM demodulation of x with a size of alphabet m See
4543     also: qammod, pskmod, pskdemod
4544
4545
4546File: comms.info,  Node: qammod,  Next: qaskdeco,  Prev: qamdemod,  Up: Function Reference
4547
45489.1.87 qammod
4549-------------
4550
4551 -- Function File: qammod (X, M)
4552     Create the QAM modulation of x with a size of alphabet m See also:
4553     qamdemod, pskmod, pskdemod
4554
4555
4556File: comms.info,  Node: qaskdeco,  Next: qaskenco,  Prev: qammod,  Up: Function Reference
4557
45589.1.88 qaskdeco
4559---------------
4560
4561 -- Function File: MSG = qaskdeco (C, M)
4562 -- Function File: MSG = qaskdeco (INPHASE, QUADR, M)
4563 -- Function File: MSG = qaskdeco (..., MNMX)
4564
4565     Demaps an analog signal using a square QASK constellation.  The
4566     input signal maybe either a complex variable C, or as two real
4567     variables INPHASE and QUADR representing the in-phase and
4568     quadrature components of the signal
4569
4570     The argument M must be a positive integer power of 2.  By default
4571     the same constellation as created in 'qaskenco' is used by
4572     'qaskdeco' If is possible to change the values of the minimum and
4573     maximum of the in-phase and quadrature components of the
4574     constellation to account for linear changes in the signal values in
4575     the received signal.  The variable MNMX is a 2-by-2 matrix of the
4576     following form
4577
4578               |    min in-phase       ,    max in-phase       |
4579               |    min quadrature     ,    max quadrature     |
4580
4581     If 'sqrt (M)' is an integer, then 'qaskenco' uses a Gray mapping.
4582     Otherwise, an attempt is made to create a nearly square mapping
4583     with a minimum Hamming distance between adjacent constellation
4584     points See also: qaskenco
4585
4586
4587File: comms.info,  Node: qaskenco,  Next: qfunc,  Prev: qaskdeco,  Up: Function Reference
4588
45899.1.89 qaskenco
4590---------------
4591
4592 -- Function File: qaskenco (M)
4593 -- Function File: qaskenco (MSG, M)
4594 -- Function File: Y = qaskenco (...)
4595 -- Function File: [INPHASE, QUADR] = qaskenco (...)
4596
4597     Map a digital signal using a square QASK constellation.  The
4598     argument M must be a positive integer power of 2.  With two input
4599     arguments the variable MSG represents the message to be encoded.
4600     The values of MSG must be between 0 and 'M-1'.  In all cases
4601     'qaskenco (M)' is equivalent to 'qaskenco (1:M, M)'
4602
4603     Three types of outputs can be created depending on the number of
4604     output arguments.  That is
4605
4606     No output arguments
4607          In this case 'qaskenco' plots the constellation.  Only the
4608          points in MSG are plotted, which in the case of a single input
4609          argument is all constellation points
4610     A single output argument
4611          The returned variable is a complex variable representing the
4612          in-phase and quadrature components of the mapped message MSG.
4613          With, a single input argument this effectively gives the
4614          mapping from symbols to constellation points
4615     Two output arguments
4616          This is the same as one output argument, expect that the
4617          in-phase and quadrature components are returned explicitly.
4618          That is
4619
4620               c = qaskenco (msg, m);
4621               [a, b] = qaskenco (msg, m);
4622               all (c == a + 1i*b)
4623                   => 1
4624
4625     If 'sqrt (M)' is an integer, then 'qaskenco' uses a Gray mapping.
4626     Otherwise, an attempt is made to create a nearly square mapping
4627     with a minimum Hamming distance between adjacent constellation
4628     points See also: qaskdeco
4629
4630
4631File: comms.info,  Node: qfunc,  Next: qfuncinv,  Prev: qaskenco,  Up: Function Reference
4632
46339.1.90 qfunc
4634------------
4635
4636 -- Function File: Y = qfunc (X)
4637     Compute the Q function See also: erfc, erf
4638
4639
4640File: comms.info,  Node: qfuncinv,  Next: quantiz,  Prev: qfunc,  Up: Function Reference
4641
46429.1.91 qfuncinv
4643---------------
4644
4645 -- Function File: Y = qfuncinv (X)
4646     Compute the inverse Q function See also: erfc, erf
4647
4648
4649File: comms.info,  Node: quantiz,  Next: randdeintrlv,  Prev: qfuncinv,  Up: Function Reference
4650
46519.1.92 quantiz
4652--------------
4653
4654 -- Function File: QIDX = quantiz (X, TABLE)
4655 -- Function File: [QIDX, Q] = quantiz (X, TABLE, CODES)
4656 -- Function File: [ QIDX, Q, D] = quantiz (...)
4657
4658     Quantization of an arbitrary signal relative to a partitioning
4659
4660     'qidx = quantiz (x, table)'
4661          Determine position of x in strictly monotonic table.  The
4662          first interval, using index 0, corresponds to x <= table(1)
4663          Subsequent intervals are table(i-1) < x <= table(i)
4664
4665     '[qidx, q] = quantiz (x, table, codes)'
4666          Associate each interval of the table with a code.  Use
4667          codes(1) for x <= table(1) and codes(n+1) for table(n) < x <=
4668          table(n+1)
4669
4670     '[qidx, q, d] = quantiz (...)'
4671          Compute distortion as mean squared distance of x from the
4672          corresponding quantization values
4673
4674
4675File: comms.info,  Node: randdeintrlv,  Next: randerr,  Prev: quantiz,  Up: Function Reference
4676
46779.1.93 randdeintrlv
4678-------------------
4679
4680 -- Function File: INTRLVD = randdeintrlv (DATA, STATE)
4681     Restore elements of DATA with a random permutation See also:
4682     randintrlv, intrlv, deintrlv
4683
4684
4685File: comms.info,  Node: randerr,  Next: randint,  Prev: randdeintrlv,  Up: Function Reference
4686
46879.1.94 randerr
4688--------------
4689
4690 -- Function File: B = randerr (N)
4691 -- Function File: B = randerr (N, M)
4692 -- Function File: B = randerr (N, M, ERR)
4693 -- Function File: B = randerr (N, M, ERR, SEED)
4694
4695     Generate a matrix of random bit errors.  The size of the matrix is
4696     N rows by M columns.  By default M is equal to N Bit errors in the
4697     matrix are indicated by a 1
4698
4699     The variable ERR determines the number of errors per row.  By
4700     default the return matrix B has exactly one bit error per row If
4701     ERR is a scalar, there each row of B has exactly this number of
4702     errors per row.  If ERR is a vector then each row has a number of
4703     errors that is in this vector.  Each number of errors has an equal
4704     probability.  If ERR is a matrix with two rows, then the first row
4705     determines the number of errors and the second their probabilities
4706
4707     The variable SEED allows the random number generator to be seeded
4708     with a fixed value.  The initial seed will be restored when
4709     returning
4710
4711
4712File: comms.info,  Node: randint,  Next: randintrlv,  Prev: randerr,  Up: Function Reference
4713
47149.1.95 randint
4715--------------
4716
4717 -- Function File: B = randint (N)
4718 -- Function File: B = randint (N, M)
4719 -- Function File: B = randint (N, M, RANGE)
4720 -- Function File: B = randint (N, M, RANGE, SEED)
4721
4722     Generate a matrix of random binary numbers.  The size of the matrix
4723     is N rows by M columns.  By default M is equal to N
4724
4725     The range in which the integers are generated will is determined by
4726     the variable RANGE.  If RANGE is an integer, the value will lie in
4727     the range [0,RANGE-1], or [RANGE+1,0] if RANGE is negative.  If
4728     RANGE contains two elements the integers will lie within these two
4729     elements, inclusive.  By default RANGE is assumed to be [0:1]
4730
4731     The variable SEED allows the random number generator to be seeded
4732     with a fixed value.  The initial seed will be restored when
4733     returning
4734
4735
4736File: comms.info,  Node: randintrlv,  Next: randsrc,  Prev: randint,  Up: Function Reference
4737
47389.1.96 randintrlv
4739-----------------
4740
4741 -- Function File: INTRLVD = randintrlv (DATA, STATE)
4742     Interleaves elements of DATA with a random permutation See also:
4743     intrlv, deintrlv
4744
4745
4746File: comms.info,  Node: randsrc,  Next: rank,  Prev: randintrlv,  Up: Function Reference
4747
47489.1.97 randsrc
4749--------------
4750
4751 -- Function File: B = randsrc (N)
4752 -- Function File: B = randsrc (N, M)
4753 -- Function File: B = randsrc (N, M, ALPHABET)
4754 -- Function File: B = randsrc (N, M, ALPHABET, SEED)
4755
4756     Generate a matrix of random symbols.  The size of the matrix is N
4757     rows by M columns.  By default M is equal to N
4758
4759     The variable ALPHABET can be either a row vector or a matrix with
4760     two rows.  When ALPHABET is a row vector the symbols returned in B
4761     are chosen with equal probability from ALPHABET.  When ALPHABET has
4762     two rows, the second row determines the probability with which each
4763     of the symbols is chosen.  The sum of the probabilities must equal
4764     1.  By default ALPHABET is [-1 1]
4765
4766     The variable SEED allows the random number generator to be seeded
4767     with a fixed value.  The initial seed will be restored when
4768     returning
4769
4770
4771File: comms.info,  Node: rank,  Next: rcosfir,  Prev: randsrc,  Up: Function Reference
4772
47739.1.98 rank
4774-----------
4775
4776 -- Loadable Function: D = rank (A)
4777     Compute the rank of the Galois array A by counting the independent
4778     rows and columns
4779
4780
4781File: comms.info,  Node: rcosfir,  Next: reedmullerdec,  Prev: rank,  Up: Function Reference
4782
47839.1.99 rcosfir
4784--------------
4785
4786 -- Function File: H, ST = rcosfir(R,NT,RATE,T,FILTERTYPE)
4787
4788     Implements a cosine filter or root cosine filter impulse response
4789
4790     R Roll-off factor
4791
4792     NT scalar vector of length 2 such as N = (nT(2)-nT(1))*rate+1
4793
4794     T symbol rate
4795
4796     FILTERTYPE 'normal' or 'sqrt'
4797
4798     H impulse response
4799
4800     ST sampling interval
4801
4802     Example:
4803
4804     h = rcosfir(0.2,[-3 3],4,1,'sqrt'); See also: filter, downsample,
4805     rectfilt
4806
4807
4808File: comms.info,  Node: reedmullerdec,  Next: reedmullerenc,  Prev: rcosfir,  Up: Function Reference
4809
48109.1.100 reedmullerdec
4811---------------------
4812
4813 -- Function File: reedmullerdec (VV, G, R, M)
4814
4815     Decode the received code word VV using the RM-generator matrix G,
4816     of order R, M, returning the code-word C. We use the standard
4817     majority logic vote method due to Irving S. Reed.  The received
4818     word has to be a matrix of column size equal to to code-word size
4819     (i.e 2^m).  Each row is treated as a separate received word
4820
4821     The second return value is the message M got from C
4822
4823     G is obtained from definition type construction of Reed-Muller
4824     code, of order R, length 2^M. Use the function reedmullergen, for
4825     the generator matrix for the (R,M) order RM code
4826
4827     Faster code constructions (also easier) exist, but since finding
4828     permutation order of the basis vectors, is important, we stick with
4829     the standard definitions.  To use decoder function reedmullerdec,
4830     you need to use this specific generator function
4831
4832     see: Lin & Costello, Ch.4, "Error Control Coding", 2nd Ed, Pearson
4833
4834          g = reedmullergen (2, 4);
4835          msg = rand (1, 11) > 0.5;
4836          c = mod (msg * g, 2);
4837          [dec_c, dec_m] = reedmullerdec (c, g, 2, 4)
4838     See also: reedmullergen, reedmullerenc
4839
4840
4841File: comms.info,  Node: reedmullerenc,  Next: reedmullergen,  Prev: reedmullerdec,  Up: Function Reference
4842
48439.1.101 reedmullerenc
4844---------------------
4845
4846 -- Function File: reedmullerenc (MSG, R, M)
4847
4848     Definition type construction of Reed-Muller code, of order R,
4849     length 2^M. This function returns the generator matrix for the said
4850     order RM code
4851
4852     Encodes the given message word/block, of column size k,
4853     corresponding to the RM(R,M), and outputs a code matrix C, on each
4854     row with corresponding codeword The second return value is the G,
4855     which is generator matrix used for this code
4856
4857          msg = rand (10, 11) > 0.5;
4858          [c, g] = reedmullerenc (msg, 2, 4);
4859     See also: reedmullerdec, reedmullergen
4860
4861
4862File: comms.info,  Node: reedmullergen,  Next: reshape,  Prev: reedmullerenc,  Up: Function Reference
4863
48649.1.102 reedmullergen
4865---------------------
4866
4867 -- Function File: reedmullergen (R, M)
4868
4869     Definition type construction of Reed-Muller code, of order R,
4870     length 2^M. This function returns the generator matrix for the said
4871     order RM code
4872
4873     RM(r,m) codes are characterized by codewords, 'sum ( (m,0) + (m,1)
4874     + ... + (m,r)' Each of the codeword is got through spanning the
4875     space, using the finite set of m-basis codewords Each codeword is
4876     2^M elements long see: Lin & Costello, "Error Control Coding", 2nd
4877     Ed
4878
4879     Faster code constructions (also easier) exist, but since finding
4880     permutation order of the basis vectors, is important, we stick with
4881     the standard definitions.  To use decoder function reedmullerdec,
4882     you need to use this specific generator function
4883
4884          g = reedmullergen (2, 4);
4885     See also: reedmullerdec, reedmullerenc
4886
4887
4888File: comms.info,  Node: reshape,  Next: ricedeco,  Prev: reedmullergen,  Up: Function Reference
4889
48909.1.103 reshape
4891---------------
4892
4893 -- Loadable Function: reshape (A, M, N)
4894     Return a matrix with M rows and N columns whose elements are taken
4895     from the Galois array A.  To decide how to order the elements,
4896     Octave pretends that the elements of a matrix are stored in
4897     column-major order (like Fortran arrays are stored)
4898
4899     For example,
4900
4901          reshape (gf ([1, 2, 3, 4], 3), 2, 2)
4902          ans =
4903          GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
4904
4905          Array elements =
4906
4907             1   3
4908             2   4
4909
4910
4911     The 'reshape' function is equivalent to
4912
4913          retval = gf (zeros (m, n), a.m, a.prim_poly);
4914          retval(:) = a;
4915
4916     but it is somewhat less cryptic to use 'reshape' instead of the
4917     colon operator.  Note that the total number of elements in the
4918     original matrix must match the total number of elements in the new
4919     matrix See also: :
4920
4921
4922File: comms.info,  Node: ricedeco,  Next: riceenco,  Prev: reshape,  Up: Function Reference
4923
49249.1.104 ricedeco
4925----------------
4926
4927 -- Function File: ricedeco (CODE, K)
4928
4929     Returns the Rice decoded signal vector using CODE and K Compulsory
4930     K is need to be specified A restrictions is that a signal set must
4931     strictly be non-negative The value of code is a cell array of
4932     row-vectors which have the encoded rice value for a single sample.
4933     The Rice algorithm is used to encode the "code" and only that can
4934     be meaningfully decoded.  CODE is assumed to have been of format
4935     generated by the function 'riceenco'
4936
4937     Reference: Solomon Golomb, Run length Encodings, 1966 IEEE Trans
4938     Info Theory
4939
4940     An example of the use of 'ricedeco' is
4941          ricedeco (riceenco (1:4, 2), 2)
4942              => [1 2 3 4]
4943     See also: riceenco
4944
4945
4946File: comms.info,  Node: riceenco,  Next: rledeco,  Prev: ricedeco,  Up: Function Reference
4947
49489.1.105 riceenco
4949----------------
4950
4951 -- Function File: riceenco (SIG, K)
4952
4953     Returns the Rice encoded signal using K or optimal K Default
4954     optimal K is chosen between 0-7.  Currently no other way to
4955     increase the range except to specify explicitly.  Also returns K
4956     parameter used (in case it were to be chosen optimally) and LTOT
4957     the total length of output code in bits This function uses a K if
4958     supplied or by default chooses the optimal K for encoding signal
4959     vector into a rice coded vector A restrictions is that a signal set
4960     must strictly be non-negative The Rice algorithm is used to encode
4961     the data into unary coded quotient part which is represented as a
4962     set of 1's separated from the K-part (binary) using a zero.  This
4963     scheme doesn't need any kind of dictionaries and its close to O(N),
4964     but this implementation *may be* sluggish, though correct
4965
4966     Reference: Solomon Golomb, Run length Encodings, 1966 IEEE Trans
4967     Info' Theory
4968
4969     An example of the use of 'riceenco' is
4970          riceenco (1:4)
4971              => {[0 1], [1 0 0], [1 0 1], [1 1 0 0]}
4972          riceenco (1:10, 2)
4973              => {[0 0 1], [0 1 0], [0 1 1], [1 0 0 0],
4974                  [1 0 0 1], [1 0 1 0], [1 0 1 1], [1 1 0 0 0],
4975                  [1 1 0 0 1], [1 1 0 1 0]}
4976     See also: ricedeco
4977
4978
4979File: comms.info,  Node: rledeco,  Next: rleenco,  Prev: riceenco,  Up: Function Reference
4980
49819.1.106 rledeco
4982---------------
4983
4984 -- Function File: rledeco (MESSAGE)
4985
4986     Returns decoded run-length MESSAGE.  The RLE encoded MESSAGE has to
4987     be in the form of a row-vector.  The message format (encoded RLE)
4988     is like repetition [factor, value]+
4989
4990     An example use of 'rledeco' is
4991          message = [1 5 2 4 3 1];
4992          rledeco (message)
4993              => [5 4 4 1 1 1]
4994     See also: rledeco
4995
4996
4997File: comms.info,  Node: rleenco,  Next: roots,  Prev: rledeco,  Up: Function Reference
4998
49999.1.107 rleenco
5000---------------
5001
5002 -- Function File: rleenco (MESSAGE)
5003
5004     Returns run-length encoded MESSAGE.  The RLE form is built from
5005     MESSAGE.  The original MESSAGE has to be in the form of a
5006     row-vector.  The encoded MESSAGE format (encoded RLE) is like
5007     [repetition factor]+, values
5008
5009     An example use of 'rleenco' is
5010          message = [5 4 4 1 1 1]
5011          rleenco (message)
5012              => [1 5 2 4 3 1];
5013     See also: rleenco
5014
5015
5016File: comms.info,  Node: roots,  Next: rsdec,  Prev: rleenco,  Up: Function Reference
5017
50189.1.108 roots
5019-------------
5020
5021 -- Function File: roots (V)
5022
5023     For a vector V with N components, return the roots of the
5024     polynomial over a Galois Field
5025
5026          v(1) * z^(N-1) + ... + v(N-1) * z + v(N)
5027
5028     The number of roots returned and their value will be determined by
5029     the order and primitive polynomial of the Galois Field
5030
5031
5032File: comms.info,  Node: rsdec,  Next: rsdecof,  Prev: roots,  Up: Function Reference
5033
50349.1.109 rsdec
5035-------------
5036
5037 -- Loadable Function: MSG = rsdec (CODE, N, K)
5038 -- Loadable Function: MSG = rsdec (CODE, N, K, G)
5039 -- Loadable Function: MSG = rsdec (CODE, N, K, FCR, PRIM)
5040 -- Loadable Function: MSG = rsdec (..., PARPOS)
5041 -- Loadable Function: [MSG, NERR] = rsdec (...)
5042 -- Loadable Function: [MSG, NERR, CCODE] = rsdec (...)
5043     Decodes the message contained in CODE using a [N,K] Reed-Solomon
5044     code.  The variable CODE must be a Galois array with N columns and
5045     an arbitrary number of rows.  Each row of CODE represents a single
5046     block to be decoded by the Reed-Solomon coder.  The decoded message
5047     is returned in the variable MSG containing K columns and the same
5048     number of rows as CODE.
5049
5050     If N does not equal '2^M-1', where m is an integer, then a shorten
5051     Reed-Solomon decoding is used where zeros are added to the start of
5052     each row to obtain an allowable codeword length.  The returned MSG
5053     has these prepending zeros stripped.
5054
5055     By default the generator polynomial used in the Reed-Solomon coding
5056     is based on the properties of the Galois Field in which MSG is
5057     given.  This default generator polynomial can be overridden by a
5058     polynomial in G.  Suitable generator polynomials can be constructed
5059     with 'rsgenpoly'.  FCR is an integer value, and it is taken to be
5060     the first consecutive root of the generator polynomial.  The
5061     variable PRIM is then the primitive element used to construct the
5062     generator polynomial.  By default FCR and PRIM are both 1.  It is
5063     significantly faster to specify the generator polynomial in terms
5064     of FCR and PRIM, since G is converted to this form in any case.
5065
5066     By default the parity symbols are placed at the end of the coded
5067     message.  The variable PARPOS controls this positioning and can
5068     take the values '"beginning\"' or '\"end\"'.  If the parity symbols
5069     are at the end, the message is treated with the most-significant
5070     symbol first, otherwise the message is treated with the
5071     least-significant symbol first.  See also: gf, rsenc, rsgenpoly
5072
5073
5074File: comms.info,  Node: rsdecof,  Next: rsenc,  Prev: rsdec,  Up: Function Reference
5075
50769.1.110 rsdecof
5077---------------
5078
5079 -- Function File: rsdecof (IN, OUT)
5080 -- Function File: rsdecof (IN, OUT, T)
5081
5082     Decodes an ASCII file using a Reed-Solomon coder.  The input file
5083     is defined by IN and the result is written to the output file OUT
5084     The type of coding to use is determined by whether the input file
5085     is 7- or 8-bit.  If the input file is 7-bit, the default coding is
5086     [127,117] while the default coding for an 8-bit file is a [255,
5087     235].  This allows for 5 or 10 error characters in 127 or 255
5088     symbols to be corrected respectively.  The number of errors that
5089     can be corrected can be overridden by the variable T
5090
5091     If the file is not an integer multiple of the message size (127 or
5092     255) in length, then the file is padded with the EOT (ASCII
5093     character 4) character before decoding
5094
5095     See also: rsencof
5096
5097
5098File: comms.info,  Node: rsenc,  Next: rsencof,  Prev: rsdecof,  Up: Function Reference
5099
51009.1.111 rsenc
5101-------------
5102
5103 -- Loadable Function: CODE = rsenc (MSG, N, K)
5104 -- Loadable Function: CODE = rsenc (MSG, N, K, G)
5105 -- Loadable Function: CODE = rsenc (MSG, N, K, FCR, PRIM)
5106 -- Loadable Function: CODE = rsenc (..., PARPOS)
5107     Encodes the message MSG using a [N,K] Reed-Solomon coding.  The
5108     variable MSG is a Galois array with K columns and an arbitrary
5109     number of rows.  Each row of MSG represents a single block to be
5110     coded by the Reed-Solomon coder.  The coded message is returned in
5111     the Galois array CODE containing N columns and the same number of
5112     rows as MSG.
5113
5114     The use of 'rsenc' can be seen in the following short example.
5115
5116          m = 3; n = 2^m -1; k = 3;
5117          msg = gf ([1 2 3; 4 5 6], m);
5118          code = rsenc (msg, n, k);
5119
5120     If N does not equal '2^M-1', where m is an integer, then a shorten
5121     Reed-Solomon coding is used where zeros are added to the start of
5122     each row to obtain an allowable codeword length.  The returned CODE
5123     has these prepending zeros stripped.
5124
5125     By default the generator polynomial used in the Reed-Solomon coding
5126     is based on the properties of the Galois Field in which MSG is
5127     given.  This default generator polynomial can be overridden by a
5128     polynomial in G.  Suitable generator polynomials can be constructed
5129     with 'rsgenpoly'.  FCR is an integer value, and it is taken to be
5130     the first consecutive root of the generator polynomial.  The
5131     variable PRIM is then the primitive element used to construct the
5132     generator polynomial, such that
5133
5134     G = (X - A^B) * (X - A^(B+PRIM)) * ...  * (X - A^(B+2*T*PRIM-1)).
5135
5136     where B is equal to 'FCR * PRIM'.  By default FCR and PRIM are both
5137     1.
5138
5139     By default the parity symbols are placed at the end of the coded
5140     message.  The variable PARPOS controls this positioning and can
5141     take the values '"beginning\"' or '\"end\"'.  See also: gf, rsdec,
5142     rsgenpoly
5143
5144
5145File: comms.info,  Node: rsencof,  Next: rsgenpoly,  Prev: rsenc,  Up: Function Reference
5146
51479.1.112 rsencof
5148---------------
5149
5150 -- Function File: rsencof (IN, OUT)
5151 -- Function File: rsencof (IN, OUT, T)
5152 -- Function File: rsencof (..., PAD)
5153
5154     Encodes an ASCII file using a Reed-Solomon coder.  The input file
5155     is defined by IN and the result is written to the output file OUT
5156     The type of coding to use is determined by whether the input file
5157     is 7- or 8-bit.  If the input file is 7-bit, the default coding is
5158     [127,117] while the default coding for an 8-bit file is a [255,
5159     235].  This allows for 5 or 10 error characters in 127 or 255
5160     symbols to be corrected respectively.  The number of errors that
5161     can be corrected can be overridden by the variable T
5162
5163     If the file is not an integer multiple of the message size (127 or
5164     255) in length, then the file is padded with the EOT (ASCII
5165     character 4) characters before coding.  Whether these characters
5166     are written to the output is defined by the PAD variable.  Valid
5167     values for PAD are "pad" (the default) and "nopad", which write or
5168     not the padding respectively
5169
5170     See also: rsdecof
5171
5172
5173File: comms.info,  Node: rsgenpoly,  Next: scatterplot,  Prev: rsencof,  Up: Function Reference
5174
51759.1.113 rsgenpoly
5176-----------------
5177
5178 -- Function File: G = rsgenpoly (N, K)
5179 -- Function File: G = rsgenpoly (N, K, P)
5180 -- Function File: G = rsgenpoly (N, K, P, B, S)
5181 -- Function File: G = rsgenpoly (N, K, P, B)
5182 -- Function File: [G, T] = rsgenpoly (...)
5183
5184     Creates a generator polynomial for a Reed-Solomon coding with
5185     message length of K and codelength of N.  N must be greater than K
5186     and their difference must be even.  The generator polynomial is
5187     returned on G as a polynomial over the Galois Field GF(2^M) where N
5188     is equal to '2^M-1'.  If M is not integer the next highest integer
5189     value is used and a generator for a shorten Reed-Solomon code is
5190     returned
5191
5192     The elements of G represent the coefficients of the polynomial in
5193     descending order.  If the length of G is lg, then the generator
5194     polynomial is given by
5195
5196          G(0) * x^(lg-1) + G(1) * x^(lg-2) + ... + G(lg-1) * x + G(lg)
5197
5198     If P is defined then it is used as the primitive polynomial of the
5199     Galois Field GF(2^M).  The default primitive polynomial will be
5200     used if P is equal to []
5201
5202     The variables B and S determine the form of the generator
5203     polynomial in the following manner
5204
5205          G = (X - A^(B*S)) * (X - A^((B+1)*S)) * ... * (X - A^((B+2*T-1)*S))
5206
5207     where T is '(N-K)/2', and A is the primitive element of the Galois
5208     Field.  Therefore B is the first consecutive root of the generator
5209     polynomial and S is the primitive element to generate the
5210     polynomial roots
5211
5212     If requested the variable T, which gives the error correction
5213     capability of the Reed-Solomon code See also: gf, rsenc, rsdec
5214
5215
5216File: comms.info,  Node: scatterplot,  Next: shannonfanodeco,  Prev: rsgenpoly,  Up: Function Reference
5217
52189.1.114 scatterplot
5219-------------------
5220
5221 -- Function File: scatterplot (X)
5222 -- Function File: scatterplot (X, N)
5223 -- Function File: scatterplot (X, N, OFF)
5224 -- Function File: scatterplot (X, N, OFF, STR)
5225 -- Function File: scatterplot (X, N, OFF, STR, H)
5226 -- Function File: H = scatterplot (...)
5227
5228     Display the scatter plot of a signal.  The signal X can be either
5229     in one of three forms
5230
5231     A real vector
5232          In this case the signal is assumed to be real and represented
5233          by the vector X.  The scatterplot is plotted along the x axis
5234          only
5235     A complex vector
5236          In this case the in-phase and quadrature components of the
5237          signal are plotted separately on the x and y axes respectively
5238     A matrix with two columns
5239          In this case the first column represents the in-phase and the
5240          second the quadrature components of a complex signal and are
5241          plotted on the x and y axes respectively
5242
5243     Each point of the scatter plot is assumed to be separated by N
5244     elements in the signal.  The first element of the signal to plot is
5245     determined by OFF.  By default N is 1 and OFF is 0
5246
5247     The string STR is a plot style string (example "r+"), and by
5248     default is the default gnuplot point style
5249
5250     The figure handle to use can be defined by H.  If H is not given,
5251     then the next available figure handle is used.  The figure handle
5252     used in returned on HOUT See also: eyediagram
5253
5254
5255File: comms.info,  Node: shannonfanodeco,  Next: shannonfanodict,  Prev: scatterplot,  Up: Function Reference
5256
52579.1.115 shannonfanodeco
5258-----------------------
5259
5260 -- Function File: shannonfanodeco (HCODE, DICT)
5261
5262     Returns the original signal that was Shannon-Fano encoded.  The
5263     signal was encoded using 'shannonfanoenco'.  This function uses a
5264     dict built from the 'shannonfanodict' and uses it to decode a
5265     signal list into a Shannon-Fano list.  Restrictions include hcode
5266     is expected to be a binary code; returned signal set that strictly
5267     belongs in the 'range [1,N]', with 'N = length (dict)'.  Also dict
5268     can only be from the 'shannonfanodict (...)' routine.  Whenever
5269     decoding fails, those signal values are indicated by -1, and we
5270     successively try to restart decoding from the next bit that hasn't
5271     failed in decoding, ad-infinitum
5272
5273     An example use of 'shannonfanodeco' is
5274          hd = shannonfanodict (1:4, [0.5 0.25 0.15 0.10]);
5275          hcode = shannonfanoenco (1:4, hd)
5276              => hcode = [0 1 0 1 1 0 1 1 1 0]
5277          shannonfanodeco (hcode, hd)
5278              => [1 2 3 4]
5279     See also: shannonfanoenco, shannonfanodict
5280
5281
5282File: comms.info,  Node: shannonfanodict,  Next: shannonfanoenco,  Prev: shannonfanodeco,  Up: Function Reference
5283
52849.1.116 shannonfanodict
5285-----------------------
5286
5287 -- Function File: shannonfanodict (SYMBOLS, SYMBOL_PROBABILITES)
5288
5289     Returns the code dictionary for source using Shannon-Fano algorithm
5290     Dictionary is built from SYMBOL_PROBABILITIES using the
5291     Shannon-Fano scheme.  Output is a dictionary cell-array, which are
5292     codewords, and correspond to the order of input probability
5293
5294          cw = shannonfanodict (1:4, [0.5 0.25 0.15 0.1]);
5295          assert (redundancy (cw, [0.5 0.25 0.15 0.1]), 0.25841, 0.001)
5296          shannonfanodict (1:5, [0.35 0.17 0.17 0.16 0.15])
5297          shannonfanodict (1:8, [8 7 6 5 5 4 3 2] / 40)
5298     See also: shannonfanoenc, shannonfanodec
5299
5300
5301File: comms.info,  Node: shannonfanoenco,  Next: sqrt,  Prev: shannonfanodict,  Up: Function Reference
5302
53039.1.117 shannonfanoenco
5304-----------------------
5305
5306 -- Function File: shannonfanoenco (HCODE, DICT)
5307
5308     Returns the Shannon-Fano encoded signal using DICT This function
5309     uses a DICT built from the 'shannonfanodict' and uses it to encode
5310     a signal list into a Shannon-Fano code Restrictions include a
5311     signal set that strictly belongs in the 'range [1,N]' with 'N =
5312     length (dict)'.  Also dict can only be from the 'shannonfanodict'
5313     routine An example use of 'shannonfanoenco' is
5314
5315          hd = shannonfanodict (1:4, [0.5 0.25 0.15 0.10]);
5316          shannonfanoenco (1:4, hd)
5317              => [0 1 0 1 1 0 1 1 1 0]
5318     See also: shannonfanodeco, shannonfanodict
5319
5320
5321File: comms.info,  Node: sqrt,  Next: sum,  Prev: shannonfanoenco,  Up: Function Reference
5322
53239.1.118 sqrt
5324------------
5325
5326 -- Loadable Function: sqrt (X)
5327     Compute the square root of X, element by element, in a Galois Field
5328     See also: exp
5329
5330
5331File: comms.info,  Node: sum,  Next: sumsq,  Prev: sqrt,  Up: Function Reference
5332
53339.1.119 sum
5334-----------
5335
5336 -- Loadable Function: sum (X, DIM)
5337     Sum of elements along dimension DIM of Galois array.  If DIM is
5338     omitted, it defaults to 1 (column-wise sum)
5339
5340
5341File: comms.info,  Node: sumsq,  Next: symerr,  Prev: sum,  Up: Function Reference
5342
53439.1.120 sumsq
5344-------------
5345
5346 -- Loadable Function: sumsq (X, DIM)
5347     Sum of squares of elements along dimension DIM of Galois array If
5348     DIM is omitted, it defaults to 1 (column-wise sum of squares)
5349
5350     This function is equivalent to computing
5351          gsum (x .* conj (x), dim)
5352     but it uses less memory
5353
5354
5355File: comms.info,  Node: symerr,  Next: syndtable,  Prev: sumsq,  Up: Function Reference
5356
53579.1.121 symerr
5358--------------
5359
5360 -- Function File: [NUM, RATE] = symerr (A, B)
5361 -- Function File: [NUM, RATE] = symerr (..., FLAG)
5362 -- Function File: [NUM, RATE IND] = symerr (...)
5363
5364     Compares two matrices and returns the number of symbol errors and
5365     the symbol error rate.  The variables A and B can be either:
5366
5367     Both matrices
5368          In this case both matrices must be the same size and then by
5369          default the return values NUM and RATE are the overall number
5370          of symbol errors and the overall symbol error rate
5371     One column vector
5372          In this case the column vector is used for symbol error
5373          comparison column-wise with the matrix.  The returned values
5374          NUM and RATE are then row vectors containing the number of
5375          symbol errors and the symbol error rate for each of the
5376          column-wise comparisons.  The number of rows in the matrix
5377          must be the same as the length of the column vector
5378     One row vector
5379          In this case the row vector is used for symbol error
5380          comparison row-wise with the matrix.  The returned values NUM
5381          and RATE are then column vectors containing the number of
5382          symbol errors and the symbol error rate for each of the
5383          row-wise comparisons.  The number of columns in the matrix
5384          must be the same as the length of the row vector
5385
5386     This behavior can be overridden with the variable FLAG.  FLAG can
5387     take the value "column-wise", "row-wise" or "overall".  A
5388     column-wise comparison is not possible with a row vector and
5389     visa-versa
5390
5391
5392File: comms.info,  Node: syndtable,  Next: systematize,  Prev: symerr,  Up: Function Reference
5393
53949.1.122 syndtable
5395-----------------
5396
5397 -- Loadable Function: T = syndtable (H)
5398     Create the syndrome decoding table from the parity check matrix H.
5399     Each row of the returned matrix T represents the error vector in a
5400     received symbol for a certain syndrome.  The row selected is
5401     determined by a conversion of the syndrome to an integer
5402     representation, and using this to reference each row of T.  See
5403     also: hammgen, cyclgen
5404
5405
5406File: comms.info,  Node: systematize,  Next: vec2mat,  Prev: syndtable,  Up: Function Reference
5407
54089.1.123 systematize
5409-------------------
5410
5411 -- Function File: systematize (G)
5412
5413     Given G, extract P parity check matrix.  Assume row-operations in
5414     GF(2) G is of size KxN, when decomposed through row-operations into
5415     a I of size KxK identity matrix, and a parity check matrix P of
5416     size Kx(N-K)
5417
5418     Most arbitrary code with a given generator matrix G, can be
5419     converted into its systematic form using this function
5420
5421     This function returns 2 values, first is default being GX the
5422     systematic version of the G matrix, and then the parity check
5423     matrix P
5424
5425          g = [1 1 1 1; 1 1 0 1; 1 0 0 1];
5426          [gx, p] = systematize (g);
5427              => gx = [1 0 0 1; 0 1 0 0; 0 0 1 0];
5428              => p = [1 0 0];
5429     See also: bchpoly, biterr
5430
5431
5432File: comms.info,  Node: vec2mat,  Next: wgn,  Prev: systematize,  Up: Function Reference
5433
54349.1.124 vec2mat
5435---------------
5436
5437 -- Function File: M = vec2mat (V, C)
5438 -- Function File: M = vec2mat (V, C, D)
5439 -- Function File: [M, ADD] = vec2mat (...)
5440
5441     Converts the vector V into a C column matrix with row priority
5442     arrangement and with the final column padded with the value D to
5443     the correct length.  By default D is 0.  The amount of padding
5444     added to the matrix is returned in ADD
5445
5446
5447File: comms.info,  Node: wgn,  Prev: vec2mat,  Up: Function Reference
5448
54499.1.125 wgn
5450-----------
5451
5452 -- Function File: Y = wgn (M, N, P)
5453 -- Function File: Y = wgn (M, N, P, IMP)
5454 -- Function File: Y = wgn (M, N, P, IMP, SEED)
5455 -- Function File: Y = wgn (..., TYPE)
5456 -- Function File: Y = wgn (..., OUTPUT)
5457
5458     Returns a M-by-N matrix Y of white Gaussian noise.  P specifies the
5459     power of the output noise, which is assumed to be referenced to an
5460     impedance of 1 Ohm, unless IMP explicitly defines the impedance
5461
5462     If SEED is defined then the randn function is seeded with this
5463     value
5464
5465     The arguments TYPE and OUTPUT must follow the above numerical
5466     arguments, but can be specified in any order.  TYPE specifies the
5467     units of P, and can be "dB", "dBW", "dBm" or "linear".  "dB" is in
5468     fact the same as "dBW" and is keep as a misnomer of Matlab.  The
5469     units of "linear" are in Watts
5470
5471     The OUTPUT variable should be either "real" or "complex".  If the
5472     output is complex then the power P is divided equally between the
5473     real and imaginary parts
5474
5475     See also: randn, awgn
5476
5477
5478
5479Tag Table:
5480Node: Top71
5481Node: Introduction388
5482Node: Random Signals923
5483Node: Signal Creation1596
5484Node: Signal Analysis9791
5485Node: Source Coding13805
5486Node: Quantization14028
5487Node: PCM Coding16275
5488Node: Arithmetic Coding16626
5489Node: Dynamic Range Compression16876
5490Node: Block Coding18082
5491Node: Data Formats18637
5492Node: Binary Block Codes20830
5493Node: BCH Codes26409
5494Node: Reed-Solomon Codes29083
5495Node: Representation of Reed-Solomon Messages29336
5496Node: Creating and Decoding Messages31260
5497Node: Shortened Reed-Solomon Codes35268
5498Node: Convolutional Coding36430
5499Node: Trellis Structure36901
5500Node: Convolutional Encoding38704
5501Node: Modulations39974
5502Node: Special Filters40267
5503Node: Galois Fields40416
5504Node: Galois Field Basics40617
5505Node: Creating Galois Fields42736
5506Node: Primitive Polynomials44863
5507Node: Accessing Internal Fields47406
5508Node: Function Overloading49036
5509Node: Known Problems50743
5510Node: Manipulating Galois Fields52637
5511Node: Expressions manipulation and assignment53000
5512Node: Unary operations56392
5513Node: Arithmetic operations57146
5514Node: Comparison operations60342
5515Node: Polynomial manipulations61539
5516Node: Linear Algebra66614
5517Node: Signal Processing68670
5518Node: Function Reference71720
5519Node: ademodce83482
5520Node: amdemod85656
5521Node: ammod86167
5522Node: amodce86651
5523Node: apkconst88580
5524Node: awgn90318
5525Node: bchdeco91553
5526Node: bchenco93790
5527Node: bchpoly95417
5528Node: berconfint98643
5529Node: bi2de99506
5530Node: bin2gray100324
5531Node: biterr101208
5532Node: bsc103205
5533Node: comms103448
5534Node: compand104991
5535Node: conv106260
5536Node: convenc106667
5537Node: convmtx107749
5538Node: cosets108485
5539Node: cyclgen108814
5540Node: cyclpoly110051
5541Node: de2bi111222
5542Node: decode112465
5543Node: deconv117181
5544Node: deintrlv117648
5545Node: demodmap117902
5546Node: det120400
5547Node: dftmtx120599
5548Node: diag121274
5549Node: dpcmdeco122024
5550Node: dpcmenco122541
5551Node: dpcmopt123746
5552Node: egolaydec125325
5553Node: egolayenc126549
5554Node: egolaygen127184
5555Node: encode127592
5556Node: exp131082
5557Node: eyediagram131301
5558Node: fft132920
5559Node: fibodeco133246
5560Node: fiboenco134256
5561Node: fibosplitstream135519
5562Node: filter136398
5563Node: finddelay137575
5564Node: fmdemod138148
5565Node: fmmod138629
5566Node: gen2par139219
5567Node: genqamdemod139782
5568Node: genqammod140162
5569Node: gf140855
5570Node: gftable140993
5571Node: gfweight141378
5572Node: golombdeco142330
5573Node: golombenco143420
5574Node: hammgen145396
5575Node: helscanintrlv146313
5576Node: huffmandeco146578
5577Node: huffmandict147617
5578Node: huffmanenco149330
5579Node: ifft150067
5580Node: intrlv150412
5581Node: inv150660
5582Node: inverse151032
5583Node: isequal151214
5584Node: isgalois151466
5585Node: isprimitive151706
5586Node: istrellis152037
5587Node: lloyds152495
5588Node: log154512
5589Node: lu154731
5590Node: lz77deco155741
5591Node: lz77enco156206
5592Node: matdeintrlv156632
5593Node: matintrlv156936
5594Node: minpol157238
5595Node: modmap157622
5596Node: oct2dec160371
5597Node: pamdemod160685
5598Node: pammod161541
5599Node: poly2trellis162320
5600Node: primpoly164433
5601Node: prod165705
5602Node: pskdemod165987
5603Node: pskmod166862
5604Node: qamdemod167660
5605Node: qammod167925
5606Node: qaskdeco168186
5607Node: qaskenco169501
5608Node: qfunc171294
5609Node: qfuncinv171496
5610Node: quantiz171714
5611Node: randdeintrlv172652
5612Node: randerr172948
5613Node: randint174067
5614Node: randintrlv175001
5615Node: randsrc175281
5616Node: rank176258
5617Node: rcosfir176504
5618Node: reedmullerdec177064
5619Node: reedmullerenc178403
5620Node: reedmullergen179148
5621Node: reshape180142
5622Node: ricedeco181161
5623Node: riceenco182023
5624Node: rledeco183457
5625Node: rleenco183962
5626Node: roots184512
5627Node: rsdec184945
5628Node: rsdecof187140
5629Node: rsenc188096
5630Node: rsencof190145
5631Node: rsgenpoly191345
5632Node: scatterplot193105
5633Node: shannonfanodeco194684
5634Node: shannonfanodict195876
5635Node: shannonfanoenco196675
5636Node: sqrt197466
5637Node: sum197712
5638Node: sumsq197976
5639Node: symerr198380
5640Node: syndtable200075
5641Node: systematize200621
5642Node: vec2mat201497
5643Node: wgn201998
5644
5645End Tag Table
5646
5647
5648Local Variables:
5649coding: utf-8
5650End:
5651