| Communications Toolbox | ![]() |
Huffman coding offers a way to compress data. The average length of a Huffman code depends on the statistical frequency with which the source produces each symbol from its alphabet. A Huffman code dictionary, which associates each data symbol with a codeword, has the property that no codeword in the dictionary is a prefix of any other codeword in the dictionary.
The huffmandict, huffmanenco, and huffmandeco functions support Huffman coding and decoding.
Note For long sequences from sources having skewed distributions and small alphabets, arithmetic coding compresses better than Huffman coding. To learn how to use arithmetic coding, see Arithmetic Coding. |
| Example: A µ-Law Compander | Creating a Huffman Code Dictionary | ![]() |
© 1994-2005 The MathWorks, Inc.