通信路容量(Channel Capacity)は、ノイズのある通信路を通じて信頼性の高い通信が可能な最大の情報伝送レートを表します。シャノンの通信路符号化定理は、「通信路容量以下のレートなら誤り率を限りなく小さくできる」ことを示した画期的な定理です。
この定理は1948年に発表されて以来、デジタル通信の理論的基盤となっており、携帯電話、Wi-Fi、衛星通信など、現代の通信技術はすべてシャノンの理論の上に構築されています。
本記事の内容
- 通信路モデルの基礎
- 通信路容量の定義
- 二元対称通信路(BSC)の容量
- ガウス通信路とシャノン限界
- Pythonでの計算と可視化
前提知識
この記事を読む前に、以下の記事を読んでおくと理解が深まります。
通信路モデル
離散無記憶通信路
離散無記憶通信路(Discrete Memoryless Channel, DMC)は、入力アルファベット $\mathcal{X}$、出力アルファベット $\mathcal{Y}$、および遷移確率 $p(y \mid x)$ で特徴付けられます。
「無記憶」とは、現在の出力が現在の入力のみに依存し、過去の入出力には依存しないことを意味します。
通信システムの構成
$$ \text{情報源} \to \text{符号器} \to \text{通信路} \to \text{復号器} \to \text{受信者} $$
符号器は送りたいメッセージを通信路に適した形に変換し、復号器は受信した信号から元のメッセージを復元します。
通信路容量の定義
定義
通信路容量 $C$ は、入力分布 $p(x)$ を最適化したときの相互情報量の最大値です。
$$ C = \max_{p(x)} I(X; Y) $$
単位はビット/使用(bits per channel use)です。
意味
通信路容量は、1回の通信路使用あたりに信頼性高く伝送できる情報の最大ビット数です。
シャノンの通信路符号化定理
定理(達成可能性)
伝送レート $R < C$ に対して、符号長 $n$ を十分大きく取れば、誤り確率を限りなく小さくできる符号化方式が存在します。
定理(逆定理)
$R > C$ の伝送レートでは、どのような符号化方式を使っても誤り確率を0に近づけることはできません。
重要な点
この定理は、理想的な符号化方式の「存在」を示すものであり、具体的な構成方法を教えてくれるわけではありません。実用的な符号化方式(ターボ符号、LDPC符号、ポーラ符号)がシャノン限界に近い性能を達成するまでには、定理の発表から約50年を要しました。
二元対称通信路(BSC)
モデル
二元対称通信路(Binary Symmetric Channel, BSC)は、入出力が共に $\{0, 1\}$ の通信路で、入力ビットが確率 $p$ で反転(誤り)します。
$$ P(Y = 0 \mid X = 0) = 1 – p, \quad P(Y = 1 \mid X = 0) = p $$
$$ P(Y = 1 \mid X = 1) = 1 – p, \quad P(Y = 0 \mid X = 1) = p $$
容量の導出
$$ \begin{align} I(X; Y) &= H(Y) – H(Y \mid X) \end{align} $$
$H(Y \mid X)$ は、入力が分かっているときの出力の不確実性です。入力が $x$ のとき、出力は確率 $1-p$ で $x$、確率 $p$ で反転するので、
$$ H(Y \mid X) = H(p) = -p\log_2 p – (1-p)\log_2(1-p) $$
$H(Y)$ は入力分布の選び方に依存します。$H(Y) \leq 1$ であり、等号は $Y$ が一様分布のとき($X$ が一様分布のとき)に成り立ちます。
したがって、
$$ C = \max_{p(x)} I(X; Y) = 1 – H(p) $$
$$ \boxed{C_{\text{BSC}} = 1 – H(p) = 1 + p\log_2 p + (1-p)\log_2(1-p)} $$
- $p = 0$(ノイズなし): $C = 1$ bit
- $p = 1/2$(完全にランダム): $C = 0$ bit
- $p = 1$(常に反転): $C = 1$ bit(反転すれば元に戻るので)
二元消失通信路(BEC)
入力ビットが確率 $\epsilon$ で消失(erasure)する通信路です。消失した場合、受信側は「消失」という情報を受け取ります。
$$ C_{\text{BEC}} = 1 – \epsilon $$
BSCと比べて容量の計算が簡単で、理論的な分析に便利です。
ガウス通信路(AWGN)
モデル
加法性白色ガウスノイズ(AWGN)通信路は、連続値の入出力を持つ通信路です。
$$ Y = X + Z, \quad Z \sim N(0, N_0) $$
入力に電力制約 $E[X^2] \leq P$ があるとします。
シャノン限界
$$ \boxed{C = \frac{1}{2} \log_2\left(1 + \frac{P}{N_0}\right) \quad \text{[bits/使用]}} $$
帯域幅 $W$ [Hz] を使う場合、
$$ C = W \log_2\left(1 + \frac{P}{N_0 W}\right) \quad \text{[bits/秒]} $$
ここで $P/N_0 W$ は信号対雑音比(SNR)です。
シャノン限界の導出のアイデア
$I(X; Y) = H(Y) – H(Y \mid X)$ において、
- $H(Y \mid X) = H(Z) = \frac{1}{2}\log_2(2\pi e N_0)$(ガウスノイズのエントロピー)
- $H(Y) \leq \frac{1}{2}\log_2(2\pi e (P + N_0))$(分散 $P + N_0$ のガウス分布のエントロピー、等号は $X$ がガウス分布のとき)
$$ C = \frac{1}{2}\log_2(2\pi e(P+N_0)) – \frac{1}{2}\log_2(2\pi e N_0) = \frac{1}{2}\log_2\left(1 + \frac{P}{N_0}\right) $$
Pythonでの計算と可視化
BSCの通信路容量
import numpy as np
import matplotlib.pyplot as plt
def binary_entropy(p):
"""2値エントロピー関数"""
if p == 0 or p == 1:
return 0
return -p * np.log2(p) - (1 - p) * np.log2(1 - p)
p_values = np.linspace(0, 1, 500)
capacities = [1 - binary_entropy(p) for p in p_values]
fig, ax = plt.subplots(figsize=(8, 5))
ax.plot(p_values, capacities, 'b-', linewidth=2)
ax.set_xlabel('Crossover probability $p$')
ax.set_ylabel('Capacity $C$ (bits)')
ax.set_title('Binary Symmetric Channel capacity: $C = 1 - H(p)$')
ax.grid(True, alpha=0.3)
ax.set_ylim(-0.05, 1.05)
plt.tight_layout()
plt.savefig('bsc_capacity.png', dpi=150, bbox_inches='tight')
plt.show()
AWGN通信路のシャノン限界
import numpy as np
import matplotlib.pyplot as plt
# SNR (dB) に対するシャノン限界
snr_db = np.linspace(-5, 30, 300)
snr_linear = 10**(snr_db / 10)
capacity = np.log2(1 + snr_linear)
fig, ax = plt.subplots(figsize=(10, 6))
ax.plot(snr_db, capacity, 'b-', linewidth=2, label='Shannon limit')
ax.set_xlabel('SNR (dB)')
ax.set_ylabel('Spectral efficiency (bits/s/Hz)')
ax.set_title('AWGN Channel: Shannon capacity')
ax.legend()
ax.grid(True, alpha=0.3)
# 実用的な変調方式の参考点
modulations = {
'BPSK': (0, 1),
'QPSK': (3, 2),
'16-QAM': (10, 4),
'64-QAM': (16, 6),
'256-QAM': (22, 8),
}
for name, (snr, se) in modulations.items():
ax.plot(snr, se, 'ro', markersize=8)
ax.annotate(name, (snr, se), textcoords="offset points",
xytext=(10, 5), fontsize=9)
plt.tight_layout()
plt.savefig('awgn_shannon_limit.png', dpi=150, bbox_inches='tight')
plt.show()
BSCのシミュレーション(符号化なし vs 繰り返し符号)
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(42)
def bsc_transmit(bits, p):
"""BSCでビットを送信"""
noise = np.random.random(len(bits)) < p
return np.logical_xor(bits, noise).astype(int)
def repetition_code(bits, n_repeat, p):
"""繰り返し符号(各ビットをn_repeat回繰り返して多数決で復号)"""
n_bits = len(bits)
encoded = np.repeat(bits, n_repeat)
received = bsc_transmit(encoded, p)
# 多数決復号
received_reshaped = received.reshape(n_bits, n_repeat)
decoded = (received_reshaped.sum(axis=1) > n_repeat / 2).astype(int)
return decoded
p = 0.1 # ビット誤り率
n_bits = 10000
bits = np.random.randint(0, 2, n_bits)
# 符号化なし
received_no_code = bsc_transmit(bits, p)
ber_no_code = np.mean(bits != received_no_code)
# 繰り返し符号
repeat_lengths = [3, 5, 7, 11, 21]
bers = []
rates = []
for n_repeat in repeat_lengths:
decoded = repetition_code(bits, n_repeat, p)
ber = np.mean(bits != decoded)
rate = 1 / n_repeat # 符号化率
bers.append(ber)
rates.append(rate)
fig, axes = plt.subplots(1, 2, figsize=(12, 5))
# 誤り率
ax = axes[0]
ax.bar(range(len(repeat_lengths) + 1),
[ber_no_code] + bers,
color=['gray'] + ['steelblue'] * len(repeat_lengths))
ax.set_xticks(range(len(repeat_lengths) + 1))
ax.set_xticklabels(['None'] + [str(n) for n in repeat_lengths])
ax.set_xlabel('Repetition length')
ax.set_ylabel('Bit error rate')
ax.set_title(f'BER with repetition codes ($p = {p}$)')
ax.set_yscale('log')
ax.grid(True, alpha=0.3)
# 伝送レートと誤り率のトレードオフ
ax = axes[1]
ax.plot(rates, bers, 'bo-', markersize=8, linewidth=2)
for i, n in enumerate(repeat_lengths):
ax.annotate(f'n={n}', (rates[i], bers[i]),
textcoords="offset points", xytext=(10, 5), fontsize=9)
C = 1 - binary_entropy(p)
ax.axvline(x=C, color='r', linestyle='--', linewidth=2, label=f'$C = {C:.3f}$')
ax.set_xlabel('Code rate $R$')
ax.set_ylabel('BER')
ax.set_title('Rate vs BER tradeoff')
ax.legend()
ax.set_yscale('log')
ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('channel_coding_simulation.png', dpi=150, bbox_inches='tight')
plt.show()
print(f"BSC容量 C = {C:.4f} bits")
print(f"符号化なしの BER = {ber_no_code:.4f}")
for n, ber, rate in zip(repeat_lengths, bers, rates):
print(f"繰り返し{n}回: BER = {ber:.6f}, Rate = {rate:.4f}")
繰り返し符号は単純な符号化方式ですが、繰り返し回数を増やすと誤り率は下がる一方、伝送レートも下がるというトレードオフがあります。シャノンの定理は、通信路容量以下のレートで誤り率を限りなく小さくできるより洗練された符号化方式の存在を保証しています。
まとめ
本記事では、通信路容量とシャノンの通信路符号化定理を解説しました。
- 通信路容量: $C = \max_{p(x)} I(X; Y)$ — 信頼性の高い通信が可能な最大伝送レート
- BSCの容量: $C = 1 – H(p)$
- AWGNのシャノン限界: $C = \frac{1}{2}\log_2(1 + \text{SNR})$
- 通信路符号化定理: $R < C$ なら誤り率を限りなく小さくでき、$R > C$ では不可能
- シャノン限界に近い実用的な符号: ターボ符号、LDPC符号、ポーラ符号
シャノンの通信路符号化定理は情報理論の最も重要な結果であり、現代のデジタル通信の理論的基盤です。