Third time job

Source: Internet
Author: User

5. Given the probability model shown in table 4-9, the real value label of the sequence A1A1A3A2A3A1 is obtained.

Table 4-9 The probabilistic model of Exercise 5, exercise 6

Letter Probability

A1 0.2

A2 0.3

A3 0.5

Solution: By the problem, map a1<=>1,a2<=>2,a3<=>3

FX (k) =0, K≤0, FX (1) =0.2, FX (2) =0.5, FX (3) =1, k>3

Nether: L (0) = 0, upper bound: U (0) =1

The 1th element of the sequence is A1:

L (1) = 0+ (1-0) Fx (0) =0

U (1) =0+ (1-0) Fx (1) =0.2

The 2nd element of a sequence is A1

L (2) = 0+ (0.2-0) Fx (0) =0

U (2) =0+ (0.2-0) Fx (1) =0.04

The 3rd element of a sequence is A3

L (3) = 0+ (0.04-0) Fx (2) =0.02

U (3) =0+ (0.04-0) Fx (3) =0.04

The 4th element of a sequence is 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

The 5th element of a sequence is 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

The 6th element of a sequence is 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

The range of the label for the sequence A1A1A3A2A3A1 is [0.027,0.0276]

The tags that can generate sequence a1a1a3a2a3a1 are as follows:

Tx (A1A1A3A2A3A1) = L (6) +u (6)/2

= (0.027+0.0276)/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

int main ()
{
Double tag=0.63215699;
Double l[100],u[100];
Double T;
l[0]=0;
U[0]=1;
Double a0=0.0,a1=0.2,a2=0.5,a3=1.0;
int m[100];
for (int k=1;k<=10;k++)
{
T= (Double) (tag-l[k-1])/(u[k-1]-l[k-1]);
if (T>=A0&&T<=A1)
{
u[k]=l[k-1]+ (u[k-1]-l[k-1]) A1;
l[k]=l[k-1]+ (u[k-1]-l[k-1]) A0;
M[k]=1;
}
else if (T>A1&&T<=A2)
{
u[k]=l[k-1]+ (u[k-1]-l[k-1]) A2;
l[k]=l[k-1]+ (u[k-1]-l[k-1]) A1;
m[k]=2;
}
else if (T>A2&&T<=A3)
{
u[k]=l[k-1]+ (u[k-1]-l[k-1]) A3;
l[k]=l[k-1]+ (u[k-1]-l[k-1]) A2;
m[k]=3;
}
printf ("%d", m[k]);
}
return 0;
}

Third time job

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.