x3x4x5x6x7 X x1x2
5.1设信源 = 0.20.190.180.170.150.10.01 ()PX
(1)求信源熵H(X);
(2)编二进制香农码;
(3)计算平均码长和编码效率。
解:(1)
H(X)= ∑p(xi)log2p(xi)
i=
1
7
= (0.2×log20.2+0.19×log20.19+0.18×log20.18+0.17×log20.17+0.15×log20.15+0.1×log20.1+0.01×log20.01)=2.609bit/symbol
K=∑kip(xi)=3×0.2+3×0.19+3×0.18+3×0.17+3×0.15+4×0.1+7×0.01
i
=3.14
η=
H(X)H(X)2.609
===83.1%R3.14K
x3x4x5x6x7 X x1x2
5.2对信源 =
0.20.190.180.170.150.10.01 编二进制费诺码,计算编码效率。PX()
=∑kip(xi)=2×0.2+3×0.19+3×0.18+2×0.17+3×0.15+4×0.1+4×0.01
i
=2.74
H(X)H(X)2.609η====95.2%
R2.74K