Files
Polsl-Notes/TIiK/Ćwiczenia/3. Hamming.md

137 lines
3.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Podaj macierz generującą wydłużony kod Haminga (8,4)
$H(8,4)$ $G=?$
$$\begin{gather}
T=[P\ \ E]\\
G=[E\ \ P^{T}]
\end{gather}$$
$n=8,\ k=4$
$m=n-k=4$
$n=1;2;3;8$
$$T= \begin{bmatrix}
1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 & 1 & 1 & 1 & 0 \\ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1
\end{bmatrix}
$$
$w_{1}=w_{3}\oplus w_{5} \oplus w_{7}$
$w_{2}=w_{3}\oplus w_{6} \oplus w_{7}$
$w_{4}=w_{5}\oplus w_{6} \oplus w_{7}$
$w_{8}=\oplus\sum w_{n}$
$n=1_{10}=0001_{2}$
$\overline{w_{1}}= 1101001$
$n=2_{10}=0010_{2}$
$\overline{w_{2}}=01010101$
$n=4_{10}=0100_{2}$
$\overline{w_{4}}=10011001$
$n=8_{10}=1000_{2}$
$\overline{w_{8}}=11100001$
$$G= \begin{bmatrix}
\overline{w_{8}} \\ \overline{w_{4}} \\ \overline{w_{2}} \\ \overline{w_{1}} \\
\end{bmatrix}=\begin{bmatrix}
1 & 1 & 1 & 0 & 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 1 & 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ 1 & 1 & 0 & 1 & 0 & 0 & 1 & 0
\end{bmatrix}$$
$n=6_{10}=0110_{2}$
$$\overline{w_{6}}=n\cdot G= \begin{bmatrix}0 & 1 & 1 & 0\end{bmatrix}\begin{bmatrix}1 & 1 & 1 & 0 & 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 1 & 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ 1 & 1 & 0 & 1 & 0 & 0 & 1 & 0\end{bmatrix}=11001100$$
$\overline{w_{7}}=\begin{bmatrix}0 & 1 & 1 & 1\end{bmatrix}G=00011110$
$\overline{w_{13}}=\begin{bmatrix}1 & 1 & 0 & 1\end{bmatrix}G=10101010$
## Oblicz prawdopodobieństwo błędnej decyzji dekodera kodu Hamminga (7,4) jeżeli prawdopodobieństwo przekłamania bitu wynosi $10^{-3}$, błędy są niezależne.
ed = erroneous decision
$H(7,4)$ $p=10^{-3}$
$P_{OK}=(0.999)^{7}=(1-p)^{7}$
$P_{e1}=(^{7}_{1})p^{1}\cdot (1-p)^{6}=7\cdot 10^{-3} \cdot (0.999)^{6}\approx 1$
$P_{ed}=1-P_{OK}-P_{e1}=P_{e2}+\dots+P_{e7}$
$P_{ed}\approx P_{e2}=(^7_2)=p^2(1-p)^5=\frac{7!}{2!5!}10^{-6}\cdot(0.999)^5=21\cdot 10^{-6}\cdot(0.999)^5\approx21\cdot 10^{-6}$
$H(8,4)$ $p=10^{-3}$
$P_{OK}=(1-p)^{8}\approx 0.992$
$P_{e1}=(^{8}_{1})p^{1}(1-p)^{7}\approx 0.008$
$P_{ed}=1-P_{OK}-P_{e1}-P_{e2}\approx 56\cdot 10^{-9}$
## Skrócone:
$s.k.H(6,3)$
$n=6$, ale syndrom $\in\left<0;7\right)$, co oznacza błąd na "7" pozycji.
Błąd podwójny, ale tylko 1 z $\left(^{6}_{2}\right)$
$P_{ed}=\left[\left(^{6}_{2}\right)-1\right]p^{2}(1-p)^{4}+P_{e3}+P_{e4}+\dots\approx14\cdot 10^{-6}$
## Dany jest kod z bitem parzystości o parametrach (8,7)
m=1
$P_{ed}=\sum\limits_{n=1}^{n+1} P_{en}\approx28\cdot10^{-6}$
$h=101_{2}$
$g=1101_{2}$
$$\begin{gather}
h\cdot g = 1101\cdot 101=111001
\end{gather}$$
---
$$\begin{gather}
h(x)=x^{2}+1\\
g(x)=x^{3}+x^{2}+1
h(x)g(x)=(x^{2}+1)(x^{3}+x^{2}+1)=x^{5}+x^{4}+x^{3}+x^{0}= 111001
\end{gather}
$$
## Dany jest wielomian generujący $g(x)=x^3+x+1$, który generuje kod cykliczny o parametrach (7,4). Podaj macierz generującą i podaj przykładowe ciągi dla
### Kodu cyklicznego nierozdzielnego
$$\begin{gather}
w(x)=h(x)\cdot g(x)\\
\\
h=3_{10}=0011_{2}\\
h(x)=x\oplus1\\
\overline{w_{3}}(x)=(x\oplus1)(x^{3}\oplus x\oplus 1)=x^{4}\oplus x^{3} \oplus x^{2} \oplus 1 = 00\|11101
\\
\\
1011\cdot 0011=0011101
\\
\\
\\
\overline{w_{1}}= 0001011\\
\overline{w_{2}}= 0010110\\
\overline{w_{4}}= 0101100\\
\overline{w_{8}}= 1011000\\
G=\begin{bmatrix}
w_{8} \\ w_{4} \\ w_{2} \\ w_{1}
\end{bmatrix}\cdot \begin{bmatrix}
1 & 0 & 1 & 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 1 & 1
\end{bmatrix}
\\
\overline{w_{14}}=[1110]G=1100010
\end{gather}$$
Minimalna waga = 3 → $d_{min}=3$
Cecha kodów cyklicznych to shiftowanie słowa w lewo - g(x) razy pozycja w formie wielomianu
### Kodu cyklicznego rozdzielnego
$g(x)=x^3 +x +1$
$$
\begin{gather}
w(x)=x^{k-1}\cdot h(x)+r(x)\\
r(x)=x^{k-1}\cdot h(x)\mod{g(x)}
\end{gather}
$$