--- a/doc/comms.txi +++ b/doc/comms.txi @@ -93,6 +93,7 @@ 0 1 1 @end example +@noindent creates a 3-by-3 matrix of random integers in the range -1 to 1. To allow for repeated analysis with the same random data, the function @code{randint} allows the seed-value of the random number generator to be set. For instance @@ -106,6 +107,7 @@ 1 -1 -1 @end example +@noindent will always produce the same set of random data. The range of the integers to produce can either be a two element vector or an integer. In the case of a two element vector all elements within the defined range can be produced. @@ -128,12 +130,14 @@ octave:2> b = randsrc (4, 4, [1, 1i, -1, -1i]); @end example +@noindent are both legal, while @example octave:1> a = randsrc (2, 2, [1, "a"]); @end example +@noindent is not legal. The alphabet from which the symbols are chosen can be either a row vector or two row matrix. In the case of a row vector, all of the elements of the alphabet are chosen with an equal probability. In the case @@ -151,6 +155,7 @@ -1 + 0i -1 + 0i 1 + 0i 1 + 0i 1 + 0i @end example +@noindent defines that the symbol '1' has a 60% probability, the symbol '1i' has a 20% probability and the remaining symbols have 10% probability each. The sum of the probabilities must equal one. Like @code{randint}, @@ -189,6 +194,7 @@ octave:5> noisy = mod (code + berrs, 2) ## Add errors to coded message @end example +@noindent creates a vector @var{msg}, encodes it with a [15,11] BCH code, and then add either none or one error per symbol with the chances of an error being 30%. As previously, @code{randerr} accepts a fourth argument as the seed of @@ -266,6 +272,7 @@ 0.031615 0.022042 0.022241 0.031313 @end example +@noindent which shows that with a complex return value that the total power is the same as a real vector, but that it is equally shared between the real and imaginary parts. As previously, @code{wgn} accepts a fourth numerical argument @@ -276,6 +283,7 @@ octave:1> nse = wgn (10, 10, 0, 0); @end example +@noindent will always produce the same set of data. The final function to deal with the creation of random signals is @@ -290,6 +298,7 @@ @end example @ifnotinfo +@noindent which produces a sine-wave with noise added as seen in Figure 1. @center @image{awgn} @@ -297,6 +306,7 @@ @center Figure 1: Sine-wave with 10dB signal-to-noise ratio @end ifnotinfo +@noindent which adds noise with a 10dB signal-to-noise ratio to the measured power in the desired signal. By default @code{awgn} assumes that the desired signal is at 0dBW, and the noise is added relative to this assumed @@ -328,6 +338,7 @@ octave:3> noisy = awgn (y, 10, "dB", 0, "measured") @end example +@noindent which uses the seed-value of 0 for the random number generator. @node Signal Analysis, , Signal Creation, Random Signals @@ -375,6 +386,7 @@ srate = 0.10000 @end example +@noindent which creates a 10-by-10 matrix adds 10 symbols errors to the data and then finds the bit and symbol error-rates. @@ -417,6 +429,7 @@ @end example @ifnotinfo +@noindent which produces a eye-diagram of a noisy signal as seen in Figure 2. Similarly an example of the use of the function @code{scatterplot} is @@ -442,6 +455,7 @@ @end example @ifnotinfo +@noindent which produces a scatterplot of a noisy signal as seen in Figure 3. @center @image{scatterplot} @@ -556,6 +570,7 @@ 0.0053885 0.0029935 @end example +@noindent which demonstrates that the use of @code{compand} can significantly reduce the distortion due to the quantization of signals with a large dynamic range. @@ -696,6 +711,7 @@ @end example @end ifnottex +@noindent or @tex @@ -720,6 +736,7 @@ @end example @end ifnottex +@noindent and similarly the parity check matrix can be represented by a combination of an identity matrix and a square matrix. @@ -744,6 +761,7 @@ octave:4> [par2, gen2] = cyclgen (n, cyclpoly (n, k)); @end example +@noindent which create identical parity check and generator matrices for the [7,4] Hamming code. @@ -806,6 +824,7 @@ octave:5> cdec = encode (bi2de (msg), n, k, "hamming/decimal"); @end example +@noindent which codes a binary matrix and a non-binary vector representation of a message, returning the coded message in the same format. The functions @code{encode} and @code{decode} by default accept binary coded @@ -915,6 +934,7 @@ 1 0 0 0 1 0 1 1 1 @end example +@noindent show that the generator polynomial of a [15,7] BCH code with the default primitive polynomial is @@ -1041,6 +1061,7 @@ octave:2> msg1 = gf ([0, 1, 2, 3], 3, 13); @end example +@noindent will not result in the same Reed-Solomon coding. Finally, the parity of the Reed-Solomon code are generated with the use of a generator polynomial. The parity symbols are then generated by treating the message @@ -1069,6 +1090,7 @@ @end example @end ifnottex +@noindent where @var{t} is @code{(@var{n} - @var{k})/2}, A is the primitive element of the Galois Field, @var{b} is the first consecutive root, and @var{s} is the step between roots. Generator polynomial of this form are constructed @@ -1308,6 +1330,7 @@ ans = 19 @end example +@noindent identifies the default primitive polynomials of the field GF(2^M), which is the same as @code{primpoly (4, "min")}. All of the primitive polynomials of a field can be identified with the function @code{primpoly (@var{m}, "all")}. @@ -1326,6 +1349,7 @@ 19 25 @end example +@noindent while @code{primpoly (@var{m}, "max")} returns the maximum primitive polynomial of the field, which for the case above is 25. The function @code{primpoly} can also be used to identify the primitive polynomials having only a @@ -1344,6 +1368,7 @@ 37 41 @end example +@noindent identifies the polynomials with only three terms that can be used as primitive polynomials of GF(2^5). If no primitive polynomials existing having the requested number of terms then @code{primpoly} returns an @@ -1381,6 +1406,7 @@ 19 25 @end example +@noindent which finds all of the primitive polynomials of GF(2^4). @node Accessing Internal Fields, Function Overloading, Primitive Polynomials, Galois Field Basics @@ -1424,6 +1450,7 @@ octave:2> a.prim_poly = 13; @end example +@noindent is explicitly forbidden. The result of this will be to replace the Galois array @var{a} with a structure @var{a} with a single element called '.prim_poly'. To modify the order or primitive polynomial of a @@ -1466,6 +1493,7 @@ octave:2> b = de2bi (a.x, [], "left-msb"); @end example +@noindent converts the polynomial form of the minimum polynomial of 14 in GF(2^5) into an integer. Finally help for the Galois specific versions of the functions must explicitly call the correct function as @@ -1609,6 +1637,7 @@ octave:2> a(1) = 1; @end example +@noindent is valid, while @example @@ -1616,6 +1645,7 @@ octave:2> a(1) = 8; @end example +@noindent is not, since 8 is not an element of GF(2^3). This is a basic rule of manipulating Galois arrays. That is matrices and scalars can be used in conjunction with a Galois array as long as they contain valid data @@ -1706,6 +1736,7 @@ octave:2> b = a + [0:7]; @end example +@noindent is valid, while @example @@ -1713,6 +1744,7 @@ octave:2> b = a + [1:8]; @end example +@noindent is not, since 8 is not a valid element of GF(2^3). The available arithmetic operators are @@ -1841,6 +1873,7 @@ octave:1> poly = gf ([2, 4, 5, 1], 3); @end example +@noindent represents the polynomial @tex @@ -1966,6 +1999,7 @@ 0 @end example +@noindent which as expected gives a zero vector. It should be noted that both the number of roots and their value, will depend on the chosen field. Thus for instance @@ -1981,6 +2015,7 @@ 5 @end example +@noindent shows that in the field GF(2^3) with a different primitive polynomial, has only one root exists. @@ -2034,6 +2069,7 @@ @} @end example +@noindent which returns a cell array containing all of the elements of the GF(2^3), partitioned into groups sharing the same minimum polynomial. The function @code{cosets} can equally accept a second argument defining the primitive @@ -2050,6 +2086,7 @@ octave:2> [l, u, p] = lu (a) @end example +@noindent such that @code{@var{p} * @var{a} = @var{l} * @var{u}}. The matrix @var{p} contains row permutations of @var{a}, such that @var{l} and @var{u} are strictly upper and low triangular. The Galois array @var{a} can be @@ -2070,6 +2107,7 @@ octave:3> x = A \ b; @end example +@noindent gives the solution @code{@var{x} = [2, 0, 3, 2]}. There are in fact 4 possible solutions to this linear system; @code{@var{x} = [3, 2, 2, 0]}, @code{@var{x} = [0, 3, 1, 1]}, @code{@var{x} = [2, 0, 3, 2]} and @@ -2087,6 +2125,7 @@ octave:4> r = rank (A); @end example +@noindent solves the linear systems @code{@var{A} * @var{x} = @var{b}} and @code{@var{y} * @var{A} = @var{b}}. Note that you do not need to take into account rounding errors in the determinant, as the determinant can @@ -2114,6 +2153,7 @@ 1 0 3 0 2 3 1 0 1 3 3 1 0 1 3 3 1 0 1 3 3 @end example +@noindent gives the impulse response of the filter defined by @var{a} and @var{b}. Two equivalent ways are given to perform the convolution of two Galois @@ -2137,6 +2177,7 @@ check = 1 @end example +@noindent shows the equivalence of the two functions. The de-convolution function has been previously described above.