Skip to content

Commit

Permalink
add module 06
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanzhangxiao committed Feb 14, 2024
1 parent 64ffdfb commit 7870e23
Show file tree
Hide file tree
Showing 11 changed files with 317 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Detection in a Fading Channel"
published: true
morea_coming_soon: false
morea_id: module-in-detection-fading-channel
morea_id: module-detection-in-fading-channel
morea_prerequisites:
morea_outcomes:
- outcome-05-detection-in-fading-channel
Expand All @@ -19,7 +19,7 @@ morea_assessments:
morea_type: module
morea_icon_url: /morea/05-detection-in-fading-channel/05-module-icon-detection-2.webp
morea_start_date: "2024-02-05"
morea_end_date: "2024-02-07"
morea_end_date: "2024-02-11"
morea_labels:
morea_sort_order: 5
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,12 @@ The PDF of a circularly symmetric Gaussian random variable $\mathcal{CN}(0,\sigm
\begin{align}
f(x) = \frac{1}{\pi \sigma^2} e^{-\frac{\vert x \vert^2}{\sigma^2}}.
\end{align}

## Complex Gaussian random vectors
Now we consider a $n$-dimensional complex Gaussian random vector $\mathbf{x} \in \mathbb{C}^n$. We focus on the case of circularly symmetric Gaussian random vector $\mathbf{x}$, namely $e^{j\theta}\mathbf{x}$ has the same distribution as $\mathbf{x}$ for any $\theta$.

A circularly symmetric Gaussian random vector $\mathbf{x}$ has zero mean $\boldsymbol{\mu} = 0$ and variance $\mathbf{K} = \mathbb{E}\left[ \mathbf{x} \mathbf{x}^H \right]$. Its PDF is given by

\begin{align}
f(\mathbf{x}) = \frac{1}{\pi^n \text{det}\mathbf{K}} e^{- \mathbf{x}^H \mathbf{K}^{-1} \mathbf{x} }.
\end{align}
Binary file not shown.
Binary file added morea/06-time-diversity/06-rotation-code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions morea/06-time-diversity/assessment-CHANGE-ME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "CHANGE ME"
published: false
morea_id: assessment-CHANGE-ME
morea_summary: "CHANGE ME"
morea_outcomes_assessed:
# - outcome-CHANGE-ME
morea_type: assessment
morea_start_date: "2021-07-16T09:00"
morea_labels:
---
# CHANGE ME

TBD
11 changes: 11 additions & 0 deletions morea/06-time-diversity/experience-06-time-diversity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "BER under time diversity"
published: true
morea_id: experience-06-time-diversity
morea_type: experience
morea_summary: "BER vs SNR curves under time diversity"
morea_url: https://colab.research.google.com/drive/12ksJ3mOhvSibe9mH4196G73sANerkLyj?usp=sharing
morea_start_date: "2024-02-12"
morea_labels:
---

27 changes: 27 additions & 0 deletions morea/06-time-diversity/module-06-time-diversity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "Time Diversity"
published: true
morea_coming_soon: false
morea_id: module-time-diversity
morea_prerequisites:
morea_outcomes:
- outcome-06-time-diversity
morea_readings:
- reading-06-roadmap
- reading-06-performance-gain-time-diversity
- reading-06-beyond-repetition-code
# - reading-05-noncoherent-detection
# - reading-05-coherent-detection
morea_experiences:
- experience-06-time-diversity
morea_assessments:
# - assessment-CHANGE-ME
morea_type: module
morea_icon_url: /morea/06-time-diversity/06-module-icon-time-diversity.webp
morea_start_date: "2024-02-12"
morea_end_date: "2024-02-18"
morea_labels:
morea_sort_order: 6
---

We study how to utilize time diversity to combat fading in wireless channels.
11 changes: 11 additions & 0 deletions morea/06-time-diversity/outcome-06-time-diversity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "Time diversity"
published: true
morea_id: outcome-06-time-diversity
morea_type: outcome
morea_sort_order: 60
---

* You understand what is time diversity of wireless channels.
* You understand the performance gain achieved by time diversity.
* You know some techniques to achieve time diversity.
104 changes: 104 additions & 0 deletions morea/06-time-diversity/reading-06-beyond-repetition-coding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
title: "Beyond repetition coding"
published: true
morea_id: reading-06-beyond-repetition-code
morea_summary: "Achieving the diversity gain without sacrificing the data rate"
# morea_url: https://github.com/airbnb/javascript
morea_type: reading
morea_labels:
morea_sort_order: 61
---

# Beyond repetition coding

We have used [repetition coding to achieve the diversity gain](reading-06-performance-gain-time-diversity.html/), where the error rate decays with $\textsf{SNR}^{-L}$. However, the diversity gain is achieved by repeating the same symbol in $L$ time slots, reducing the effective data rate by $L$. Can we achieve the diversity gain without decreasing the data rate?

We are indeed able to achieve the diversity gain while keeping the data rate. We will show how to achieve it using a *rotation code* in the case of $L=2$.

## Rotation code

To put things into perspective, we have studied two cases at the opposite ends of the spectrum:
* maximum diversity gain with reduced data rate, by sending *completely correlated* symbols (i.e., the same symbol over $L$ time slots)

$$
y_\ell = h_\ell x + w_\ell, \quad \ell=1,\ldots,L.
$$

* no diversity gain with normal data rate, by sending *completely uncorrelated* symbols

$$
y_\ell = h_\ell x_\ell + w_\ell, \quad \ell=1,\ldots,L.
$$

In the first case, the diversity gain is achieved through the perfect correlation between symbols, so that we can recover the symbol even if deep fading is experienced in some, but not all, time slots. So a natural idea is to send different symbols in different time slots, but introduce some correlation among them. In this way, we may be able to achieve the diversity gain with the same data rate.

One way to introduce correlation is to use a rotation code, illustrated below for the case of $L=2$:

<figure style="text-align: center;">
<img src="06-rotation-code.png" alt="Illustration of a rotation code" width="400">
</figure>

In binary phase shift keying (BPSK), the four possible tuples of symbols $(x_1, x_2)$ are the four vertices of an upright square, namely $(a,a), (-a,a), (-a,-a), (a,-a)$. In the rotation code, we rotate the square and use the four vertices of the rotated square. This introduces some correlation: if $x_1$ is positive and has a large value, then $\mathbf{x}_D$ is more likely than $\mathbf{x}_A$, indicating that $x_2$ is more likely to be $-a$.

Next, we analyze the performance of rotation coding.

## Performance of rotation coding

Again, due to symmetry, we can focus on the case where $\mathbf{x}_A$ was sent but was mistaken for other symbols by the detector. Then we can bound the error probability by the union bound

$$
p_e \leq \mathbf{P}\left(\mathbf{x}_A \rightarrow \mathbf{x}_B\right) + \mathbf{P}\left(\mathbf{x}_A \rightarrow \mathbf{x}_C\right) + \mathbf{P}\left(\mathbf{x}_A \rightarrow \mathbf{x}_D\right),
$$

where $\mathbf{P}\left(\mathbf{x}_A \rightarrow \mathbf{x}_B\right)$ is the pairwise error probability of choosing $\mathbf{x}_B$ when $\mathbf{x}_A$ was sent and when $\mathbf{x}_A$ and $\mathbf{x}_B$ are the only two symbols. By using the union bound, we can reuse the [result on the error probability of binary detection](reading-06-performance-gain-time-diversity.html/), namely

$$
\mathbf{P}(\text{error} \vert \mathbf{h}) = Q\left( \frac{\Vert \mathbf{u}_A - \mathbf{u}_B \Vert}{2 \sqrt{N_0 / 2}} \right).
$$

Now we need to determine $\mathbf{u}_A$ and $\mathbf{u}_B$ in the rotation code.

The rotation can be expressed by the multiplication with the rotation matrix. Specifically, if we rotate the square counterclock wise by $\theta$, the rotation matrix is defined as

$$
\mathbf{R} = \left[ \begin{array}{cr} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{array} \right],
$$

and the four symbols are

$$
\mathbf{x}_A = \mathbf{R} \left[ \begin{array}{c} a \\ a \end{array} \right], \quad
\mathbf{x}_B = \mathbf{R} \left[ \begin{array}{c} -a \\ a \end{array} \right], \quad
\mathbf{x}_B = \mathbf{R} \left[ \begin{array}{c} -a \\ -a \end{array} \right], \quad
\mathbf{x}_C = \mathbf{R} \left[ \begin{array}{c} a \\ -a \end{array} \right].
$$

Focusing on $\mathbf{x}_A$ and $\mathbf{x}_B$, the exact expressions of them are

$$
\mathbf{x}_A = \left[ \begin{array}{c} a \cos\theta - a \sin\theta \\ a \sin\theta + a \cos\theta \end{array} \right] \quad \text{and} \quad \mathbf{x}_B = \left[ \begin{array}{c} -a \cos\theta - a \sin\theta \\ -a \sin\theta + a \cos\theta \end{array} \right]
$$

Therefore, we have

$$
\mathbf{u}_A = \left[ \begin{array}{c} h_1 x_{A1} \\ h_2 x_{A2} \end{array} \right]
\quad \text{and} \quad
\mathbf{u}_B = \left[ \begin{array}{c} h_1 x_{B1} \\ h_2 x_{B2} \end{array} \right]
$$

Then the pairwise error probability is

$$
\mathbf{P}\left(\mathbf{x}_A \rightarrow \mathbf{x}_B\right \vert h_1, h_2) = Q\left( \frac{\Vert \mathbf{u}_A - \mathbf{u}_B \Vert}{2 \sqrt{N_0 / 2}} \right) = Q\left( \sqrt{2 \textsf{SNR} \left[ \vert h_1 \vert^2 (\cos\theta)^2 + \vert h_2 \vert^2 (\sin\theta)^2 \right]} \right).
$$

Taking into account the distribution of the channel gains $h_1$ and $h_2$, the average error probability satisfies

$$
\mathbf{P}\left(\mathbf{x}_A \rightarrow \mathbf{x}_B\right) = \mathbb{E}_{h_1,h_2} \left[ Q\left( \sqrt{2 \textsf{SNR} \left[ \vert h_1 \vert^2 (\cos\theta)^2 + \vert h_2 \vert^2 (\sin\theta)^2 \right]} \right) \right] \leq \left( \frac{1}{1 + \textsf{SNR} (\cos\theta)^2} \right) \left( \frac{1}{1 + \textsf{SNR} (\sin\theta)^2} \right).
$$

Now we can see that the error probability is bounded by $\textsf{SNR}^{-2}$, as long as $\cos\theta \neq 0$ and $\sin\theta \neq 0$.

Therefore, the rotation code achieves an error decay of $\textsf{SNR}^{-2}$ while transmitting two different symbols in two time slots!
117 changes: 117 additions & 0 deletions morea/06-time-diversity/reading-06-performance-gain-time-diversity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
title: "Performance gain from time diversity"
published: true
morea_id: reading-06-performance-gain-time-diversity
morea_summary: "Diversity in time improves the performance"
# morea_url: https://github.com/airbnb/javascript
morea_type: reading
morea_labels:
morea_sort_order: 61
---

# Performance gain from time diversity

From [the previous module](../05-detection-in-fading-channel/reading-05-coherent-detection.html/), we realize the fundamental difference in the performance under the additive white Gaussian noise (AWGN) channels and the wireless fading channels. More specifically, the bit error rate (BER) decays exponentially with the signal-to-noise ratio (SNR), namely $p_e < e^{-\textsf{SNR}}$, in the AWGN channel, while it decays only linearly, namely $p_e = \mathcal{O}\left(\frac{1}{\textsf{SNR}}\right)$ in the wireless fading channel.

How can we improve the performance under wireless channels? We know that the reason for the performance degradation is deep fading, where the channel gain is so small that the received signal is at the same energy level of the noise. But the channel is changing over time, and deep fading happens with certain probability. If we send multiple copies of the transmit signal over time, it is more likely that some of the copies do not experience deep fading. This is the idea of **time diversity**.

## Performance of repetition coding

To get the insight of how time diversity works, we consider a simple case of *repetition code*. Specifically, we send $L$ copies of a transmit signal $x$, namely

$$
\mathbf{y} = \left[ \begin{array}{c} y_1 \\ \vdots \\ y_L \end{array} \right]
= \left[ \begin{array}{c} h_1 x + w_1 \\ \vdots \\ h_L x + w_L \end{array} \right]
= \mathbf{h} \cdot x + \mathbf{w},
$$

where $x = \pm a$ is the symbol in binary phase shift keying (BPSK), $\mathbf{h} \in \mathbb{C}^L$ is the channel vector, and $\mathbf{w} \in \mathbb{C}^L$ is the noise vector. We assume that each channel gain $h_\ell$ are independent and follows the Rayleight distribution $h_\ell \sim \mathcal{CN}(0,1)$, and that each noise $w_\ell$ are independent and follows the Rayleight distribution $w_\ell \sim \mathcal{CN}(0,N_0)$.

We can assume that we know the channel gains $\mathbf{h}$ in these $L$ time slots perfectly. Then we can perform *coherent detection* of the transmit symbol $x$.

### Detection in a complex vector space

Before analyzing the repetition coding, we can quantify the performance of detection in a general complex vector space. The results can be applied to special cases later, including the case of BPSK under repetition coding.

Consider a signal scheme where the binary bits are mapped to two signals in a complex vector space, denoted by $\mathbf{u}_A \in \mathbb{C}^{L}$ and $\mathbf{u}_B \in \mathbb{C}^{L}$. The received signal is

$$
\mathbf{y} = \mathbf{u} + \mathbf{w},
$$

where $\mathbf{w} \sim \mathcal{CN}(\boldsymbol{0}, N_0 \mathbf{I}_L)$, and $\mathbf{I}_L$ is the $L \times L$ identify matrix.

The maximum likelihood detector compares the conditional probability density function (PDF) of the received signal given the transmit signal, namely

$$
\hat{\mathbf{u}} = \left\{
\begin{aligned}
&\mathbf{u}_A, && \text{if } f(\mathbf{y} \vert \mathbf{u}_A) \ge f(\mathbf{y} \vert \mathbf{u}_B), \\
&\mathbf{u}_B, && \text{if } f(\mathbf{y} \vert \mathbf{u}_A) < f(\mathbf{y} \vert \mathbf{u}_B).
\end{aligned}
\right.
$$

When $\mathbf{x}_A$ was sent, we have $\mathbf{y} - \mathbf{u}_A \sim \mathcal{CN}(\boldsymbol{0}, N_0 \mathbf{I}_L)$. When $\mathbf{u}_B$ was sent, we have $\mathbf{y} - \mathbf{u}_B \sim \mathcal{CN}(\boldsymbol{0}, N_0 \mathbf{I}_L)$. Hence, the conditional PDF can be written explicitly as ([see results on complex Gaussian random vectors here](../05-detection-in-fading-channel/reading-05-complex-gaussian.html/))

\begin{aligned}
f(\mathbf{y} \vert \mathbf{u}_A) = \frac{1}{\pi^L N_0^L} e^{-\frac{\Vert \mathbf{y} - \mathbf{u}_A \Vert^2}{N_0}} \quad \text{and} \quad f(\mathbf{y} \vert \mathbf{u}_B) = \frac{1}{\pi^L N_0^L} e^{-\frac{\Vert \mathbf{y} - \mathbf{u}_B \Vert^2}{N_0}}.
\end{aligned}

Therefore, the maximum likelihood detector has a simple decision rule:

$$
\hat{\mathbf{u}} = \left\{
\begin{aligned}
&\mathbf{u}_A, && \text{if } \Vert \mathbf{y} - \mathbf{u}_A \Vert^2 \le \Vert \mathbf{y} - \mathbf{u}_B \Vert^2, \\
&\mathbf{u}_B, && \text{if } \Vert \mathbf{y} - \mathbf{u}_A \Vert^2 > \Vert \mathbf{y} - \mathbf{u}_B \Vert^2.
\end{aligned}
\right.
$$

The physical meaning is also very clear: the transmit signal is more likely to be the one that is closer to the received signal.

Now we can derive the error probability of the maximum likelihood detection. Due to symmetry of the noise, we can focus on the case where $\mathbf{u}_A$ was sent and the detector output $\hat{\mathbf{u}} = \mathbf{u}_B$. In this case, the errors happens when $\Vert \mathbf{y} - \mathbf{u}_A \Vert^2 > \Vert \mathbf{y} - \mathbf{u}_B \Vert^2$. Using the fact that $\mathbf{y} = \mathbf{u}_A + \mathbf{w}$, we have

$$
\begin{aligned}
& \quad \Vert \mathbf{y} - \mathbf{u}_A \Vert^2 > \Vert \mathbf{y} - \mathbf{u}_B \Vert^2 \\
\Leftrightarrow & \quad \Vert (\mathbf{u}_A + \mathbf{w}) - \mathbf{u}_A \Vert^2 > \Vert (\mathbf{u}_A + \mathbf{w}) - \mathbf{u}_B \Vert^2 \\
\Leftrightarrow & \quad \Vert \mathbf{w} \Vert^2 > \Vert \mathbf{w} + \mathbf{u}_A - \mathbf{u}_B \Vert^2 \\
\Leftrightarrow & \quad \mathfrak{R}\left[ \left( \mathbf{u}_A - \mathbf{u}_B \right)^H \mathbf{w} \right] < - \frac{\Vert \mathbf{u}_A - \mathbf{u}_B \Vert^2}{2} \\
\end{aligned}
$$

Since the noise vector $\mathbf{w} \sim \mathcal{CN}(\boldsymbol{0}, N_0 \mathbf{I}_L)$, we have $\left( \mathbf{u}_A - \mathbf{u}_B \right)^H \mathbf{w} \sim \mathcal{CN}(0, \Vert \mathbf{u}_A - \mathbf{u}_B \Vert^2 N_0)$. Hence, we have

$$
\mathfrak{R}\left[ \left( \mathbf{u}_A - \mathbf{u}_B \right)^H \mathbf{w} \right] \sim \mathcal{N}\left(0, \Vert \mathbf{u}_A - \mathbf{u}_B \Vert^2 \frac{N_0}{2}\right).
$$

Now we can write the error probability in terms of the Q function

$$
\mathbf{P}\left( \mathfrak{R}\left[ \left( \mathbf{u}_A - \mathbf{u}_B \right)^H \mathbf{w} \right] < - \frac{\Vert \mathbf{u}_A - \mathbf{u}_B \Vert^2}{2} \right) = Q\left( \frac{\Vert \mathbf{u}_A - \mathbf{u}_B \Vert^2 / 2}{\sqrt{\Vert \mathbf{u}_A - \mathbf{u}_B \Vert^2 N_0 / 2}} \right) = Q\left( \frac{\Vert \mathbf{u}_A - \mathbf{u}_B \Vert}{2 \sqrt{N_0 / 2}} \right).
$$

We can see that the error rate decreases with the distance $\Vert \mathbf{u}_A - \mathbf{u}_B \Vert$ between the two symbols and increases with the noise power $N_0$.

### Detection for BPSK under repetition coding

Now we consider the special case of BPSK, where $x = \pm a$. Under repetition coding, we have $\mathbf{u}_A = a \cdot \mathbf{h}$ and $\mathbf{u}_B = -a \cdot \mathbf{h}$. Then given a realization of the channel gain $\mathbf{h}$, the error probability is

$$
\mathbf{P}(\text{error}|\mathbf{h}) = Q\left( \frac{\Vert a \mathbf{h} - (-a \cdot \mathbf{h}) \Vert}{2 \sqrt{N_0 / 2}} \right) = Q\left( \frac{a \Vert \mathbf{h} \Vert}{\sqrt{N_0 / 2}} \right) = Q\left( \sqrt{2 \Vert \mathbf{h} \Vert^2 \textsf{SNR}} \right).
$$

Since the channel follows Rayleigh fading, the square of the norm $\Vert \mathbf{h} \Vert^2 = \sum_{\ell=1}^L \vert h_\ell \vert^2$ follows the [Chi-square distribution with $2L$ degrees of freedom](https://en.wikipedia.org/wiki/Chi-squared_distribution).

Therefore, the average error probability is

$$
p_e = \int_{0}^{\infty} Q\left( \sqrt{2 \Vert \mathbf{h} \Vert^2 \textsf{SNR}} \right) f(\Vert \mathbf{h} \Vert^2) d \Vert \mathbf{h} \Vert^2 \approx \mathcal{O}\left( \frac{1}{\textsf{SNR}^L} \right).
$$

Compared to BPSK without repetition coding, we get a better scaling law of $\textsf{SNR}^{-L}$. We call $L$ the **diversity gain**.

However, the diversity gain comes at the expense of the reduced data rate under repetition coding, because we transmit the same symbol over $L$ time slots. Can we get the diversity gain without sacrificing the data rate?
22 changes: 22 additions & 0 deletions morea/06-time-diversity/reading-06-roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "Roadmap of this module"
published: true
morea_id: reading-06-roadmap
morea_summary: "Overview"
# morea_url: https://github.com/airbnb/javascript
morea_type: reading
morea_labels:
morea_sort_order: 60
---

<div class="alert alert-success" role="alert" markdown="1">
<i class="fa-solid fa-book fa-xl"></i> **Reading in the textbook**
<hr/>

This module covers Section 3.2 of [the textbook](https://web.stanford.edu/~dntse/papers/book121004.pdf).
</div>


In this module, we utilize time diversity of wireless channels.

We analyze how much performance gain can be achieved through time diversity, and discuss some practical approaches to achieve time diversity.

0 comments on commit 7870e23

Please sign in to comment.