Presentation is loading. Please wait.

Presentation is loading. Please wait.

USING THE MATLAB COMMUNICATIONS TOOLBOX TO LOOK AT CYCLIC CODING Wm. Hugh Blanton East Tennessee State University

Similar presentations


Presentation on theme: "USING THE MATLAB COMMUNICATIONS TOOLBOX TO LOOK AT CYCLIC CODING Wm. Hugh Blanton East Tennessee State University"— Presentation transcript:

1 USING THE MATLAB COMMUNICATIONS TOOLBOX TO LOOK AT CYCLIC CODING Wm. Hugh Blanton East Tennessee State University http://faculty.etsu.edu/blanton

2 The Theory General Concepts

3 Channel Coding Designed to improve communications performance by enabling the transmitted signals to better withstand the effects of various channel impairments, such as noise, interference, and fading. Designed to improve communications performance by enabling the transmitted signals to better withstand the effects of various channel impairments, such as noise, interference, and fading.

4 Hamming Distance 000100 110 101 001 010 011 111 The number of bit positions in which two binary words differ. This figure has a minimum distance between code words of 1.

5 Hamming Distance of 2 0000 r = 1 0011 0110 A code word that differs by a Hamming distance of 2 will detect an erroneous code word. 00010111

6 1 1 1 If the minimum distance is 3, the code words are separated by at least three edges. Note that if a single error occurs, the erroneous code word will be closer to one of the correct code words. The error is corrected by assigning the received code word to the nearest (in Hamming distance) valid code word.

7 The important concepts associated with Hamming distance are: 1.When the Hamming distance is 1, it is impossible to detect an error, much less correct the error. 2.When the Hamming distance is 2, the error can be detected, but not corrected. 3.When the Hamming distance is 3, a single error can be detected and corrected.

8 More Theory Mathematical Concepts

9 LINEAR BLOCK CODES Definition Definition –A systematic (n,k) linear block code is a mapping from a k-dimensional message vector to an n-dimensional codeword in such a way that part of the sequence generated coincides with the k message digits.

10 InformationCode 00000000000 00011010001 00101110010 00110100011 01000110100 01011100101 01101000110 01110010111 10001101000 10010111001 10100011010 10111001011 11001011100 11010001101 11100101110 11111111111 The linear block code that everyone uses is the (7,4) code. k-dimensional information vector, where k = 4. n-dimensional information vector, where n = 7.

11 Generator Matrix How do you generate a (7,4) code? How do you generate a (7,4) code? –Of course with a Generator Matrix! Note that m = n - k, the difference

12 A (7,4) code is generated by the matrix A (7,4) code is generated by the matrix

13 The (7,4) block code is generated using the matrix equation The (7,4) block code is generated using the matrix equation –where 1. u is a [1 × k] vector representing the information word 2. v is a [1 × n] vector representing the code word 3. [G] is a [k × n] generating matrix

14 For the information word (0 0 0 1), the code word is computed as follows: For the information word (0 0 0 1), the code word is computed as follows: Transformation from 4-bit information word to 7-bit code word Note that the additions are modulo-2 additions

15 The Hamming distance for the (7,4) code is 3. The Hamming distance for the (7,4) code is 3. –Thus, this code can detect double bit errors and correct single bit errors

16 Parity Check Matrix Another important matrix associated with block codes is the parity check matrix, [H]. Another important matrix associated with block codes is the parity check matrix, [H].

17 The parity check matrix is formed by starting with the identity matrix and appending the transpose of the nonidentity portion of [G]: The parity check matrix is formed by starting with the identity matrix and appending the transpose of the nonidentity portion of [G]:

18 For the (7,4) block code, For the (7,4) block code,

19 The Syndrome The parity check matrix has the property The parity check matrix has the property v[H] T = 0 That is, any errorless, received code word multiplied by the transpose of the parity check matrix, [H], yields a zero vector, or syndrome. That is, any errorless, received code word multiplied by the transpose of the parity check matrix, [H], yields a zero vector, or syndrome. –If the received code word contains an error, the resulting vector will match the corresponding bit that caused the error.

20 Consider one of the valid code words of the (7,4) block code, v = 1100101 and the transpose of the (7,4) parity check matrix. Consider one of the valid code words of the (7,4) block code, v = 1100101 and the transpose of the (7,4) parity check matrix.

21 Modulo-2 Addition

22 Syndrome The null vector indicates no error.

23 Suppose the valid code words, v = 1100101 gets corrupted to 1000101. Suppose the valid code words, v = 1100101 gets corrupted to 1000101.

24 Modulo-2 Addition

25 Syndrome Match syndrome with corresponding code in parity check matrix The second row corresponds to the second bit from left.

26 Each row in the transposed parity check matrix corresponds to a bit in the code word. Each row in the transposed parity check matrix corresponds to a bit in the code word. –By matching the non-zero syndrome with the contents contained in the rows of the transposed parity matrix, the corresponding corrupted bit can be detected and and subsequently corrected.

27 The process will convert the erroneous code 1000101 to the correct code 1100101. The process will convert the erroneous code 1000101 to the correct code 1100101.

