大家好,小东方来为大家解答以上的问题。哈夫曼编码matlab仿真,哈夫曼编码matlab这个很多人还不知道,现在让我们一起来看看吧!
1、Matlab自带Huffman函数(ps:你拼写错了)huffmandeco Huffman decoderhuffmandict Generate Huffman code dictionary for a source with known probability modelhuffmanenco Huffman encoder密码生成:symbols = [1 2 3]; % Data symbolsp = [0.1 0.1 0.8]; % Probability of each data symboldict = huffmandict(symbols,p) % Create the dictionary.dict{1,:} % Show one row of the dictionary.加密解密:sig = repmat([3 3 1 3 3 3 3 3 2 3],1,50); % Data to encodesymbols = [1 2 3]; % Distinct data symbols appearing in sigp = [0.1 0.1 0.8]; % Probability of each data symboldict = huffmandict(symbols,p); % Create the dictionary.hcode = huffmanenco(sig,dict); % Encode the data.dhsig = huffmandeco(hcode,dict); % Decode the code.。
本文到此分享完毕,希望对大家有所帮助。