京都大学 情報学研究科 通信情報システム専攻 2023年8月実施 専門基礎A [A-3]
Author
SUN , 祭音Myyura (assisted by ChatGPT 5.4 Thinking)
Description
Answer all the following questions.
(1)
S A S_A S A and S B S_B S B are independent and stationary memoryless information sources.
S A S_A S A generates information symbols 0 and 1 with probabilities 2 / 3 2/3 2/3 and 1 / 3 1/3 1/3 , respectively, while S B S_B S B generates 0 and 1 with probabilities 4 / 5 4/5 4/5 and 1 / 5 1/5 1/5 , respectively. Answer the following questions. log 2 3 = 1.6 \log_2 3 = 1.6 log 2 3 = 1.6 and log 2 5 = 2.3 \log_2 5 = 2.3 log 2 5 = 2.3 may be used.
(a) Describe the definition of compact code.
(b) Find the value of the entropy of S A S_A S A .
(c) Find a binary Huffman code for the second extension of S A S_A S A , and the expected codeword length per symbol.
(d) An information source S X S_X S X has two states and generates information symbols by following S A S_A S A and S B S_B S B when its state is s A s_A s A and s B s_B s B , respectively. S X S_X S X transits from a state to the other state when it generates 1. Draw the state diagram of S X S_X S X .
(e) Find the stationary distribution of S X S_X S X in Question (d).
(f) Find the value of the entropy of S X S_X S X in Question (d).
(2)
Answer the following questions related to channel coding.
Let C C C be the binary cyclic code of length 7 that has a generator polynomial
G ( x ) = x 4 + x 3 + x 2 + 1. G(x)=x^4+x^3+x^2+1. G ( x ) = x 4 + x 3 + x 2 + 1.
(a) Find all codeword polynomials of C C C .
(b) Find the codeword polynomial for the message polynomial x 2 + 1 x^2+1 x 2 + 1 .
(c) Draw a division circuit by G ( x ) G(x) G ( x ) .
(d) Explain how to detect errors by C C C .
题目描述
回答全部问题。
S A , S B S_A,S_B S A , S B 是相互独立的平稳无记忆信源。S A S_A S A 以概率 2 / 3 , 1 / 3 2/3,1/3 2/3 , 1/3 产生 0 , 1 0,1 0 , 1 ;S B S_B S B 以概率 4 / 5 , 1 / 5 4/5,1/5 4/5 , 1/5 产生 0 , 1 0,1 0 , 1 。可使用 log 2 3 = 1.6 \log_2 3=1.6 log 2 3 = 1.6 、log 2 5 = 2.3 \log_2 5=2.3 log 2 5 = 2.3 。
说明紧致码(compact code)的定义。
求 S A S_A S A 的熵。
为 S A S_A S A 的二次扩展构造二元 Huffman 码,并求每个原始符号的平均码长。
信源 S X S_X S X 有状态 s A , s B s_A,s_B s A , s B ,在相应状态按 S A , S B S_A,S_B S A , S B 产生符号,产生 1 1 1 时转到另一个状态。画状态图。
求 S X S_X S X 的平稳分布。
求 S X S_X S X 的熵。
设 C C C 为长度 7、生成多项式
G ( x ) = x 4 + x 3 + x 2 + 1 G(x)=x^4+x^3+x^2+1 G ( x ) = x 4 + x 3 + x 2 + 1
的二元循环码。
求 C C C 的所有码字多项式。
求消息多项式 x 2 + 1 x^2+1 x 2 + 1 的码字多项式。
画出除以 G ( x ) G(x) G ( x ) 的除法电路。
说明如何用 C C C 检错。
信源编码与 Huffman 码 :说明紧致码性质,对扩展信源构造前缀码并计算归一化平均码长。
熵与 Markov 信源 :计算无记忆信源熵,并由两状态转移求平稳分布及熵率。
循环码编码 :枚举消息多项式并乘以生成多项式得到全部码字。
多项式除法电路与检错 :依据生成多项式设计反馈移位寄存器,并以接收多项式余数是否为零检测错误。
Kai
(1)
(a)
A compact code is a uniquely decodable and instantaneous code with the minimum average codeword length.
(b)
H ( S A ) = ∑ i p i log 2 1 p i = 2 3 log 2 3 2 + 1 3 log 2 3 = 0.93 bits/symbol . \begin{aligned}
H(S_A)&=\sum_i p_i\log_2\frac{1}{p_i} \\
&=\frac{2}{3}\log_2\frac{3}{2}+\frac{1}{3} \log_2 3 \\
&=0.93\ \text{bits/symbol}.
\end{aligned} H ( S A ) = i ∑ p i log 2 p i 1 = 3 2 log 2 2 3 + 3 1 log 2 3 = 0.93 bits/symbol .
(c)
P 00 = 4 9 , P 01 = 2 9 , P 10 = 2 9 , P 11 = 1 9 . P_{00}=\frac{4}{9},\quad
P_{01}=\frac{2}{9},\quad
P_{10}=\frac{2}{9},\quad
P_{11}=\frac{1}{9}. P 00 = 9 4 , P 01 = 9 2 , P 10 = 9 2 , P 11 = 9 1 .
[1.0] / \ 0 / \ 1 / \ P00=4/9 [5/9] / \ 0 / \ 1 / \ P01=2/9 [3/9] / \ 0 / \ 1 / \ P10=2/9 P11=1/9 P00 = 0 P01 = 10 P10 = 110 P11 = 111
Average length per extended symbol:
L ˉ ( 2 ) = ∑ i p i l i = 4 9 ⋅ 1 + 2 9 ⋅ 2 + 2 9 ⋅ 3 + 1 9 ⋅ 3 = 17 9 bits/extended-symbol . \begin{aligned}
\bar L_{(2)} &= \sum_i p_i l_i \\
&= \frac{4}{9}\cdot 1+\frac{2}{9}\cdot 2+\frac{2}{9}\cdot 3+\frac{1}{9}\cdot 3 \\
&=\frac{17}{9}\ \text{bits/extended-symbol}.
\end{aligned} L ˉ ( 2 ) = i ∑ p i l i = 9 4 ⋅ 1 + 9 2 ⋅ 2 + 9 2 ⋅ 3 + 9 1 ⋅ 3 = 9 17 bits/extended-symbol .
Expected codeword length per symbol :
L ˉ = L ˉ ( 2 ) 2 = 17 18 bits/symbol . \bar L=\frac{\bar L_{(2)}}{2}=\frac{17}{18}\ \text{bits/symbol}. L ˉ = 2 L ˉ ( 2 ) = 18 17 bits/symbol .
(d)
s_A --0 (2/3)--> s_A s_A --1 (1/3)--> s_B s_B --0 (4/5)--> s_B s_B --1 (1/5)--> s_A
(e)
{ 2 3 λ A + 1 5 λ B = λ A 1 3 λ A + 4 5 λ B = λ B λ A + λ B = 1 ⇒ { λ A = 3 8 λ B = 5 8 \begin{cases}
\frac{2}{3}\lambda_A+\frac{1}{5}\lambda_B=\lambda_A\\
\frac{1}{3}\lambda_A+\frac{4}{5}\lambda_B=\lambda_B\\
\lambda_A+\lambda_B=1
\end{cases}
\Rightarrow
\begin{cases}
\lambda_A=\frac{3}{8}\\
\lambda_B=\frac{5}{8}
\end{cases} ⎩ ⎨ ⎧ 3 2 λ A + 5 1 λ B = λ A 3 1 λ A + 5 4 λ B = λ B λ A + λ B = 1 ⇒ { λ A = 8 3 λ B = 8 5
(f)
The entropy rate is the stationary weighted average of the entropies in each state:
H X = λ A H ( S A ) + λ B H ( S B ) . H_X=\lambda_A H(S_A)+\lambda_B H(S_B). H X = λ A H ( S A ) + λ B H ( S B ) .
We already have
H ( S A ) ≈ 0.933. H(S_A)\approx 0.933. H ( S A ) ≈ 0.933.
Now
H ( S B ) = − 4 5 log 2 4 5 − 1 5 log 2 1 5 = 4 5 log 2 5 4 + 1 5 log 2 5. H(S_B)
=-\frac45\log_2\frac45-\frac15\log_2\frac15
=\frac45\log_2\frac54+\frac15\log_2 5. H ( S B ) = − 5 4 log 2 5 4 − 5 1 log 2 5 1 = 5 4 log 2 4 5 + 5 1 log 2 5.
Using log 2 5 = 2.3 \log_2 5=2.3 log 2 5 = 2.3 ,
log 2 5 4 = log 2 5 − log 2 4 = 2.3 − 2 = 0.3 , \log_2\frac54=\log_2 5-\log_2 4 = 2.3-2=0.3, log 2 4 5 = log 2 5 − log 2 4 = 2.3 − 2 = 0.3 ,
so
H ( S B ) = 4 5 ⋅ 0.3 + 1 5 ⋅ 2.3 = 0.24 + 0.46 = 0.70. H(S_B)=\frac45\cdot 0.3+\frac15\cdot 2.3
=0.24+0.46
=0.70. H ( S B ) = 5 4 ⋅ 0.3 + 5 1 ⋅ 2.3 = 0.24 + 0.46 = 0.70.
Therefore,
H X = 3 8 ⋅ 0.933 + 5 8 ⋅ 0.70 ≈ 0.788 bits/symbol . H_X=\frac38\cdot 0.933+\frac58\cdot 0.70
\approx 0.788\ \text{bits/symbol}. H X = 8 3 ⋅ 0.933 + 8 5 ⋅ 0.70 ≈ 0.788 bits/symbol .
(2)
(a)
Since deg G ( x ) = 4 \deg G(x)=4 deg G ( x ) = 4 and the code length is 7, the message polynomial has degree at most 2:
m ( x ) = a 2 x 2 + a 1 x + a 0 . m(x)=a_2x^2+a_1x+a_0. m ( x ) = a 2 x 2 + a 1 x + a 0 .
Each codeword is
c ( x ) = m ( x ) G ( x ) . c(x)=m(x)G(x). c ( x ) = m ( x ) G ( x ) .
Thus the 8 codeword polynomials are:
G ( x ) = x 4 + x 3 + x 2 + 1 G(x)=x^4+x^3+x^2+1 G ( x ) = x 4 + x 3 + x 2 + 1
x G ( x ) = x 5 + x 4 + x 3 + x xG(x)=x^5+x^4+x^3+x x G ( x ) = x 5 + x 4 + x 3 + x
( x + 1 ) G ( x ) = x 5 + x 2 + x + 1 (x+1)G(x)=x^5+x^2+x+1 ( x + 1 ) G ( x ) = x 5 + x 2 + x + 1
x 2 G ( x ) = x 6 + x 5 + x 4 + x 2 x^2G(x)=x^6+x^5+x^4+x^2 x 2 G ( x ) = x 6 + x 5 + x 4 + x 2
( x 2 + 1 ) G ( x ) = x 6 + x 5 + x 3 + 1 (x^2+1)G(x)=x^6+x^5+x^3+1 ( x 2 + 1 ) G ( x ) = x 6 + x 5 + x 3 + 1
( x 2 + x ) G ( x ) = x 6 + x 3 + x 2 + x (x^2+x)G(x)=x^6+x^3+x^2+x ( x 2 + x ) G ( x ) = x 6 + x 3 + x 2 + x
( x 2 + x + 1 ) G ( x ) = x 6 + x 4 + x + 1 (x^2+x+1)G(x)=x^6+x^4+x+1 ( x 2 + x + 1 ) G ( x ) = x 6 + x 4 + x + 1
Equivalently, in 7-bit vector form (from x 6 x^6 x 6 to x 0 x^0 x 0 ):
0000000 , 0011101 , 0111010 , 0100111 , 1110100 , 1101001 , 1001110 , 1010011. 0000000,\ 0011101,\ 0111010,\ 0100111,\\ 1110100,\ 1101001,\ 1001110,\ 1010011. 0000000 , 0011101 , 0111010 , 0100111 , 1110100 , 1101001 , 1001110 , 1010011.
(b)
c ( x ) = ( x 2 + 1 ) G ( x ) = ( x 2 + 1 ) ( x 4 + x 3 + x 2 + 1 ) . c(x)=(x^2+1)G(x)
=(x^2+1)(x^4+x^3+x^2+1). c ( x ) = ( x 2 + 1 ) G ( x ) = ( x 2 + 1 ) ( x 4 + x 3 + x 2 + 1 ) .
Over GF(2),
c ( x ) = x 6 + x 5 + x 3 + 1. c(x)=x^6+x^5+x^3+1. c ( x ) = x 6 + x 5 + x 3 + 1.
c ( x ) = x 6 + x 5 + x 3 + 1 \boxed{c(x)=x^6+x^5+x^3+1} c ( x ) = x 6 + x 5 + x 3 + 1
Its 7-bit vector form is
1101001 . \boxed{1101001}. 1101001 .
(c)
The division circuit uses 4 delay elements because deg G ( x ) = 4 \deg G(x)=4 deg G ( x ) = 4 , and the feedback taps correspond to the nonzero coefficients of 1 , x 2 , x 3 1, x^2, x^3 1 , x 2 , x 3 .
(d)
Explain how to detect errors by C C C :
Given a received polynomial (or 7-bit vector) R ( x ) R(x) R ( x ) , divide R ( x ) R(x) R ( x ) by G ( x ) G(x) G ( x ) over GF(2) and compute the remainder (syndrome)
S ( x ) = R ( x ) m o d G ( x ) . S(x)=R(x)\ \bmod\ G(x). S ( x ) = R ( x ) mod G ( x ) .
If S ( x ) = 0 S(x)=0 S ( x ) = 0 , then R ( x ) R(x) R ( x ) is a valid codeword (no error detected).
If S ( x ) ≠ 0 S(x)\neq 0 S ( x ) = 0 , then an error is detected.