Uniquely Decodable Code using MATLAB
A code is distinct if each codeword is recognizable from every other (i.e., the planning from source messages to codewords is coordinated). A distinct code is extraordinarily decodable if each codeword is recognizable when drenched in a grouping of codewords or if the first source arrangement can be remade consummately from the encoded binary sequence.
Test for Unique Decodability:
- Consider two codewords A and B. A is of k bits and B is of n bits(k<n), if the first k bits of B are identical to A, then A is called a prefix of B, the remaining last n-k bits are called as the dangling suffix. Example: A = 010, B = 01001, the dangling suffix is 01.
- Construct a list of all the code words, examine all pair of code words to see if any codeword is a prefix of another, whenever such a pair is present add a dangling suffix to the list unless you have added the same dangling suffix to the list in a previous iteration.
- Keep repeating the procedure for the extended list until all codewords are compared.
- You get a dangling suffix which is a code word.
- There is no dangling suffix present.
- The dangling suffix is not a code word.
- If you get point 5 as an outcome the code is not uniquely decodable.
- In all other cases, it is uniquely decodable.
'0, 01, 011, 0111' is an Uniquely decodable code '0, 1, 00, 11' is not an uniquely decodable code
'0' '01' '011' '0111' Code is Uniquely Decodable