5, given the probability model as shown in table 4-9, the real value label of the sequence A1A1A3A2A3A1 is obtained.
From the above,
P (A1) =0.2, P (A2) =0.3, P (A3) =0.5
Because X (AI) =i, x (A1) =1,x (A2) =2,x (A3) =3
FX (0) =0,FX (1) =0.2, FX (2) =0.5, FX (3) =1.0, U (0) =1, L (0) =0
L (n) =l (n-1) + (U (n-1)-L (n-1)) Fx (xn-1) according to the formula
U (n) =l (n-1) + (U (n-1)-L (n-1)) Fx (xn)
The first time a A1 appears, when
L (1) =l (0) + (U (0)-L (0)) Fx (0) =0
U (1) =l (0) + (U (0)-L (0)) Fx (1) =0.2
The second time the A1 appears, when
L (2) =l (1) + (U (1)-L (1)) Fx (0) =0
U (2) =l (1) + (U (1)-L (1)) Fx (1) =0.04
The third occurrence of A3, when
L (3) =l (2) + (U (2)-L (2)) Fx (2) =0.02
U (3) =l (2) + (U (2)-L (2)) Fx (3) =0.04
The fourth time the A2 appeared, when
L (4) =l (3) + (U (3)-L (3)) Fx (1) =0.024
U (4) =l (3) + (U (3)-L (3)) Fx (2) =0.03
The fifth time the A3 appeared, when
L (5) =l (4) + (U (4)-L (4)) Fx (2) =0.027
U (5) =l (4) + (U (4)-L (4)) Fx (3) =0.03
The sixth time the A1 appeared, when
L (6) =l (5) + (U (5)-L (5)) Fx (0) =0.027
U (6) =l (5) + (U (5)-L (5)) Fx (1) =0.0276
Therefore, the real value tag of the sequence A1A1A3A2A3A1 is: T (113231) = (L (6) + U (6))/2=0.0273;
6, for the probability model shown in table 4-9, for a label 0.63215699 of the length of a sequence of 10 decoding.
#include <stdio.h>
int main ()
{
int m[100];
Double f0=0,f1=0.2,f2=0.5,f3=1.0;
Double tag=0.63215699,t1;
Double l[100],u[100];
l[0]=0;
u[0]=1.0;
for (int j=1;j<=10;j++)
{
T1= (Tag-l[j-1])/(u[j-1]-l[j-1]);
if (T1>F0&&T1<F1)
{
l[j]=l[j-1]+ (u[j-1]-l[j-1]) *f0;
u[j]=l[j-1]+ (u[j-1]-l[j-1]) *f1;
M[j]=1;
}
else if (T1>F1&&T1<F2)
{
l[j]=l[j-1]+ (u[j-1]-l[j-1]) *f1;
u[j]=l[j-1]+ (u[j-1]-l[j-1]) *f2;
m[j]=2;
}
Else
{
l[j]=l[j-1]+ (u[j-1]-l[j-1]) *f2;
u[j]=l[j-1]+ (u[j-1]-l[j-1]) *f3;
m[j]=3;
}
printf ("%d", m[j]);
}
return 0;
}
Third time job