1 / 51

Hamming Distance, minimum hamming Distance, Hamming code, error detection & correction

Hamming code is a set of error-correction codes that can be used to detect and correct the errors that can occur when the data is moved or stored from the sender to the receiver.

Sethi
Télécharger la présentation

Hamming Distance, minimum hamming Distance, Hamming code, error detection & correction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hamming Distance, minimum hamming Distance, Hamming code, error detection & correction

  2. Hamming distance Hamming distance between two strings is the number of positions at which the corresponding symbols are different. The Hamming distance between two strings, a and b is denoted as d(a , b). It is named after the American mathematician Richard Hamming.

  3. Example :

  4. For binary numbers we can find hamming distance by xoroperaton The number of 1’s in output will be hamming distance

  5. As we observed in examples there is a condition to find hamming distance that is The length of the strings for which we want to find hamming distance must be equal.

  6. Applications: • It is used for error detection or error correction when data is transmitted over computer networks. • It is also using in coding theory for comparing equal length data words. • It is used to determine the number of distorted bits in a binary word as a way to estimate error. • In the biological realm, it is also used to determine genetic distance.

  7. Minimum hamming distance

  8. The minimum Hamming distance is used to define some essential notions in coding theory, such as error detecting and error correcting codes. In particular, a codeC is said to be k error detecting if, and only if, the minimum Hamming distance between any two of its code words is at least k+1

  9. To find out the minimum hamming distance by comparing the two code words correspondingly;  There are two methods to find out the distance b/w two code words , i.e.; • Through XOR truth table. • And by comparing the difference between two code words.

  10. Through Xor Truth table : • For Example : C1 = 0 0 1 0 C2 = 1 1 0 1 C3 = 0 1 1 0 Find the minimum hamming distance through XOR table. Firstly we compare the two code words i-e; C1 & C2 +

  11. As we know : C1 = 0 0 1 0 C2 = 1 1 0 1 dmin = 1 1 1 1  To find out the minimum hamming distance we can add all those 1’s or simply we can say that count all those number of 1’s after applying XOR truth table. . The total no of 1’s in above case is : 4 So the distance b/w C1 & C2 is 4.

  12. Now , Calculate the distance b/w C2 and C3: C2 = 1 1 0 1 C3 = 0 1 1 0 dmin = 1 0 1 1 So the difference b/w these two code words is : 1+1+1 = 3  Now , find the distance b/w C3 and C1.

  13. C1 = 0 0 1 0 C3 = 0 1 1 0 d = 0 1 0 0 So the diff b/w these two code words is : 1 Now comparing all the distance :- • The distance b/w C1 & C2 is : 4 • The distance b/w C2 & C3 is : 3 • The distance b/w C1 & C3 is : 1 The minimum distance b/w all these differences is “1”

  14. Another way to find out minimum hamming distance That is the second and easiest method to find out the minimum hamming distance between code words. In this , we have to just count the differences by comparing the two code words. For example : C1 = 1 1 0 C2 = 0 0 0 C3 = 1 0 0

  15. At first , compare C1 and C2 C1 = 1 1 0 C2 = 0 0 0 1st diff 2nd diff The total no of difference between is : 2 • Now , compare C2 and C3

  16. C2 = 0 0 0 C3 = 1 0 0 1st diff The difference between C2 and C3 is : 1 • Now , compare C1 and C3 : C1 = 1 1 0 C3 = 1 0 0 1st diff

  17. So the difference between C1 and C3 is also: 1  In this example the minimum hamming distance is ‘1’ • Here are some examples to find out the minimum hamming distance by your own choice (through XOR and by comparing differences b/w two code words) Example 1: C1 = 0 0 0 C2 = 1 1 1 C3 = 0 1 1 * The distance b/w C1 and C2 is : 3 * The distance between C2 and C3 is : 1 * And the distance between C3 and C1 is : 2  So the minimum hamming distance b/w all these differences is : 1

  18. Example 2: a = 1 1 1 0 b = 0 0 1 1 c = 1 0 0 0 * The distance b/w a & b is : 3 * The distance between b & c is : 3 * And the distance between a & c is : 2  So the minimum hamming distance b/w all these differences is : 2

  19. Hamming Code Hamming code is a block code that is capable of detecting up to two simultaneous bit errors and correcting single-bit errors. It was developed by R.W. Hamming for error correction. In this coding method, the source encodes the message by inserting redundant bits within the message.

  20. Hamming Code • Hamming Codes are linear block codes. • It is an error correcting code. • Parity bits are used here. • They are inserted in between the data bits. • The most commonly used is 7-bit hamming code. https://www.youtube.com/watch?v=QSiuqhb7sw8

  21. Structure • 7-bit hamming code. 7 6 4 1 2 3 5 20 21 22 D Data Bits P Parity Bits 2m , m = 0,1,2,3,4,5… https://www.youtube.com/watch?v=QSiuqhb7sw8

  22. Deciding the values for parity bits 7 6 4 1 2 3 5 111 110 101 100 011 010 001 P1(1,3,5,7) D Data Bits P Parity Bits https://www.youtube.com/watch?v=QSiuqhb7sw8

  23. Deciding the values for parity bits 7 6 4 1 2 3 5 111 110 101 100 011 010 001 P2(2,3,6,7) D Data Bits P Parity Bits https://www.youtube.com/watch?v=QSiuqhb7sw8

  24. Deciding the values for parity bits 7 6 4 1 2 3 5 111 110 101 100 011 010 001 P3(4,5,6,7) D Data Bits P Parity Bits https://www.youtube.com/watch?v=QSiuqhb7sw8

  25. A bit word 1011 is to be transmitted. Construct the even parity7-bit hamming code for this data. ?To be decided Decide P1 Considered bits: 1,3,5,7 = __ ,1 , 1 , 1 https://www.youtube.com/watch?v=QSiuqhb7sw8

  26. A bit word 1011 is to be transmitted. Construct the even parity7-bit hamming code for this data. ?To be decided Decide P1 Considered bits: 1,3,5,7 = 1 ,1 , 1 , 1 https://www.youtube.com/watch?v=QSiuqhb7sw8

  27. A bit word 1011 is to be transmitted. Construct the even parity7-bit hamming code for this data. Decide P2 Considered bits: 2,3,6,7 = __ , 1, 0 , 1 https://www.youtube.com/watch?v=QSiuqhb7sw8

  28. A bit word 1011 is to be transmitted. Construct the even parity7-bit hamming code for this data. Decide P2 Considered bits: 2,3,6,7 = 0 , 1, 0 , 1 https://www.youtube.com/watch?v=QSiuqhb7sw8

  29. A bit word 1011 is to be transmitted. Construct the even parity7-bit hamming code for this data. Decide P3 Considered bits:4,5,6,7 = __, 1, 0 , 1 https://www.youtube.com/watch?v=QSiuqhb7sw8

  30. A bit word 1011 is to be transmitted. Construct the even parity7-bit hamming code for this data. Decide P3 Considered bits:4,5,6,7 = 0 , 1, 0 , 1 https://www.youtube.com/watch?v=QSiuqhb7sw8

  31. Hamming Error Detection and Error Correction

  32. Data can be corrupted during transmission. For reliable communication ,errors must be detected and corrupted.

  33. What is ERROR? • Error is condition when the output information's does not match with the input information. • During transmission digital signals suffer from noise that can introduce errors in the binary bits travelling from one system to other that means a 0 bit may change to 1 or a 1 bit may change to 0.

  34. Types of Error: • Single bit error. • Multi bit error. • Burst bit error.

  35. Hamming Code: Error Detection •  Identify the bit position of the data & all the bit positions which are powers of 2 are marked as parity bits (e.g. 1, 2, 4, 8, etc.). • Example: The following image will help in visualizing the received hamming code of 7 bits.

  36. What is Parity Bit? • Parity bit is a bit appended to the data bits which ensures that the total number of 1's are even (even parity) or odd (odd parity). • While checking the parity, if the total number of 1's are odd then write the value of parity bit P1(or P2 etc.) as 1 (which means the error is there ). • If it is even then the value of parity bit is 0 (which means no error).

  37. Hamming Code: Error Detection • Error Detection: • Error detection is the detection of the error caused by noise or other impairments during transmission from the transmitter to the receiver.

  38. Error Detection Step 1: For checking parity bit P1, use check one and skip one method, which means, starting from P1 and then skip P2, take D3 then skip P4 then take D5, and then skip D6 and take D7, this way we will have the following bits, As we can observe the total number of bits are odd so we will write the value of parity bit as P1 = 1. This means error is there.

  39. Error Detection • Step 2: Check for P2 but while checking for P2, we will use check two and skip two method, which will give us the following data bits. But remember since we are checking for P2, so we have to start our count from P2 (P1 should not be considered). As we can observe that the number of 1's are even, then we will write the value of P2 = 0. This means there is no error.

  40. Error Detection Step 3: Check for P4 but while checking for P4, we will use check four and skip four method, which will give us the following data bits. But remember since we are checking for P4, so we have started our count from P4(P1 & P2 should not be considered). As we can observe that the number of 1's are odd, then we will write the value of P4 = 1.

  41. Error Detection • This means the error is there. • So, from the above parity analysis, P1 & P4 are not equal to 0, so we can clearly say that the received hamming code has errors.

  42. Hamming Code: Error Correction Error correction is the detection of the errors and reconstruction of the original, error-free data.

  43. Hamming Code: Error Correction • Since we found that received code has an error, so now we must correct them. To correct the errors, use the following steps: • Now the error word E will be • Now we have to determine the decimal value of this error word 101 which is 5 (2^2 *1 + 2^1 * 0 + 2^0 *1 = 5).

  44. Hamming Code: Error Correction • We get E = 5, which states that the error is in the fifth data bit. To correct it, just invert the fifth data bit. • So the correct data will be:

  45. Hamming Code: Error Correction

  46. Advantages • The main advantage of using a hamming code is cost-effective if a data stream contains single-bit errors. • It can provide error detection and also indicates the bit which contains an error for correction. • Hamming codes are very easy and best to use in computer memory and single-bit error correction and detection. https://www.elprocus.com/what-is-hamming-code-history-working-and-its-applications/

  47. Disadvantages • It is best only for single-bit error correction and detection. If multiple bits errors, then the entire can be corrupted. • The Hamming code algorithm can resolve only single-bit errors. https://www.elprocus.com/what-is-hamming-code-history-working-and-its-applications/

  48. Applications • Hamming codes are used in, • Computing • Telecommunications • Data compression • Solving puzzles and turbo codes • Satellites • Plasma CAM • Shielded wires • Modems • Computer memory • Open connectors • Embedded systems and processor https://www.elprocus.com/what-is-hamming-code-history-working-and-its-applications/

More Related