| Communications Toolbox | ![]() |
Arithmetic coding requires statistical information about the source of the data being encoded. In particular, the counts input argument in the arithenco and arithdeco functions lists the frequency with which the source produces each symbol in its alphabet. You can determine the frequencies by studying a set of test data from the source. The set of test data can have any size you choose, as long as each symbol in the alphabet has a nonzero frequency.
For example, before encoding data from a source that produces 10 x's, 10 y's, and 80 z's in a typical 100-symbol set of test data, define
counts = [10 10 80];
Alternatively, if a larger set of test data from the source contains 22 x's, 23 y's, and 185 z's, then define
counts = [22 23 185];
| Arithmetic Coding | Example: Creating and Decoding an Arithmetic Code | ![]() |
© 1994-2005 The MathWorks, Inc.