huffman Huffman Coding Toolbox

Huffman Coding Toolbox >> Huffman Coding Toolbox > huffmandict

huffmandict

Huffman Coding based upon a symbol vector with known propability

Calling Sequence

[QM,L,avglen,entr,eff]=huffmandict(SB,h)

Parameters

SB:

a vector, representing symbols

h:

a probability vector containing the probability of each entry in SB. Must have the same length as SB

QM:

the complete code table as string vector. The symbol, the bit sequence and the number of bits are contained.

L:

number of bits used for coding the corresponding symbol

avglen:

Average Length based on rel. propabilities and the Sybmol length

entr:

Entropy of H

eff:

Efficiency of the Huffman Coding

Description

This function creates the coding tree based upon a given histogram.

Examples

symbols = [1:5];
p = [.3 .3 .2 .1 .1];

[QM,L,avglen,entr,eff]=huffmandict(symbols,p);

// L contains the number of bits used for the symbols
disp(L);
// QM is the complete code table,
// containing symbol, bits and no. of bits
disp(QM);

See also

Authors

huffman Huffman Coding Toolbox