diff --git a/_posts/2024-10-29-Idiots-guide-to-ELEC4402-Communications-Systems.md b/_posts/2024-10-29-Idiots-guide-to-ELEC4402-Communications-Systems.md index 35b3845..324b268 100644 --- a/_posts/2024-10-29-Idiots-guide-to-ELEC4402-Communications-Systems.md +++ b/_posts/2024-10-29-Idiots-guide-to-ELEC4402-Communications-Systems.md @@ -127,7 +127,7 @@ $$ \text{sgn}(t) &= \begin{cases} +1, & t > 0 \\ 0, & t = 0 \\ -1, & t < 0 \end{cases}&\text{Signum Function}\\ \text{sinc}(2Wt) &= \frac{\sin(2\pi W t)}{2\pi W t}&\text{sinc Function}\\ \text{rect}(t) = \Pi(t) &= \begin{cases} 1, & -0.5 < t < 0.5 \\ 0, & \lvert t \rvert > 0.5 \end{cases}&\text{Rectangular/Gate Function}\\ - \text{tri}(t/T) &= \begin{cases} 1 - \frac{|t|}{T}, & \lvert t\rvert < T \\ 0, & \lvert t \rvert > T \end{cases}=\Pi(t/T)*\Pi(t/T)&\text{Triangle Function}\\ + \text{tri}(t/T) &= \begin{cases} 1 - \frac{|t|}{T}, & \lvert t\rvert < T \\ 0, & \lvert t \rvert \geq T \end{cases}=\frac{1}{T}\Pi(t/T)*\Pi(t/T)&\text{Triangle Function}\\ g(t)*h(t)=(g*h)(t)&=\int_\infty^\infty g(\tau)h(t-\tau)d\tau&\text{Convolution}\\ \end{align*} $$ @@ -157,42 +157,29 @@ $$ ### Shape functions -| $\text{rect}$ function | $\text{tri}$ function | -| -------------------------------------------------------------------- | --------------------- | -| ![rect](/assets/img/2024-10-29-Idiots-guide-to-ELEC/rect.drawio.svg) | TODO: Add graphic. | +![rect and tri functions](/assets/img/2024-10-29-Idiots-guide-to-ELEC/rect.drawio.svg) -Tri placeholder: For $\text{tri}(t/T)=1-\|t\|/T$, Intersects $x$ axis at $-T$ and $T$ and $y$ axis at $1$. - -### Bessel function +### Random processes examples $$ \begin{align*} - \sum_{n\in\mathbb{Z}}{J_n}^2(\beta)&=1\\ - J_n(\beta)&=(-1)^nJ_{-n}(\beta) + &\text{Example: separate RV from expression}\\ + X(t) &= A\cos(2\pi f_c t)\quad A\thicksim \mathcal{N}(\mu=5,\sigma^2=1)\\ + \implies E[X(t)] &= E[A\cos(2\pi f_c t)] = E[A]\cos(2\pi f_c t) = 5\cos(2\pi f_c t)\\ + &\text{Example: random phase}\\ + X(t) &= B\cos(2\pi f_c t+\theta)\quad \theta\thicksim \mathcal{U}(0,2\pi)\\ + \implies E[X(t)] &= E[B\cos(2\pi f_c t+\theta)] = B\int_0^{2\pi}\underbrace{\frac{1}{2\pi}}_{\text{uniform}}\cos(2\pi f_c t+\theta)d\theta=0 \end{align*} $$ -### White noise +### Wide sense stationary (WSS) -$$ -\begin{align*} -R_W(\tau)&=\frac{N_0}{2}\delta(\tau)=\frac{kT}{2}\delta(\tau)=\sigma^2\delta(\tau)\\ -G_w(f)&=\frac{N_0}{2}\\ -N_0&=kT\\ -G_y(f)&=|H(f)|^2G_w(f)\\ -G_y(f)&=G(f)G_w(f)\\ -\end{align*} -$$ +Two conditions for WSS: -### WSS - -$$ -\begin{align*} - \mu_X(t) &= \mu_X\text{ Constant}\\ - R_{XX}(t_1,t_2)&=R_X(t_1-t_2)=R_X(\tau)\\ - E[X(t_1)X(t_2)]&=E[X(t)X(t+\tau)] -\end{align*} -$$ +| Constant mean | Autocorrelation only dependent on time difference | +| ---------------------------------- | ------------------------------------------------- | +| $\mu_X(t) = \mu_X\text{ Constant}$ | $R_{XX}(t_1,t_2)=R_X(t_1-t_2)=R_X(\tau)$ | +| $\mu_X(t)=E[X(t)]$ | $E[X(t_1)X(t_2)]=E[X(t)X(t+\tau)]$ | ### Ergodicity @@ -204,10 +191,10 @@ $$ \end{align*} $$ -| Type | Normal | Mean square sense | -| ----------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------- | -| ergodic in mean | $$\lim_{T\to\infty}\braket{X(t)}_T=m_X(t)=m_X$$ | $$\lim_{T\to\infty}\text{VAR}[\braket{X(t)}_T]=0$$ | -| ergodic in autocorrelation function | $$\lim_{T\to\infty}\braket{X(t+\tau)X(t)}_T=R_X(\tau)$$ | $$\lim_{T\to\infty}\text{VAR}[\braket{X(t+\tau)X(t)}_T]=0$$ | +| Type | Normal | Mean square sense | +| ----------------------------------- | ----------------------------------------------------- | --------------------------------------------------------- | +| ergodic in mean | $\lim_{T\to\infty}\braket{X(t)}_T=m_X(t)=m_X$ | $\lim_{T\to\infty}\text{VAR}[\braket{X(t)}_T]=0$ | +| ergodic in autocorrelation function | $\lim_{T\to\infty}\braket{X(t+\tau)X(t)}_T=R_X(\tau)$ | $\lim_{T\to\infty}\text{VAR}[\braket{X(t+\tau)X(t)}_T]=0$ | Note: **A WSS random process needs to be both ergodic in mean and autocorrelation to be considered an ergodic process** @@ -289,19 +276,19 @@ $$ ## AM -### CAM +### Conventional AM modulation (CAM) $$ \begin{align*} - x(t)&=A_c\cos(2\pi f_c t)\left[1+k_a m(t)\right]=A_c\cos(2\pi f_c t)\left[1+m_a m(t)/A_c\right], \\ + x(t)&=A_c\cos(2\pi f_c t)\left[1+k_a m(t)\right]=A_c\cos(2\pi f_c t)\left[1+m_a m(t)/A_c\right]\quad\text{CAM signal}\\ &\text{where $m(t)=A_m\hat m(t)$ and $\hat m(t)$ is the normalized modulating signal}\\ m_a &= \frac{|\min_t(k_a m(t))|}{A_c} \quad\text{$k_a$ is the amplitude sensitivity ($\text{volt}^{-1}$), $m_a$ is the modulation index.}\\ m_a &= \frac{A_\text{max}-A_\text{min}}{A_\text{max}+A_\text{min}}\quad\text{ (Symmetrical $m(t)$)}\\ m_a&=k_a A_m \quad\text{ (Symmetrical $m(t)$)}\\ P_c &=\frac{ {A_c}^2}{2}\quad\text{Carrier power}\\ - P_x &=\frac{1}{4}{m_a}^2{A_c}^2\\ - \eta&=\frac{\text{Signal Power}}{\text{Total Power}}=\frac{P_x}{P_x+P_c}\\ - B_T&=2f_m=2B + P_s &=\frac{1}{4}{m_a}^2{A_c}^2\quad\text{Signal power, \textbf{total} of all 4 sideband power, \textbf{single-tone} case}\\ + \eta&=\frac{\text{Signal Power}}{\text{Total Power}}=\frac{P_s}{P_s+P_c}=\frac{P_s}{P_x}\quad\text{Power efficiency}\\ + B_T&=2f_m=2B\\ \end{align*} $$ @@ -310,7 +297,7 @@ $B$: Bandwidth of modulating wave Overmodulation (resulting in phase reversals at crossing points): $m_a>1$ -### DSB-SC +### Double sideband suppressed carrier (DSB-SC) $$ \begin{align*} @@ -334,11 +321,24 @@ $$ \end{align*} $$ +### Bessel function + +$$ +\begin{align*} + J_n(\beta)&=\begin{cases} + J_{-n}(\beta) & \text{$n$ is even}\\ + -J_{-n}(\beta) & \text{$n$ is odd} + \end{cases}\\ + 1&=\sum_{n\in\mathbb{Z}}{J_n}^2(\beta)&\text{Conservation of power}\\ +\end{align*} +$$ + ### Bessel form and magnitude spectrum (single tone) $$ \begin{align*} - s(t) &= A_c\cos\left[2\pi f_c t + \beta \sin(2\pi f_m t)\right] \Leftrightarrow s(t)= A_c\sum_{n=-\infty}^{\infty}J_n(\beta)\cos[2\pi(f_c+nf_m)t] + s(t) &= A_c\cos\left[2\pi f_c t + \beta \sin(2\pi f_m t)\right]\\ + \Longleftrightarrow s(t) &= A_c\sum_{n=-\infty}^{\infty}J_n(\beta)\cos[2\pi(f_c+nf_m)t] \end{align*} $$ @@ -346,10 +346,12 @@ $$ $$ \begin{align*} - P_\text{av}&=\frac{ {A_c}^2}{2}\\ - P_\text{band\_index}&=\frac{ {A_c}^2{J_\text{band\_index}}^2(\beta)}{2}\\ - \text{band\_index}&=0\implies f_c+0f_m\\ - \text{band\_index}&=1\implies f_c+1f_m,\dots\\ + P_\text{av}&=\frac{ {A_c}^2}{2}&\text{Av. power of full signal}\\ + P_\text{i}&=\frac{ {A_c}^2|{J_\text{i}}(\beta)|^2}{2}&\text{Av. power of band $i$}\\ + i=0&\implies f_c+0f_m&\text{Middle band}\\ + i=1&\implies f_c+1f_m&\text{1st sideband}\\ + i=-1&\implies f_c-1f_m&\text{-1st sideband}\\ + &\dots\\ \end{align*} $$ @@ -357,9 +359,9 @@ $$ $$ \begin{align*} -B &= 2Mf_m = 2(\beta + 1)f_m\\ - &= 2(\Delta f_\text{max}+f_m)\\ - &= 2(D+1)W_m\\ +B &= 2(\beta + 1)f_m\\ +B &= 2(\Delta f_\text{max}+f_m)\\ +B &= 2(D+1)W_m\\ B &= \begin{cases} 2(\Delta f_\text{max}+f_m)=2(\Delta f_\text{max}+W_m) & \text{FM, sinusoidal message}\\ 2(\Delta\phi_\text{max} + 1)f_m=2(\Delta \phi_\text{max}+1)W_m & \text{PM, sinusoidal message} @@ -367,11 +369,12 @@ B &= \begin{cases} \end{align*} $$ -### Complex envelope +### Complex envelope of a FM signal $$ \begin{align*} - s(t)&=A_c\cos(2\pi f_c t+\beta\sin(2\pi f_m t)) \Leftrightarrow \tilde{s}(t) = A_c\exp(j\beta\sin(2\pi f_m t))\\ + s(t)&=A_c\cos(2\pi f_c t+\beta\sin(2\pi f_m t))\\ + \Longleftrightarrow \tilde{s}(t) &= A_c\exp(j\beta\sin(2\pi f_m t))\\ s(t)&=\text{Re}[\tilde{s}(t)\exp{(j2\pi f_c t)}]\\ \tilde{s}(t) &= A_c\sum_{n=-\infty}^{\infty}J_n(\beta)\exp(j2\pi f_m t) \end{align*} @@ -396,15 +399,23 @@ $$ 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 }\\ 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}\\ + P_x &= R_x(0)\quad\text{Average power of WSS process $x(t)$}\\ \end{align*} $$ -## +### White noise + +$$ +\begin{align*} +R_W(\tau)&=\frac{N_0}{2}\delta(\tau)=\frac{kT}{2}\delta(\tau)=\sigma^2\delta(\tau)\\ +G_w(f)&=\frac{N_0}{2}\\ +\end{align*} +$$ ## Noise performance -Coherent detection system. + Use formualas from previous section, [Power, energy and autocorrelation](#power-energy-and-autocorrelation).\ Use these formulas in particular: @@ -489,9 +500,9 @@ $$ Do not transmit more than $2B$ samples per second over a channel of $B$ bandwidth. -```math +$$ \text{Nyquist rate} = 2B\quad\text{Nyquist interval}=\frac{1}{2B} -``` +$$ @@ -500,6 +511,7 @@ Do not transmit more than $2B$ samples per second over a channel of $B$ bandwidt ### Insert here figure 8.3 from M F Mesiya - Contemporary Communication Systems (Add image to `assets/img/2024-10-29-Idiots-guide-to-ELEC/sampling.png`) Cannot add directly due to copyright! +**TODO: Make an open source replacement for this diagram [Send a PR to GitHub](https://github.com/peter-tanner/IDIOTS-GUIDE-TO-ELEC4402-communication-systems/issues/new).** @@ -508,7 +520,7 @@ Cannot add directly due to copyright! $$ \begin{align*} - \Delta &= \frac{x_\text{Max}-x_\text{Min}}{2^k} \quad\text{for $k$-bit quantizer (V/lsb)}\\ + \Delta &= \frac{x_\text{Max}-x_\text{Min}}{2^k} \quad\text{for $k$-bit quantizer (V/lsb)}\quad\text{Quantizer step size $\Delta$}\\ \end{align*} $$ @@ -518,15 +530,18 @@ $$ \begin{align*} e &:= y-x\quad\text{Quantization error}\\ \mu_E &= E[E] = 0\quad\text{Zero mean}\\ - {\sigma_E}^2&=E[E^2]-0^2=\int_{-\Delta/2}^{\Delta/2}e^2\times\left(\frac{1}{\Delta}\right) de\quad\text{Where $E\thicksim 1/\Delta$ uniform over $(-\Delta/2,\Delta/2)$}\\ - \text{SQNR}&=\frac{\text{Signal power}}{\text{Quantization noise}}\\ - \text{SQNR(dB)}&=10\log_{10}(\text{SQNR}) + P_E&={\sigma_E}^2=\frac{\Delta^2}{12}=2^{-2m}V^2/3\quad\text{Uniformly distributed error}\\ + \text{SQNR}&=\frac{\text{Signal power}}{\text{Quantization noise power}}=\frac{P_x}{P_E}\\ + \text{SQNR(dB)}&=10\log_{10}(\text{SQNR})\\ + m\to m+A\text{ bits}&\implies \text{newSQNR(dB)}=\text{SQNR(dB)}+6A\text{ dB} \end{align*} $$ ### Insert here figure 8.17 from M F Mesiya - Contemporary Communication Systems (Add image to `assets/img/2024-10-29-Idiots-guide-to-ELEC/quantizer.png`) Cannot add directly due to copyright! +**TODO: Make an open source replacement for this diagram [Send a PR to GitHub](https://github.com/peter-tanner/IDIOTS-GUIDE-TO-ELEC4402-communication-systems/issues/new).** + @@ -550,6 +565,8 @@ $$ \end{align*} $$ +**TODO: Someone please make plots of the PSD for all line code types in Mathematica or Python! [Send a PR to GitHub](https://github.com/peter-tanner/IDIOTS-GUIDE-TO-ELEC4402-communication-systems/issues/new).** + ## Modulation and basis functions ![Constellation diagrams](./assets/img/2024-10-29-Idiots-guide-to-ELEC/Constellation.drawio.svg) @@ -732,6 +749,8 @@ $$ ### $Q(x)$ function +You should use [$\text{erf}$ function table](#function-1) instead in exams using the identity $Q(x)=\frac{1}{2}-\frac{1}{2}\text{erf}\left(\frac{x}{\sqrt{2}}\right)$. Use this for validation. + | $x$ | $Q(x)$ | $x$ | $Q(x)$ | $x$ | $Q(x)$ | $x$ | $Q(x)$ | | ------ | ---------- | ------ | ----------------------- | ------ | ------------------------ | ------ | ------------------------ | | $0.00$ | $0.5$ | $2.30$ | $0.010724$ | $4.55$ | $2.6823 \times 10^{-6}$ | $6.80$ | $5.231 \times 10^{-12}$ | @@ -785,6 +804,10 @@ Adapted from table 6.1 M F Mesiya - Contemporary Communication Systems ### $\text{erf}(x)$ function +$$ +Q(x)=\frac{1}{2}-\frac{1}{2}\text{erf}(\frac{x}{\sqrt{2}}) +$$ + | $x$ | $\text{erf}(x)$ | $x$ | $\text{erf}(x)$ | $x$ | $\text{erf}(x)$ | | ------ | --------------- | ------ | --------------- | ------ | --------------- | | $0.00$ | $0.00000$ | $0.75$ | $0.71116$ | $1.50$ | $0.96611$ | @@ -805,6 +828,15 @@ Adapted from table 6.1 M F Mesiya - Contemporary Communication Systems \*\*The value of $\text{erf}(3.30)$ should be $\approx0.999997$ instead, but this value is quoted in the formula table. +### $Q(x)$ fast reference + +Using identity. + +| $x$ | $Q(x)$ | +| ----------- | --------- | +| $\sqrt{2}$ | $0.07865$ | +| $2\sqrt{2}$ | $0.00234$ | +
### Receiver output shit @@ -921,6 +953,14 @@ Adapted from table 11.4 M F Mesiya - Contemporary Communication Systems ## Information theory +### Stats + +$$ +\begin{align*} + P(A|B) &= \frac{P(B|A)P(A)}{P(B)} = \frac{P(A,B)}{P(B)}\\ +\end{align*} +$$ + ### Entropy for discrete random variables $$ @@ -939,6 +979,25 @@ $$ Entropy is **maximized** when all have an equal probability. +### Transition probability diagram + +Example for binary erasure channel where $X$ is input and $Y$ is output: + +![Binary erasure channel David Eppstein, Public domain, via Wikimedia Commons](/assets/img/2024-10-29-Idiots-guide-to-ELEC/Binary_erasure_channel.svg) + +Equivalent to: + +$$ +\begin{align*} + P[Y=0|X=0] &= 1-p\\ + P[Y=e|X=0] &= p\\ + P[Y=1|X=1] &= 1-p\\ + P[Y=e|X=1] &= p\\ + P[X=0|Y=0] &= 0\quad\text{Note the direction}\\ + P[Y=0] &= P[Y=0|X=0] P[X=0] +\end{align*} +$$ + ### Differential entropy for continuous random variables TODO: Cut out if not required @@ -964,7 +1023,8 @@ $$ ### Channel model Vertical, $x$: input\ -Horizontal, $y$: output +Horizontal, $y$: output\ +Remember $\mathbf{P}$ is a matrix where each element is $P(y_j|x_i)$ $$ \mathbf{P}=\left[\begin{matrix} @@ -1005,13 +1065,23 @@ $$ \begin{align*} &\text{1. Find }H(x)\\ &\text{2. Find }[\begin{matrix}p_Y(b_0)&p_Y(b_1)&\dots&p_Y(b_j)\end{matrix}] = [\begin{matrix}p_X(a_0)&p_X(a_1)&\dots&p_X(a_i)\end{matrix}]\times\mathbf{P}\\ - &\text{3. Multiply each row in $\textbf{P}$ by $p_X(a_i)$ since $p_{XY}(x_i,y_i)=P(y_i|x_i)P(x_i)$}\\ + &\text{3. Multiply each row in $\textbf{P}$ by $p_X(a_i)$ since $p_{XY}(a_i,b_i)=P(b_i|a_i)P(a_i)$}\\ &\text{4. Find $H(x,y)$ using each element from (3.)}\\ &\text{5. Find }H(x|y)=H(x,y)-H(y)\\ - &\text{6. Find }I(y;x)=H(x)-H(x|y)\\ + &\text{6. Find }I(x;y)=H(x)-H(x|y)\\ \end{align*} $$ +Example of step **3**: + +$$ +\mathbf{P_{XY}}=\left[\begin{matrix} + P(y_1|x_1) P(x_1) & P(y_2|x_1) P(x_1) & \dots\\ + P(y_1|x_2) P(x_2) & P(y_2|x_2) P(x_2) & \dots\\ + \vdots & \vdots &\ddots +\end{matrix}\right] +$$ + ### Channel types | Type | Definition | @@ -1031,6 +1101,8 @@ $$ \end{align*} $$ +**Note that the channel capacity is realized when the channel inputs are uniformly distributed** (i.e. $P(x_1)=P(x_2)=\dots=P(x_N)=\frac{1}{N}$) + #### Channel capacity of an AWGN channel $$ @@ -1249,4 +1321,11 @@ $$ - Transfer function in complex envelope form $\tilde{h}(t)$ should be divided by two. - Convolutions: do not forget width when using graphical method -- todo: add more items to check +- $2W$ for rectangle functions +- Scale sampled spectrum by $f_s$ +- $2f_c$ for spectrum after IF mixing. +- Square transfer function for PSD $G_y(f)=|H(f)|^\mathbf{2}G_x(f)$ +- Square besselJ function for FM power $|J_n(\beta)|^\mathbf{2}$ +- Bandwidth: only consider positive frequencies (so the bandwidth of an AM signal will be the range from the lowest to greatest sideband frequency. For a rectangular function, it will be from 0 to W). +- TODO: add more items to check +- TODO: add some graphics for these checklist items diff --git a/assets/img/2024-10-29-Idiots-guide-to-ELEC/Binary_erasure_channel.svg b/assets/img/2024-10-29-Idiots-guide-to-ELEC/Binary_erasure_channel.svg new file mode 100644 index 0000000..bbe9bc9 --- /dev/null +++ b/assets/img/2024-10-29-Idiots-guide-to-ELEC/Binary_erasure_channel.svg @@ -0,0 +1,34 @@ + + + +0 +1 +0 +1 +1 – p +1 – p +p +e +p + + + + + + + + + + + + + + + + + diff --git a/assets/img/2024-10-29-Idiots-guide-to-ELEC/rect.drawio.svg b/assets/img/2024-10-29-Idiots-guide-to-ELEC/rect.drawio.svg index 956ef3f..d850392 100644 --- a/assets/img/2024-10-29-Idiots-guide-to-ELEC/rect.drawio.svg +++ b/assets/img/2024-10-29-Idiots-guide-to-ELEC/rect.drawio.svg @@ -1,4 +1,4 @@ -
\ No newline at end of file +
\ No newline at end of file