Presentation is loading. Please wait.

Presentation is loading. Please wait.

MAT 105 Spring 2008.  A binary code is a system for encoding data made up of 0’s and 1’s  Examples  Postnet (tall = 1, short = 0)  UPC (dark = 1,

Similar presentations


Presentation on theme: "MAT 105 Spring 2008.  A binary code is a system for encoding data made up of 0’s and 1’s  Examples  Postnet (tall = 1, short = 0)  UPC (dark = 1,"— Presentation transcript:

1 MAT 105 Spring 2008

2  A binary code is a system for encoding data made up of 0’s and 1’s  Examples  Postnet (tall = 1, short = 0)  UPC (dark = 1, light = 0)  Morse code (dash = 1, dot = 0)  Braille (raised bump = 1, flat surface = 0)  Movie ratings (thumbs up = 1, thumbs down = 0)

3  CD, MP3, and DVD players, digital TV, cell phones, the Internet, space probes, etc. all represent data as strings of 0’s and 1’s rather than digits 0-9 and letters A-Z  Whenever information needs to be digitally transmitted from one location to another, a binary code is used

4  What are some problems that can occur when data is transmitted from one place to another?  The two main problems are  transmission errors: the message sent is not the same as the message received  security: someone other than the intended recipient receives the message

5  Suppose you were looking at a newspaper ad for a job, and you see the sentence “must have bive years experience”  We detect the error since we know that “bive” is not a word  Can we correct the error?  Why is “five” a more likely correction than “three”?  Why is “five” a more likely correction than “nine”?

6  Suppose NASA is directing one of the Mars rovers by telling it which crater to investigate  There are 16 possible signals that NASA could send, and each signal represents a different command  NASA uses a 4-digit binary code to represent this information 0000010010001100 0001010110011101 0010011010101110 0011011110111111

7  The problem with this method is that if there is a single digit error, there is no way that the rover could detect or correct the error  If the message sent was “0100” but the rover receives “1100”, the rover will never know a mistake has occurred  This kind of error – called “noise” – occurs all the time

8  One way to try to avoid these errors is to send the same message twice  This would allow the rover to detect the error, but not correct it (since it has no way of knowing if the error occurs in the first copy of the message or the second)  There is a better way to allow the rover to detect and correct these errors, and only requires 3 additional digits

9  The original message is four digits long  We will call these digits I, II, III, and IV  We will add three new digits, V, VI, and VII  Draw three intersecting circles as shown here  Digits V, VI, and VII should be chosen so that each circle contains an even number of ones III IV II I VII VVI

10  The message we want to send is “0100”  Digit V should be 1 so that the first circle has two ones  Digit VI should be 0 so that the second circle has zero ones (zero is even!)  Digit VII should be 1 so that the last circle has two ones  Our message is now 0100101 0 0 1 0 1 10

11  Now watch what happens when there is a single digit error  We transmit the message 0100101 and the rover receives 0101101  The rover can tell that the second and third circles have odd numbers of ones, but the first circle is correct  So the error must be in the digit that is in the second and third circles, but not the first: that’s digit IV  Since we know digit IV is wrong, there is only one way to fix it: change it from 1 to 0 0 1 1 0 1 10

12  Encode the message 1110 using this method  You have received the message 0011101. Find and correct the error in this message.

13  This method only allows us to encode 16 possible messages, which isn’t even enough to represent the alphabet!  However, if we use more digits, we won’t be able to use the circle method to detect and correct errors  We’ll have to come up with a different method that allows for more digits

14  The circle method is a specific example of a “parity check sum”  The “parity” of a number is 1 is the number is odd and 0 if the number is even  For example, digit V is 0 if I + II + III is even, and 1 if I + II + III is odd

15  Instead of using Roman numerals, we’ll use a 1 to represent the first digit of the message, a 2 to represent the second digit, and so on  We’ll use c 1 to represent the first check digit, c 2 to represent the second, etc.

16  Using this notation, our rules for our check digits become  c 1 = 0 if a 1 + a 2 + a 3 is even  c 1 = 1 if a 1 + a 2 + a 3 is odd  c 2 = 0 if a 1 + a 3 + a 4 is even  c 2 = 1 if a 1 + a 3 + a 4 is odd  c 3 = 0 if a 2 + a 3 + a 4 is even  c 3 = 1 if a 2 + a 3 + a 4 is odd a3a3 a4a4 a2a2 a1a1 c3c3 c1c1 c2c2

17  If we want to have a system that has enough code words for the entire alphabet, we need to have 5 message digits: a 1, a 2, a 3, a 4, a 5  We will also need more check digits to help us decode our message: c 1, c 2, c 3, c 4

18  We can’t use the circles to determine the check digits for our new system, so we use the parity notation from before  c 1 is the parity of a 1 + a 2 + a 3 + a 4  c 2 is the parity of a 2 + a 3 + a 4 + a 5  c 3 is the parity of a 1 + a 2 + a 4 + a 5  c 4 is the parity of a 1 + a 2 + a 3 + a 5

19  Using 5 digits in our message gives us 32 possible messages, we’ll use the first 26 to represent letters of the alphabet  On the next slide you’ll see the code itself, each letter together with the 9 digit code representing it

20 LetterCodeLetterCode A000000000N011010101 B000010111O011101100 C000101110P011111011 D000111001Q100001011 E001001101R100011100 F001011010S100100101 G001100011T100110010 H001110100U101000110 I010001111V101010001 J010011000W101101000 K010100001X101111111 L010110110Y110000100 M011000010Z110010011

21  Now that we have our code, using it is simple  When we receive a message, we simply look it up on the table  But what happens when the message we receive isn’t on the list?  Then we know an error has occurred, but how do we fix it? We can’t use the circle method anymore

22  Using this new system, how do we decode messages?  Simply compare the (incorrect) message with the list of possible correct messages and pick the “closest” one  What should “closest” mean?  The distance between the two messages is the number of digits in which they differ

23  What is the distance between 1100101 and 1010101?  The messages differ in the 2 nd and 3 rd digits, so the distance is 2  What is the distance between 1110010 and 0001100?  The messages differ in all but the 7 th digit, so the distance is 6

24  The nearest neighbor decoding method decodes a received message as the code word that agrees with the message in the most positions

25  Suppose that, using our alphabet code, we receive the message 010100011  We can check and see that this message is not on our list  How far away is it from the messages on our list?

26 CodeDistanceCodeDistance 00000000040110101015 00001011140111011005 00010111040111110113 00011100141000010114 00100110161000111008 00101101061001001014 00110001121001100104 00111010061010001106 01000111131010100016 01001100051011010006 01010000111011111116 01011011031100001005 01100001031100100113

27  Since 010100001 was closest to the message that we received, we know that this is the most likely actual transmission  We can look this corrected message up in our table and see that the transmitted message was (probably) “K”  This might still be incorrect, but other errors can be corrected using context clues or check digits


Download ppt "MAT 105 Spring 2008.  A binary code is a system for encoding data made up of 0’s and 1’s  Examples  Postnet (tall = 1, short = 0)  UPC (dark = 1,"

Similar presentations


Ads by Google