Fix some bugs and add more shannon sampling/zero isi stuff

This commit is contained in:
Peter 2024-11-02 03:50:11 +08:00
parent dbb68ed60a
commit 3f1deefd89
4 changed files with 243 additions and 162 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
copyrighted_images copyrighted_images
README-copyright.pdf

File diff suppressed because one or more lines are too long

213
README.md
View File

@ -1,5 +1,13 @@
# Idiot's guide to ELEC4402 communication systems # Idiot's guide to ELEC4402 communication systems
<style>
@media print{
.copyrighted{
display: none !important;
}
}
</style>
<!-- PRINT NOTE: Use 0.20 margins all around, scale: fit to page width, and no headers or backgrounds --> <!-- PRINT NOTE: Use 0.20 margins all around, scale: fit to page width, and no headers or backgrounds -->
This unit allows you to bring infinite physical notes (except books borrowed from the UWA library) to all tests and the final exam. You can't rely on what material they provide in the test/exam, it is very _minimal_ to say the least. Hope this helps. This unit allows you to bring infinite physical notes (except books borrowed from the UWA library) to all tests and the final exam. You can't rely on what material they provide in the test/exam, it is very _minimal_ to say the least. Hope this helps.
@ -70,7 +78,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div style="page-break-after: always;"></div> <div style="page-break-after: always;"></div>
## Fourier transform identities ## Fourier transform identities and properties
| Time domain $x(t)$ | Frequency domain $X(f)$ | | Time domain $x(t)$ | Frequency domain $X(f)$ |
| --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
@ -85,25 +93,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
| $\delta(t - t_0)$ | $\exp(-j2\pi f t_0)$ | | $\delta(t - t_0)$ | $\exp(-j2\pi f t_0)$ |
| $\exp(j2\pi f_c t)$ | $\delta(f - f_c)$ | | $\exp(j2\pi f_c t)$ | $\delta(f - f_c)$ |
| $\cos(2\pi f_c t)$ | $\frac{1}{2}[\delta(f - f_c) + \delta(f + f_c)]$ | | $\cos(2\pi f_c t)$ | $\frac{1}{2}[\delta(f - f_c) + \delta(f + f_c)]$ |
| $\cos(2\pi f_c t+\theta)$ | $\frac{1}{2}[\delta(f - f_c)\exp(j\theta) + \delta(f + f_c)\exp(-j\theta)]\quad\text{Use for coherent recv.}$ |
| $\sin(2\pi f_c t)$ | $\frac{1}{2j} [\delta(f - f_c) - \delta(f + f_c)]$ | | $\sin(2\pi f_c t)$ | $\frac{1}{2j} [\delta(f - f_c) - \delta(f + f_c)]$ |
| $\sin(2\pi f_c t+\theta)$ | $\frac{1}{2j} [\delta(f - f_c)\exp(j\theta) - \delta(f + f_c)\exp(-j\theta)]$ |
| $\text{sgn}(t)$ | $\frac{1}{j\pi f}$ | | $\text{sgn}(t)$ | $\frac{1}{j\pi f}$ |
| $\frac{1}{\pi t}$ | $-j \text{sgn}(f)$ | | $\frac{1}{\pi t}$ | $-j \text{sgn}(f)$ |
| $u(t)$ | $\frac{1}{2} \delta(f) + \frac{1}{j2\pi f}$ | | $u(t)$ | $\frac{1}{2} \delta(f) + \frac{1}{j2\pi f}$ |
| $\sum_{n=-\infty}^{\infty} \delta(t - nT_0)$ | $\frac{1}{T_0} \sum_{n=-\infty}^{\infty} \delta\left(f - \frac{n}{T_0}\right)=f_0 \sum_{n=-\infty}^{\infty} \delta\left(f - n f_0\right)$ | | $\sum_{n=-\infty}^{\infty} \delta(t - nT_0)$ | $\frac{1}{T_0} \sum_{n=-\infty}^{\infty} \delta\left(f - \frac{n}{T_0}\right)=f_0 \sum_{n=-\infty}^{\infty} \delta\left(f - n f_0\right)$ |
| Time domain $x(t)$ | Frequency domain $X(f)$ | Property | | Time domain $x(t)$ | Frequency domain $X(f)$ | Property |
| ------------------------------- | ------------------------------------------------ | ------------------------- | | ---------------------------------------- | ------------------------------------------------ | ----------------------------- |
| $g(t-a)$ | $\exp(-j2\pi fa)G(f)$ | Time shifting | | $g(t-a)$ | $\exp(-j2\pi fa)G(f)$ | Time shifting |
| $\exp(-j2\pi f_c t)g(t)$ | $G(f-f_c)$ | Frequency shifting | | $\exp(-j2\pi f_c t)g(t)$ | $G(f-f_c)$ | Frequency shifting |
| $g(bt)$ | $\frac{G(f/b)}{\|b\|}$ | Time scaling | | $g(bt)$ | $\frac{G(f/b)}{\|b\|}$ | Time scaling |
| $g(bt-a)$ | $\frac{1}{\|b\|}\exp(-j2\pi a(f/b))\cdot G(f/b)$ | Time scaling and shifting | | $g(bt-a)$ | $\frac{1}{\|b\|}\exp(-j2\pi a(f/b))\cdot G(f/b)$ | Time scaling and shifting |
| $\frac{d}{dt}g(t)$ | $j2\pi fG(f)\quad$ | Differentiation wrt time | | $\frac{d}{dt}g(t)$ | $j2\pi fG(f)\quad$ | Differentiation wrt time |
| $g^*(t)$ | $G^*(-f)$ | Conjugate functions | | $tg(t)$ | $\frac{1}{2\pi}\frac{d}{df}G(f)\quad$ | Differentiation wrt frequency |
| $G(t)$ | $g(-f)$ | Duality | | $g^*(t)$ | $G^*(-f)$ | Conjugate functions |
| $\int_{-\infty}^t g(\tau)d\tau$ | $\frac{1}{j2\pi f}G(f)+\frac{G(0)}{2}\delta(f)$ | Integration wrt time | | $G(t)$ | $g(-f)$ | Duality |
| $g(t)h(t)$ | $G(f)*H(f)$ | Time multiplication | | $\int_{-\infty}^t g(\tau)d\tau$ | $\frac{1}{j2\pi f}G(f)+\frac{G(0)}{2}\delta(f)$ | Integration wrt time |
| $g(t)*h(t)$ | $G(f)H(f)$ | Time convolution | | $g(t)h(t)$ | $G(f)*H(f)$ | Time multiplication |
| $ag(t)+bh(t)$ | $aG(f)+bH(f)$ | Linearity $a,b$ constants | | $g(t)*h(t)$ | $G(f)H(f)$ | Time convolution |
| $ag(t)+bh(t)$ | $aG(f)+bH(f)$ | Linearity $a,b$ constants |
| $\int_{-\infty}^\infty x(t)y^*(t)dt$ | $\int_{-\infty}^\infty X(f)Y^*(f)df$ | Parseval's theorem |
| $E_x=\int_{-\infty}^\infty \|x(t)\|^2dt$ | $E_x=\int_{-\infty}^\infty \|X(f)\|^2df$ | Parseval's theorem |
| Description | Property | | Description | Property |
| ----------------------------------- | ----------------- | | ----------------------------------- | ----------------- |
@ -338,11 +351,13 @@ Overmodulation (resulting in phase reversals at crossing points): $m_a>1$
```math ```math
\begin{align*} \begin{align*}
s(t) &= A_c\cos\left[2\pi f_c t + k_p m(t)\right]\quad\text{Phase modulated (PM)}\\ s(t) &= A_c\cos\left[2\pi f_c t + k_p m(t)\right]\quad\text{Phase modulated (PM)}\\
s(t) &= A_c\cos\left[2\pi f_c t + 2 \pi k_f \int_0^t m(\tau) d\tau\right]\quad\text{Frequency modulated (FM)}\\ s(t) &= A_c\cos(\theta_i(t))=A_c\cos\left[2\pi f_c t + 2 \pi k_f \int_{-\infty}^t m(\tau) d\tau\right]\quad\text{Frequency modulated (FM)}\\
s(t) &= A_c\cos\left[2\pi f_c t + \beta \sin(2\pi f_m t)\right]\quad\text{FM single tone}\\ s(t) &= A_c\cos\left[2\pi f_c t + \beta \sin(2\pi f_m t)\right]\quad\text{FM single tone}\\
\beta&=\frac{\Delta f}{f_m}=k_f A_m\quad\text{Modulation index}\\ f_i(t) &= \frac{1}{2\pi}\frac{d}{dt}\theta_i(t)\quad\text{Instantaneous frequency from instantaneous phase}\\
\Delta f&=\beta f_m=k_f A_m f_m = \max_t(k_f m(t))- \min_t(k_f m(t))\quad\text{Maximum frequency deviation}\\ \Delta f&=\beta f_m=k_f A_m f_m = \max_t(k_f m(t))- \min_t(k_f m(t))\quad\text{Maximum frequency deviation}\\
D&=\frac{\Delta f}{W_m}\quad\text{Deviation ratio, where $W_m$ is bandwidth of $m(t)$ (Use FT)} \Delta f&=\max_t(f_i(t))- \min_t(f_i(t))\quad\text{Maximum frequency deviation}\\
\beta&=\frac{\Delta f}{f_m}=k_f A_m\quad\text{Modulation index}\\
D&=\frac{\Delta f}{W_m}\quad\text{Deviation ratio, where $W_m$ is bandwidth of $m(t)$ (Use FT)}\\
\end{align*} \end{align*}
``` ```
@ -388,27 +403,6 @@ B &= \begin{cases}
<!-- MATH END --> <!-- MATH END -->
#### $\Delta f$ of arbitrary modulating signal
Find instantaneous frequency $f_\text{FM}$.
$M$: Number of **pairs** of significant sidebands
```math
\begin{align*}
s(t)&=A_c\cos(\theta_\text{FM}(t))\\
f_\text{FM}(t) &= \frac{1}{2\pi}\frac{d\theta_\text{FM}(t)}{dt}\\
A_m &= \max_t|m(t)|\\
\Delta f &= \max_t(f_\text{FM}(t)) - f_c\\
W_m &= \text{max}(\text{frequencies in $\theta_\text{FM}(t)$...}) \\
\text{Example: }&\text{sinc}(At+t)+2\cos(2\pi t)=\frac{\sin(2\pi((At+t)/2))}{\pi(At+t)}+2\cos(2\pi t)\to W_m=\max\left(\frac{A+1}{2},1\right)\\
D &= \frac{\Delta f}{W_m}\\
B_T &= 2(D+1)W_m
\end{align*}
```
<!-- MATH END -->
### Complex envelope ### Complex envelope
```math ```math
@ -436,20 +430,44 @@ B_T &= 2(D+1)W_m
G_x(f)&=G(f)G_w(f)\text{ (PSD)}\\ G_x(f)&=G(f)G_w(f)\text{ (PSD)}\\
G_x(f)&=\lim_{T\to\infty}\frac{|X_T(f)|^2}{T}\text{ (PSD)}\\ G_x(f)&=\lim_{T\to\infty}\frac{|X_T(f)|^2}{T}\text{ (PSD)}\\
G_x(f)&=\mathfrak{F}[R_x(\tau)]\text{ (WSS)}\\ G_x(f)&=\mathfrak{F}[R_x(\tau)]\text{ (WSS)}\\
P&=\sigma^2=\int_\mathbb{R}G_x(f)df\\ P_x&={\sigma_x}^2=\int_\mathbb{R}G_x(f)df\quad\text{For zero mean}\\
P&=\sigma^2=\lim_{t\to\infty}\frac{1}{T}\int_{-T/2}^{T/2}|x(t)|^2dt\\ P_x&={\sigma_x}^2=\lim_{t\to\infty}\frac{1}{T}\int_{-T/2}^{T/2}|x(t)|^2dt\quad\text{For zero mean}\\
P[A\cos(2\pi f t+\phi)]&=\frac{A^2}{2}\quad\text{Power of sinusoid }\\ P[A\cos(2\pi f t+\phi)]&=\frac{A^2}{2}\quad\text{Power of sinusoid }\\
E&=\int_{-\infty}^{\infty}|x(t)|^2dt=|X(f)|^2\\ E_x&=\int_{-\infty}^{\infty}|x(t)|^2dt=\int_{-\infty}^{\infty}|X(f)|^2df\quad\text{Parseval's theorem}\\
R_x(\tau) &= \mathfrak{F}(G_x(f))\quad\text{PSD to Autocorrelation} R_x(\tau) &= \mathfrak{F}(G_x(f))\quad\text{PSD to Autocorrelation}
\end{align*} \end{align*}
``` ```
<!-- MATH END --> <!-- MATH END -->
##
## Noise performance ## Noise performance
Coherent detection system.
```math
\begin{align*}
y(t) &= m(t)\cos(2\pi f_c t+\theta) = m(t)\cos^2(2\pi f_c t+\theta)\text{ After IF mixing.}\\
&= m(t)\frac{1}{2}(1+\cos(4 f_c t+2\theta))\\
&= \frac{1}{2}m(t)+\frac{1}{2}\cos(4 f_c t+2\theta)\\
\implies S_u(f) &= \left(\frac{1}{2}\right)^2S_u(f)\quad\text{After LPF.}
\end{align*}
```
<!-- MATH END -->
Use formualas from previous section, [Power, energy and autocorrelation](#power-energy-and-autocorrelation).\
Use these formulas in particular:
```math
\begin{align*}
G_\text{WGN}(f)&=\frac{N_0}{2}\\
G_x(f)&=|H(f)|^2G_w(f)&\text{Note the square in $|H(f)|^2$}\\
P_x&={\sigma_x}^2=\int_\mathbb{R}G_x(f)df&\text{Often perform graphical integration}\\
\end{align*}
```
<!-- MATH END -->
```math ```math
\begin{align*} \begin{align*}
\text{CNR}_\text{in} &= \frac{P_\text{in}}{P_\text{noise}}\\ \text{CNR}_\text{in} &= \frac{P_\text{in}}{P_\text{noise}}\\
@ -526,7 +544,8 @@ Do not transmit more than $2B$ samples per second over a channel of $B$ bandwidt
Cannot add directly due to copyright! Cannot add directly due to copyright!
![sampling](copyrighted_images/sampling.png) <img src="copyrighted_images/sampling.png" alt="sampling" class="copyrighted">
![sampling](images/sampling.png) ![sampling](images/sampling.png)
## Quantizer ## Quantizer
@ -557,7 +576,8 @@ Cannot add directly due to copyright!
Cannot add directly due to copyright! Cannot add directly due to copyright!
![quantizer](copyrighted_images/quantizer.png) <img src="copyrighted_images/quantizer.png" alt="quantizer" class="copyrighted">
![quantizer](images/quantizer.png) ![quantizer](images/quantizer.png)
## Line codes ## Line codes
@ -748,7 +768,8 @@ Remember that $T=2T_b$
### 1. Filter function ### 1. Filter function
Find transfer function $h(t)$ of matched filter and apply to an input: Find transfer function $h(t)$ of matched filter and apply to an input:\
Note that $x(T-t)$ is equivalent to horizontally flipping $x(t)$ around $x=T/2$.
```math ```math
\begin{align*} \begin{align*}
@ -761,7 +782,7 @@ Find transfer function $h(t)$ of matched filter and apply to an input:
<!-- MATH END --> <!-- MATH END -->
### 2. Bit error rate ### 2. Bit error rate of matched filter
Bit error rate (BER) from matched filter outputs and filter output noise Bit error rate (BER) from matched filter outputs and filter output noise
@ -886,9 +907,34 @@ Adapted from table 6.1 M F Mesiya - Contemporary Communication Systems
## ISI, channel model ## ISI, channel model
### Raised cosine (RC) pulse
![Raised cosine pulse](images/RC.drawio.svg)
```math
0\leq\alpha\leq1
```
<!-- MATH END -->
⚠ NOTE might not be safe to assume $T'=T$, if you can solve the question without $T$ then use that method.
### Nyquist criterion for zero ISI ### Nyquist criterion for zero ISI
TODO: <!-- P_r(kT)=\begin{cases}
1 & k=0\\
0 & k\neq0
\end{cases} -->
```math
\begin{align*}
D &> 2W\quad\text{Use $W$ from table below depending on modulation scheme.}\\
B_\text{Nyquist} &= \frac{W}{1+\alpha}\\
\alpha&=\frac{\text{Excess BW}}{B_\text{Nyquist}}=\frac{B_\text{abs}-B_\text{Nyquist}}{B_\text{Nyquist}}\\
\end{align*}
```
<!-- MATH END -->
### Nomenclature ### Nomenclature
@ -903,25 +949,17 @@ TODO:
<!-- MATH END --> <!-- MATH END -->
### Raised cosine (RC) pulse ### Bandwidth $W$ and bit error rate of modulation schemes
![Raised cosine pulse](images/RC.drawio.svg)
```math
0\leq\alpha\leq1
```
<!-- MATH END -->
⚠ NOTE might not be safe to assume $T'=T$, if you can solve the question without $T$ then use that method.
To solve this type of question: To solve this type of question:
1. Use the formula for $D$ below 1. Use the formula for $D$ below
2. Consult the BER table below to get the BER which relates the noise of the channel $N_0$ to $E_b$ and to $R_b$. 2. Consult the BER table below to get the BER which relates the noise of the channel $N_0$ to $E_b$ and to $R_b$.
| Linear modulation ($M$-PSK, BPSK, $M$-QAM) | NRZ unipolar encoding, BASK | | Linear modulation | Half |
| --------------------------------------------------- | -------------------------------------------------- | | --------------------------------------------------- | -------------------------------------------------- |
| BPSK, QPSK, $M$-PSK, $M$-QAM, ASK, FSK | $M$-PAM, PAM |
| RZ unipolar, Manchester | NRZ Unipolar, NRZ Polar, Bipolar RZ |
| $W=B_\text{\color{green}abs-abs}$ | $W=B_\text{\color{green}abs}$ | | $W=B_\text{\color{green}abs-abs}$ | $W=B_\text{\color{green}abs}$ |
| $W=B_\text{abs-abs}=\frac{1+\alpha}{T}=(1+\alpha)D$ | $W=B_\text{abs}=\frac{1+\alpha}{2T}=(1+\alpha)D/2$ | | $W=B_\text{abs-abs}=\frac{1+\alpha}{T}=(1+\alpha)D$ | $W=B_\text{abs}=\frac{1+\alpha}{2T}=(1+\alpha)D/2$ |
| $D=\frac{W\text{ symbol/s}}{1+\alpha}$ | $D=\frac{2W\text{ symbol/s}}{1+\alpha}$ | | $D=\frac{W\text{ symbol/s}}{1+\alpha}$ | $D=\frac{2W\text{ symbol/s}}{1+\alpha}$ |
@ -930,37 +968,13 @@ To solve this type of question:
\begin{align*} \begin{align*}
R_b\text{ bit/s}&=(D\text{ symbol/s})\times(k\text{ bit/symbol})\\ R_b\text{ bit/s}&=(D\text{ symbol/s})\times(k\text{ bit/symbol})\\
M\text{ symbol/set}&=2^k\\ M\text{ symbol/set}&=2^k\\
T\text{ s/symbol}&=1/(D\text{ symbol/s})\\
E_b&=PT=P_\text{av}/R_b\quad\text{Energy per bit}\\ E_b&=PT=P_\text{av}/R_b\quad\text{Energy per bit}\\
\end{align*} \end{align*}
``` ```
<!-- MATH END --> <!-- MATH END -->
### Nyquist stuff
#### TODO: Condition for 0 ISI
```math
P_r(kT)=\begin{cases}
1 & k=0\\
0 & k\neq0
\end{cases}
```
<!-- MATH END -->
#### Other
```math
\begin{align*}
\text{Excess BW}&=B_\text{abs}-B_\text{Nyquist}=\frac{1+\alpha}{2T}-\frac{1}{2T}=\frac{\alpha}{2T}\quad\text{FOR NRZ (Use correct $B_\text{abs}$)}\\
\alpha&=\frac{\text{Excess BW}}{B_\text{Nyquist}}=\frac{B_\text{abs}-B_\text{Nyquist}}{B_\text{Nyquist}}\\
T&=1/D
\end{align*}
```
<!-- MATH END -->
### Table of bandpass signalling and BER ### Table of bandpass signalling and BER
| **Binary Bandpass Signaling** | **$B_\text{null-null}$ (Hz)** | **$B_\text{abs-abs}\color{red}=2B_\text{abs}$ (Hz)** | **BER with Coherent Detection** | **BER with Noncoherent Detection** | | **Binary Bandpass Signaling** | **$B_\text{null-null}$ (Hz)** | **$B_\text{abs-abs}\color{red}=2B_\text{abs}$ (Hz)** | **BER with Coherent Detection** | **BER with Noncoherent Detection** |
@ -1113,7 +1127,7 @@ Output has probabiltiy distribution $p_Y(b_j)=P(y=b_j)$
N &\to\text{Output alphabet size}\\ N &\to\text{Output alphabet size}\\
\mathbf{p} &\to\text{Probability vector, any row of the transition matrix}\\ \mathbf{p} &\to\text{Probability vector, any row of the transition matrix}\\
C &= \log_2(N)-H(\mathbf{p})\quad\text{Capacity for weakly symmetric and symmetric channels}\\ C &= \log_2(N)-H(\mathbf{p})\quad\text{Capacity for weakly symmetric and symmetric channels}\\
R &< C \text{ for error-free transmission} R_b &< C \text{ for error-free transmission}
\end{align*} \end{align*}
``` ```
@ -1133,16 +1147,30 @@ C=\frac{1}{2}\log_2\left(1+\frac{P_\text{av}}{N_0/2}\right)
<!-- MATH END --> <!-- MATH END -->
#### Channel capacity of a bandwidth AWGN channel #### Channel capacity of a bandwidth limited AWGN channel
Note: Define XOR ($\oplus$) as exclusive OR, or modulo-2 addition.
```math ```math
\begin{align*} \begin{align*}
P_s&\to\text{Bandwidth limited average power}\\ P_s&\to\text{Bandwidth limited average power}\\
y_i&=\text{bandpass}_W(x_i)+n_i\quad n_i\thicksim N(0,N_0/2)\\ y_i&=\text{bandpass}_W(x_i)+n_i\quad n_i\thicksim N(0,N_0/2)\\
C&=W\log_2\left(1+\frac{P_s}{N_0 W}\right)\\ C&=W\log_2\left(1+\frac{P_s}{N_0 W}\right)\\
C&=W\log_2(1+\text{SNR})\quad\text{SNR}=P_s/(N_0 W) C&=W\log_2(1+\text{SNR})\\
\text{SNR}&=P_s/(N_0 W)
\end{align*}
```
<!-- MATH END -->
#### Shannon limit
```math
\begin{align*}
R_b &< C\\
\implies R_b &< W\log_2\left(1+\frac{P_s}{N_0 W}\right)\quad\text{For bandwidth limited AWGN channel}\\
\frac{E_b}{N_0} &> \frac{2^\eta-1}{\eta}\quad\text{SNR per bit required for error-free transmission}\\
\eta &= \frac{R_b}{W}\quad\text{Spectral efficiency (bit/(s-Hz))}\\
\eta &\gg 1\quad\text{Bandwidth limited}\\
\eta &\ll 1\quad\text{Power limited}
\end{align*} \end{align*}
``` ```
@ -1150,6 +1178,8 @@ Note: Define XOR ($\oplus$) as exclusive OR, or modulo-2 addition.
## Channel code ## Channel code
Note: Define XOR ($\oplus$) as exclusive OR, or modulo-2 addition.
| | | | | | | |
| ---------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | ---------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Hamming weight | $w_H(x)$ | Number of `'1'` in codeword $x$ | | Hamming weight | $w_H(x)$ | Number of `'1'` in codeword $x$ |
@ -1168,8 +1198,7 @@ A linear block code must be a subspace and satisfy both:
1. Zero vector must be present at least once 1. Zero vector must be present at least once
2. The XOR of any codeword pair in the code must result in a codeword that is already present in the code table. 2. The XOR of any codeword pair in the code must result in a codeword that is already present in the code table.
3. $d_\text{min}=w_\text{min}$ (Implied by (1) and (2).)
For a linear block code, $d_\text{min}=w_\text{min}$
### Code generation ### Code generation

Binary file not shown.