Scilab Function
Last update : 06/02/2007
huffman - Huffman Coding based upon a histogram
vector
Calling Sequence
-
[SB,h,L,QM]=huffman(H)
Parameters
-
H
: a histogram vector (also sparse input possible)
-
SB
: a vector, representing symbols
-
h
: the normalized histogram vector
-
L
: number of bits used for coding the corresponding symbol
-
QM
: the complete code table as string vector. The symbol, the bit
sequence and the number of bits are contained.
Description
-
This function creates the coding tree based upon a given
histogram.
Examples
// 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);
// End of demo
See Also
huffcode
,
fasthist
,
Authors
-
Dr. Andreas Geissler
geisslea@web.de