Huffman Coding based upon a histogram vector
[SB,h,L,QM,avglen,entr,eff]=huffman(H)
a histogram vector (also sparse input possible)
a vector, representing symbols
the normalized histogram vector
number of bits used for coding the corresponding symbol
the complete code table as string vector. The symbol, the bit sequence and the number of bits are contained.
Average Length based on rel. propabilities and the Sybmol length
Entropy of H
Efficiency of the Huffman Coding
This function creates the coding tree based upon a given histogram.
// Generate a Testmatrix A=testmatrix('frk',10)+1; H1=fasthist(A); // [SB,h,L,QM]=huffman(H1); //SB contains the symbols disp(SB); // h is the normalized histogram disp(h); // 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);