x5 x6 0.08 0.88 3.64386 1110 4 0.04 0.96 4.64386 11110 5 其码字为00 010 100 101 1110 11110
HL(X)?? k2.35? 0.32?2?(0.22?0.18?0.16)?3?0.08?4?0.04?51
2.35??82.75%2.84 (3)
x1x2x3x4x5x60x1x2011x3x4x5x601x4x5x6x1x2x301x5x6x40x51x6
其码字为00 01 10 110 1110 1111
16
???HL(X)k2.35(0.32?0.22?0.18)?2?0.16?3?(0.08?0.04)?41?97.92%(4)
其码字为11 01 00 101 1001 1000
17
???HL(X)k2.35(0.32?0.22?0.18)?2?0.16?3?(0.08?0.04)?41?97.92%(5)
0.3200.1810
10.22200.0410.0820.16其码字为0 11 10 122 121 120。
???HL(X)k2.350.31?1?(0.22?0.18)?2?(0.04?0.08?0.16)?3?log231?76%
(6)由题意知,要遍个无失真二进制编码,其码字的个数必须大于等于6,
当wi?2时,只有4个小于6,其编码必失真
当wi?3时,有8个大于6,编码满足要求,故
18
k?KL3log2m?log22?3比特/信源符号) L1HL(X)2.35??78.33%
3k??3-12 已知一信源包含8个符号,其出现的概率为 P(X)={0.1,0.18,0.4,0.05,0.06,
0.1,0.07,0.04}。
(2)对这8个符号作哈夫曼编码,写出相应码字,并求出编码效率。 (3)采用香农编码,写出相应码字,求出编码效率。 (4)进行费诺编码,写出相应码字,求出编码效率。 解: (2)
00.400.37100.0910.050.10.060.07010.230.1910.10010.13101.0010.60
0.18
0
0.04其码字为0 110 100 1111 1011 1010 11101 11100
HL(X)k???2.550.4?1?(0.18?0.1)?3?(0.1?0.07?0.06)?4?(0.05?0.04)?51?97.7% 19
(3) 信源消息符号xi 符号概率累加概率p(xi) pi ??log2p(xi)? 码字 码字长度 x1 0.4 0 1.32193 00 2 x2 x3 0.18 0.4 2.47393 011 3 0.1 0.58 3.32193 1001 4 x4 x5 x6 x7 x8 ???HL(X)k0.1 0.68 3.32193 1010 4 0.07 0.78 3.8365 1100 4 0.06 0.85 4.05889 11011 5 0.05 0.91 4.32193 11101 5 0.04 0.96 4.64386 11110 5 2.550.4?2?0.18?3?(0.1?0.1?0.07)?4?(0.06?0.05?0.04)?512.55?80.4%3.17?20