Returns the code dictionary for source using Shannon-Fano algorithm. Dictionary is built from symbol_probabilities using the Shannon-Fano scheme. Output is a dictionary cell-array, which are codewords, and correspond to the order of input probability.
cw = shannonfanodict (1:4, [0.5 0.25 0.15 0.1]); assert (redundancy (cw, [0.5 0.25 0.15 0.1]), 0.25841, 0.001) shannonfanodict (1:5, [0.35 0.17 0.17 0.16 0.15]) shannonfanodict (1:8, [8 7 6 5 5 4 3 2] / 40)
See also: shannonfanoenc, shannonfanodec.
Package: communications