第三次作业
5、给定如表4-9所示的概率模型,求出序列a1a1a3a2a3a1 的实值标签。
由题意可得:
字符集{a1,a2,a3} , 其中p(a1)=0.2 ,p(a2)=0.3 ,p(a3)=0.5
我们可以利用公式确定标签所在的上下限。
利用更新公式,可得:
l(1) =0+(1-0)Fx(0)=0
u(1) =0+(1-0)Fx(1)=0.2
可得序列a1a1的标签所在的区间为[0,0.2)
该序列的第2个元素为a1,利用更新公式,可得:
l(2) =0+(0.2-0)Fx(0)=0
u(2) =0+(0.2-0)Fx(1)=0.04
可得序列a1a1的标签所在的区间为[0,0.04)
该序列的第3个元素为a3,利用更新公式,可得:
l(3) =0+(0.04-0)Fx(2)=0.02
u(3) =0+(0.04-0)Fx(3)=0.04
可得序列a1a1a3的标签所在的区间为[0.02,0.04)
该序列的第4个元素为a2,利用更新公式,可得:
l(4) =0.02+(0.04-0.02)Fx(1)=0.024
u(4) =0.02+(0.04-0.02)Fx(2)=0.03
可得序列a1a1a3a2的标签所在的区间为[0.024,0.03)
该序列的第5个元素为a3,利用更新公式,可得:
l(5) =0.024+(0.03-0.024)Fx(2)=0.027
u(5) =0.024+(0.03-0.024)Fx(3)=0.03
可得序列a1a1a3a2a3的标签所在的区间为[0.027,0.03)
该序列的第6个元素为a1,利用更新公式,可得:
l(6) =0.027+(0.03-0.027)Fx(0)=0.027
u(6) =0.027+(0.03-0.027)Fx(1)=0.0276
可以生成序列a1a1a3a2a3a1的标签如下:
Tx(a1a1a3a2a3a1)=(0.027+0.0276)/2=0.0273
6、对于表4-9所示的概率模型,对于一个标签为0.63215699的长度为10的序列进行解码。
由表4-9可知 Fx(k)=0, k≤0, Fx(1)=0.2, Fx(2)=0.5, Fx(3)=1, k>3.
令l(0)=0, u(0)=1。设玄素对应的序列为x1x2x3x4x5x6x7x8x9x10 ,则利用更新公式
x1
l(1)= l(0)+(u(0)- l(0))*Fx(x1-1)=Fx(x1-1)
u(1)= l(0)+(u(0)- l(0))*Fx(x1)=Fx(x1)
x1=1时,区间为[0,0.2]
x1=2时,区间为[0.2,0.5]
x1=3时,区间为[0.5,1]
因为0.63215699在区间[0.5,1]内,所以,第一个元素的序列为3,元素则为a3
x2
u(2)= l(1)+(u(1)- l(1))*Fx(x2)=0.5+(1-0.5)*Fx(x2)=0.5+0.5Fx(x2)
l(2)=l(1)+(u(1)-l(1))*Fx(x2-1)=0.5+(1-0.5)*Fx(x2-1)=0.5+0.5Fx(x2-1)
x2=1时,区间为[0.5,0.6]
x2=2时,则该区间为[0.6,0.75]
x2=3时,则该区间为[0.75,1]
因为 0.63215699在区间[0.6,0.75]内,所以,第二个元素的序列为2,元素则为a2
x3
u(3)= l(2)+(u(2)- l(2))*Fx(x3)=0.6+(0.75-0.6)*Fx(x2)=0.6+0.15Fx(x3)
l(3)= l(2)+(u(2)- l(2))*Fx(x3-1)=0.6+(0.75-0.6)*Fx(x2-1)=0.6+0.15Fx(x3-1)
x3=1时,区间为[0.6,0.63]
x3=2时,区间为[0.63,0.675]
x3=3时,区间为[0.675,0.75]
因为0.63215699在区间[0.63,0.675]内,所以,第三个元素的序列为2,元素则为a2
x4
u(4)=l(3)+(u(3)-l(3))*Fx(x4)=0.63+(0.675-0.63)*Fx(x4)=0.63+0.045*Fx(x4)
l(4)=l(3)+(u(3)-l(3))*Fx(x4-1)=0.63+(0.675-0.63)*Fx(x4-1)=0.63+0.045*Fx(x4-1)
x4=1时,区间为[0.63,0.639]
x4=2时,区间为[0.639,0.6525]
x4=3时,区间为[0.6525,0.675]
因为0.63215699在区间[0.63,0.639]内,所以,第四个元素的序列为1,元素则为a1
x5
u(5)=l(4)+(u(4)-l(4))*Fx(x5)=0.63+(0.639-0.63)*Fx(x5)=0.63+0.009*Fx(x5)
l(5)=l(4)+(u(4)-l(4))*Fx(x5-1)=0.63+(0.639-0.63)*Fx(x5-1)=0.63+0.009*Fx(x5-1)
x5=1时,区间为[0.63,0.6318]
x5=2时,区间为[0.6318,0.6345]
x5=3时,区间为[0.6345,0.639]
因为0.63215699在区间[0.6318,0.6345]内,所以,第五个元素的序列为2,元素则为a2
x6
u(6)=l(5)+(u(5)-l(5))*Fx(x6)=0.6318+(0.6345-0.6318)*Fx(x6)=0.6318+0.0027*Fx(x6)
l(6)=l(5)+(u(5)-l(5))*Fx(x6-1)=0.6318+(0.6345-0.6318)*Fx(x6-1)=0.6318+0.0027*Fx(x6-1)
x6=1,则该区间为[0.6318,0.63234]
x6=2,则该区间为[0.63234,0.63315]
x6=3,则该区间为[0.63315,0.6345]
因为0.63215699在区间[0.6318,0.63234]内,所以,第六个元素的序列为1,元素则为a1
x7
u(7)=l(6)+(u(6)-l(6))*Fx(x7)=0.6318+(0.63234-0.6318)*Fx(x7)=0.6318+0.00054*Fx(x7)
l(7)=l(6)+(u(6)-l(6))*Fx(x7-1)=0.6318+(0.63234-0.6318)*Fx(x7-1)=0.6318+0.00054*Fx(x7-1)
x7=1,则该区间为[0.6318,0.631908]
x7=2,则该区间为[0.631908,0.63207]
x7=3,则该区间为[0.63207,0.63234]
因为 0.63215699在区间[0.63207,0.63234],所以,第七个元素的序列为3,元素则为a3
x8
u(8)=l(7)+(u(7)-l(7))*Fx(x8)=0.63207+(0.63234-0.63207)*Fx(x8)=0.63207+0.00027*Fx(x8)
l(8)=l(7)+(u(7)-l(7))*Fx(x8-1)=0.63207+(0.63234-0.63207)*Fx(x8-1)=0.63207+0.00027*Fx(x8-1)
x8=1时,区间为[0.63207,0.632124]
x8=2时,区间为[0.632124,0.632205]
x8=3时,区间为[0.632205,0.63234]
因为0.63215699在区间[0.632124,0.632205]内,所以,第八个元素的序列为2,元素则为a2
x9
u(9)=l(8)+(u(8)-l(8))*Fx(x9)=0.632124+(0.632205-0.632124)*Fx(x9)=0.632124+(8.1e-5)*Fx(x9)
l(9)=l(8)+(u(8)-l(8))*Fx(x9-1)=0.632124+(0.632205-0.632124)*Fx(x9-1)=0.632124+(8.1e-5)*Fx(x9-1)
x9=1时,区间为[0.632124,0.6321402]
x9=2时,区间为[0.0.6321402,0.6321645]
x9=3时,区间为[0.6321645,0.63234]
因为0.63215699在区间[0.6321402,0.6321645]内,所以,第九个元素的序列为2,元素则为a2
x10
u(10)=l(9)+(u(9)-l(9))*Fx(x10)=0.6321402+(0.6321645-0.6321402)*Fx(x10)=0.6321402+(2.43e-5)*Fx(x10)
l(10)=l(9)+(u(9)-l(9))*Fx(x10-1)=0.6321402+(0.6321645-0.6321402)*Fx(x10-1)=0.6321402+(2.43e-5)*Fx(x10-1)
x10=1时,区间为[0.6321402,0.63212886]
x10=2时,区间为[0.63212886,0.63215325]
x10=3时,区间为[0.63215325,0.6321645]
因为0.63215699在区间[0.63215235,0.6321645]内,所以,第九个元素的序列为3,元素则为a3
所以根据表4-9所给的概率模型得出标签为0.63215699的长度为10的序列的解码结果为:a3 a2 a2 a1 a2 a1 a3 a2 a2 a3。