28 Cyclic Codes

29 CYCLIC CODES The implementation of linear block codes requires circuits capable of performing matrix multiplication and of comparing the result of various binary numbers. The implementation of linear block codes requires circuits capable of performing matrix multiplication and of comparing the result of various binary numbers. –Although integrated circuits have been developed to implement the most common codes, the circuitry can become quite complex for very long blocks of code.

30 A special case of the block code, the cyclic code can be electronically implemented relatively easily. A special case of the block code, the cyclic code can be electronically implemented relatively easily.

31 A (7,4) cyclic code generating matrix

32 Non-systematic—No Identity matrix.

33 A nonsystematic (7,4) cyclic code generating matrix is made systematic by performing row, column operations until you obtain the I k partition.

34 MATLAB COMMUNICATIONS TOOLBOX DERIVATION

35 Although row,column matrix manipulation is a straightforward process for students that have taken a linear algebra course, many engineering technology students are not familiar with the process. Although row,column matrix manipulation is a straightforward process for students that have taken a linear algebra course, many engineering technology students are not familiar with the process.

36 Although, the discussion of linear block codes is not mathematically complicated, it is mathematically tortuous with many mathematical turns. Although, the discussion of linear block codes is not mathematically complicated, it is mathematically tortuous with many mathematical turns.

37 Finally, the discussion for the (7,4) cyclic code is relatively benign with a manageable number of calculations. Finally, the discussion for the (7,4) cyclic code is relatively benign with a manageable number of calculations.

38 For larger codes, the calculations become overwhelming, especially for the engineering technology student. For larger codes, the calculations become overwhelming, especially for the engineering technology student.

39 In order to In order to –better manage larger codes, –relieve the mathematical stress on engineering technology students, and –focus on the application of block codes rather than the mathematics; the MATLAB Communications Toolbox provides a set of cyclic code functions. the MATLAB Communications Toolbox provides a set of cyclic code functions.

40 Consider the problem with a (15,7) cyclic code with the following generator polynomial. that corresponds to the code word 1x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x8x8 x7x7

41 The nonsystematic cyclic code generating matrix, G, is:

42 And the systematic cyclic code generating matrix is

43 By using the function cyclpoly, MATLAB yields a set of all generating polynomials By using the function cyclpoly, MATLAB yields a set of all generating polynomials >> p=cyclpoly(15,7,'all') p = 1 0 0 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 0 1 1 1 1 0 1 0 0 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1

44 By using the function cyclgen, the nonsystematic generating matrix, genmat, is derived as follows: >> genpoly=[1 1 0 1 1 1 0 1 1]; >>[parmat,genmat]=cyclgen(15,genpoly,'nonsys')

45 genmat = Columns 1 through 13 Columns 1 through 13 1 1 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 0 1 1 0 1 1 1 0 1 0 0 0 0 0 1 1 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 1 1 1 0 Columns 14 through 15 0 0 0 0 1 0 1 0

46 which is in matrix form.

47

48 Likewise, the systematic generating matrix, genmatsys, can be computed using cyclgen without the conditional parameter (nonsys): >> genpoly=[1 1 0 1 1 1 0 1 1]; >>[parmat,genmat]=cyclgen(15,genpoly)

49 genmatsys = Columns 1 through 12 1 1 0 1 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 1 1 0 1 0 0 0 0 1 0 1 1 1 0 1 1 0 0 0 0 Columns 13 through 15 0 0 0 1 0 0 0 1 0 0 0 1

50 which is in matrix form.

51 The (15,7) code produces 32,768 (215) possible code words of which 128 (27) are valid code words. The (15,7) code produces 32,768 (215) possible code words of which 128 (27) are valid code words. –Needless to say, picking the right 128 valid codes out of 32,768 possibilities is a frightening task.

52 The Communications Toolbox provides an encode function that alleviates much of this mathematical anxiety. The Communications Toolbox provides an encode function that alleviates much of this mathematical anxiety. >> data=(0:127); >> c=de2bi(data,'left-msb'); >> valid_code=encode(c,15,7,'cyclic',genpoly)

53 valid_code = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 1 0 0 0 0 0 0 1 1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 1 1 0 1 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 information code

54 Conclusion

55 The MATLAB Communications Toolbox derives the same generating matrices that are derived by mathematical manipulation. The MATLAB Communications Toolbox derives the same generating matrices that are derived by mathematical manipulation. –The underlying result is that the electronic engineering technology student can apply more effort in understanding the theory rather than the mathematics, especially when considering more complex problems.

56 By reducing the mathematical anxiety, students can concentrate more attentively on the actual nuances of block coding, and the instructor can move from theoretical foundation of cyclic codes to the circuit implementation of cyclic codes. By reducing the mathematical anxiety, students can concentrate more attentively on the actual nuances of block coding, and the instructor can move from theoretical foundation of cyclic codes to the circuit implementation of cyclic codes.


Download ppt "USING THE MATLAB COMMUNICATIONS TOOLBOX TO LOOK AT CYCLIC CODING Wm. Hugh Blanton East Tennessee State University"

Similar presentations


Ads by Google