### Highlights from huffman

3.25
3.2 | 8 ratings Rate this file 16 Downloads (last 30 days) File Size: 9.58 KB File ID: #228

# huffman

### Karl Skretting (view profile)

A set of MATLAB m-files (version 5.2) which do complete Huffman Coding.

File Information
Description

A set of MATLAB m-files (version 5.2) which do complete Huffman Coding.

The files are:

hufflen: Based on probability (or number of occurences) of each symbol the length for the Huffman codewords are calculated.

ex: HL = hufflen(S);

huffcode: Based on the codeword lengths this function find the Huffman codewords

ex: HK = huffcode(HL);

hufftree: Make the Huffman-tree from the length of Huffman codes

ex: Htree = hufftree(HL);

huff03: Huffman encoder/decoder, one or two vectors of non-negative integers are huffman coded.

ex: y = huff03(x1, x2); % encoding
ex: [x1, x2] = huff03(y); % decoding

MATLAB release MATLAB 5.2 (R10)
12 Nov 2007 milind tandel
12 Mar 2007 Faisal Alhajri

It`s not bad. However, I think you can make it more simple and efficient. It`s too long and it needs three other function beside the orginal one, you can combine them in one function and much less lines. it's going to be then more faster in execution and less error. I have made one but still in progress. anyway, mine is much less lines than this one. You are like trying to execute 1+1 in this manner y = 1, x = 1, and z = y, s = x, then g = z + s.
Good luck man.

25 Dec 2006 mickey mickey

gooooooood

25 Oct 2005 bala sundaram

its really nice

the coding process is not running correctly it fails in encoding itself help for it

21 Apr 2004 George Castle

I tried using a square wave with a long period and the compression was no different than for a random sequence. There appears to be a bug that needs fixing first.

19 Apr 2004 Afshin David

Doesn't seem to work, e.g., for a constant sequence it gives irrelevant codewords.

05 Dec 2003 akam paul

I try it