Function File: shannonfanoenco (hcode, dict)

Returns the Shannon-Fano encoded signal using dict. This function uses a dict built from the shannonfanodict and uses it to encode a signal list into a Shannon-Fano code. Restrictions include a signal set that strictly belongs in the range [1,N] with N = length (dict). Also dict can only be from the shannonfanodict routine. An example use of shannonfanoenco is

hd = shannonfanodict (1:4, [0.5 0.25 0.15 0.10]);
shannonfanoenco (1:4, hd)
    ⇒ [0 1 0 1 1 0 1 1 1 0]

See also: shannonfanodeco, shannonfanodict.

Package: communications