huffman.m

版本 1.0.0.0 (1.2 KB) 作者: Sean Danaher
Huffman
16.6K 次下载
更新时间 1998/6/4

无许可证

[CODE,COMPRESSION]=HUFFMAN5(P)

P is the probability (or number of occurences) of each alphabet symbol
CODE gives the huffman code in a string format of ones and zeros
COMPRESSION gives the compression rate

Huffman5 works by first building up a binary tree (eg p =[ .5 .2 .15 .15])

Such that the tree always terminates at an alphabet symbol and the symbols furthest away from the root have the lowest probability. The branches at each level are labeled 0 and 1.

For this example CODE would be
1
00
010
011
and the compression rate 1.1111

引用格式

Sean Danaher (2024). huffman.m (https://www.mathworks.com/matlabcentral/fileexchange/227-huffman-m), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R10
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Large Files and Big Data 的更多信息
标签 添加标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0