The task for this week was to implement a block code of our choice for a binary channel and simulate a transmission through a noisy channel.
Block codes are error-correcting codes designed to recover from one or more transmission error and allow determining what code word the message corresponds to even in the presence of errors.
For this task I chose Hamming code. This error-correcting code encodes 4 bits of data into 7 bits using a specific matrix, this process add 3 parity bits; Hamming code can only correct errors of 1 bit and if it is an error in 2 bits this code just detect it but it doesn't correct it.
I relied on the Encoding and Decoding with the Hamming Code pdf of the University of Wyoming and with numpy of python was easier.
Hamming Code
The result of the multiplication between the message and this matrix produces a vector of four bits.
Now imagine this message is sent through a noisy channel. To check if the message has errors, first the received message (y) is transposed and multiplied, but now with the decode matrix.
The result of the multiplication between the message and this matrix produces a vector of three bits, if in the vector are just 0's that means that the message has no errors, but if the vector has 1's it tells us that has errors, but it is easy to detect the position of the bit with error because the resultant vector is a binary number and if we transform it we can know in which position is the error.
Test.
The program ask for the total bits in the message (in this case is always 4), the total of repetitions that the program has to simulate the transmissions, the percentage of error (to simulate the noisy channel) and the number of bits that are going to have an error.Images of the tests:
As you can see I get better results when I test with a single bit error than when it has 2 bits with errors, thats because this block code just detect the errors but doesn't correct them when there are 2 bits with errors.
No comments:
Post a Comment