From adc00a39baff866a3b68b52ffc55a4aae71e61c4 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sun, 31 Oct 2021 00:20:51 +0200 Subject: Fix math error in QAM, improve QAM modulator diagram, rename (wrong) QPSK to PSK --- doc/thesis/Fading.tex | 1 + doc/thesis/Makefile | 2 +- doc/thesis/chapters/theory.tex | 18 ++++---- doc/thesis/figures/tikz/psk-constellation.tex | 23 ++++++++++ doc/thesis/figures/tikz/qam-modulator.tex | 58 +++++++++++++++++++++++--- doc/thesis/figures/tikz/qpsk-constellation.tex | 23 ---------- doc/thesis/tex/docmacros.sty | 1 + 7 files changed, 88 insertions(+), 38 deletions(-) create mode 100644 doc/thesis/figures/tikz/psk-constellation.tex delete mode 100644 doc/thesis/figures/tikz/qpsk-constellation.tex (limited to 'doc/thesis') diff --git a/doc/thesis/Fading.tex b/doc/thesis/Fading.tex index f8a5dfd..7ddd44c 100644 --- a/doc/thesis/Fading.tex +++ b/doc/thesis/Fading.tex @@ -35,6 +35,7 @@ \usetikzlibrary{ calc, + positioning, backgrounds, matrix, } diff --git a/doc/thesis/Makefile b/doc/thesis/Makefile index 7095689..55b7a0d 100644 --- a/doc/thesis/Makefile +++ b/doc/thesis/Makefile @@ -15,7 +15,7 @@ SOURCES := \ chapters/conclusions.tex \ \ figures/tikz/overview.tex \ - figures/tikz/qpsk-constellation.tex \ + figures/tikz/psk-constellation.tex \ figures/tikz/qam-modulator.tex \ figures/tikz/qam-constellation.tex diff --git a/doc/thesis/chapters/theory.tex b/doc/thesis/chapters/theory.tex index e3809fd..9477340 100644 --- a/doc/thesis/chapters/theory.tex +++ b/doc/thesis/chapters/theory.tex @@ -52,10 +52,10 @@ The two component \(m_i(t)\) and \(m_q(t)\) are mixed with two different periodi \begin{subequations} \label{eqn:orthonormal-conditions} \begin{align} \langle \phi_i | \phi_q \rangle - &= \int_T \phi_i^* \phi_q \, dt = \int_T \phi_i \phi_q^* \, dt + &= \int_T \phi_i \phi_q^* \, dt = 0, \text{ and } \\ \langle \phi_k | \phi_k \rangle - &= \int_T \phi_k^* \phi_k \,dt = 1, + &= \int_T \phi_k \phi_k^* \,dt = 1, \text{ where } k \text{ is either } i \text{ or } q. \end{align} \end{subequations} @@ -66,10 +66,10 @@ In practice typically \(\phi_i(t) = \cos(\omega_c t)\) and \(\phi_q(t) = j\sin(\ %% TODO: is this assumption correct? Notice that assuming \(m_i\) and \(m_q\) are constant\footnote{This is an approximation assuming that the signal changes much slower relative to the carrier.} over the carrier's period \(T\), \begin{align*} - \langle s | \phi_i \rangle = \int_T s^* \phi_i \,dt - &= \int m_i \phi_i^* \phi_i + m_q \phi_q^* \phi_i \,dt \\ - &= m_i \underbrace{\int_T \phi_i^* \phi_i \,dt}_{1} - + m_q \underbrace{\int_T \phi_q^* \phi_i \,dt}_{0} = m_i, + \langle s | \phi_i \rangle = \int_T s \phi_i^* \,dt + &= \int m_i \phi_i \phi_i^* + m_q \phi_q \phi_i^* \,dt \\ + &= m_i \underbrace{\int_T \phi_i \phi_i^* \,dt}_{1} + + m_q \underbrace{\int_T \phi_q \phi_i^* \,dt}_{0} = m_i, \end{align*} which effectively means that it is possible to isolate a single component \(m_i(t)\) out of \(s(t)\). The same of course works with \(\phi_q\) as well resulting in \(\langle s | \phi_q \rangle = m_q\). Thus (remarkably) it is possible to send two signals on the same frequency, without them interfering with each other. Since each signal can represent one of \(\sqrt{M}\) values, by having two we obtain \(\sqrt{M} \cdot \sqrt{M} = M\) possible combinations. @@ -83,8 +83,8 @@ A better way to see what QAM does, is to observe a so called \emph{constellation \end{subfigure} \hfill \begin{subfigure}{.4\linewidth} - \input{figures/tikz/qpsk-constellation} - \caption{8-PSK\label{fig:qpsk-constellation}} + \input{figures/tikz/psk-constellation} + \caption{8-PSK\label{fig:psk-constellation}} \end{subfigure} \hfill \caption{ @@ -92,7 +92,7 @@ A better way to see what QAM does, is to observe a so called \emph{constellation } \end{figure} -\section{Quadrature phase shift keying (\(M\)-QPSK)} +\section{Quadrature phase shift keying (\(M\)-PSK)} PSK is a popular modulation type for data transmission\cite{Meyer2011}. With a bipolar binary signal, the amplitude remains constant and only the phase will be changed with phase jumps of 180 degrees, which can be seen as a multiplication of the carrier signal with $\pm$ 1. That is alow known as binary phase shift keying. diff --git a/doc/thesis/figures/tikz/psk-constellation.tex b/doc/thesis/figures/tikz/psk-constellation.tex new file mode 100644 index 0000000..d927b19 --- /dev/null +++ b/doc/thesis/figures/tikz/psk-constellation.tex @@ -0,0 +1,23 @@ +% vim: set ts=2 sw=2 noet: +\begin{tikzpicture}[ + axis/.style = { + thick, -latex, black, + }, + star/.style = { + draw = black, thick, fill = red!50, + circle, outer sep = 1mm, inner sep = 0, + minimum size = 1.5mm, + }, + ] + \draw[axis] (-25mm,0) to (25mm,0) node[right] {\(\phi_i\)}; + \draw[axis] (0,-25mm) to (0,25mm) node[above] {\(\phi_q\)}; + + \draw[lightgray, densely dotted, thick] (0,0) circle (15mm); + \foreach \a in {0,1,...,8}{ + \node[star] (s\a) at ({360/8*(.5 + \a)}:15mm) {}; + } + + \foreach \i/\l in {0/000,1/001,2/011,3/010,4/110,5/111,6/101,7/100}{ + \node[lightgray] at ($(s\i) + ({360/8*(.5 + \i)}:5mm)$) {\texttt{\l}}; + } +\end{tikzpicture} diff --git a/doc/thesis/figures/tikz/qam-modulator.tex b/doc/thesis/figures/tikz/qam-modulator.tex index 59d989f..a55ff29 100644 --- a/doc/thesis/figures/tikz/qam-modulator.tex +++ b/doc/thesis/figures/tikz/qam-modulator.tex @@ -57,7 +57,7 @@ \draw (B2Lq.east) -- (Mq.west); \draw (Mq.east) -| (SUM.south); - \draw (SUM) -- (S); + \draw (SUM.east) -- (S); \draw (OSC.east) -| (Mi.south); \draw (OSC.west) -- (H.east); @@ -77,13 +77,61 @@ \node[above left] at (si) {\(s_i(t)\)}; \node[below left] at (sq) {\(s_q(t)\)}; + % Draw digital signals + \begin{scope}[font = \ttfamily\footnotesize, text = blue!70!white] + \node[above = 1mm of M, xshift = 2mm] {\(\ldots 1100101\)}; + \node[above = 7mm of vmi, xshift = 3mm] + {\(\overbracket[.8pt]{\,11\ldots 00\,}^{\sqrt{M} \text{ bits}}\)}; + \end{scope} + + % Draw analog waveform + \begin{scope}[font = \ttfamily\tiny] + \coordinate (O) at ($(mi)+(-2mm,10.5mm)$); + + \node[left, red!70!white, anchor = east, text width = 8mm, align = right] + at ($(O) + (-2mm,0)$) {\(2^{\sqrt{M}}\) levels}; + + \foreach \y in {-3mm,0,3mm} { + \draw[gray, densely dotted] (O) ++(-2mm,\y) -- ++(22mm,0); + } + + \draw[thick, draw = red!70!white] (O) + -- ++(3mm,0) -- ++(0,-3mm) -- ++(3mm,0) -- ++(0,6mm) + -- ++(3mm,0) -- ++(0,-3mm) -- ++(3mm,0) -- ++(0,-3mm) + -- ++(3mm,0) -- ++(0,3mm) -- ++(3mm,0); + \end{scope} + + % Draw constellation diagram + \begin{scope} + \coordinate (O) at ($(S)+(-7mm,8mm)$); + \draw[gray, -latex] (O) ++(-2mm,0) -- ++(12mm,0) node[right] {\tiny \(\phi_i\)}; + \draw[gray, -latex] (O) ++(0,-2mm) -- ++(0,12mm) node[above] {\tiny \(\phi_q\)}; + + \node[ + circle, thick, + minimum size = 3pt, + inner sep = 0, outer sep = .8pt, + draw = gray, fill = red!50!white + ] (P) at ($(O)+(5mm, 4mm)$) {}; + + \node[gray, above right] at (P) {\tiny \(s\)}; + + \draw[gray, densely dotted] + (P) -- (P |- O) + (P) -- (P -| O); + \end{scope} + + + % Background elements \begin{pgfonlayer}{background} \fill[left color = white, right color = blue!20, draw = white] - ($(B2Li.north) + (0,1)$) coordinate (D) rectangle ($(B2Lq.south) - (3,1)$); + ($(B2Li.north) + (0,1.1)$) coordinate (D) rectangle ($(B2Lq.south) - (3,1)$); \fill[right color = white, left color = red!20, draw = white] - ($(B2Li.north) + (0,1)$) coordinate (A) rectangle ($(B2Lq.south) + (9,-1)$); + ($(B2Li.north) + (0,1.1)$) coordinate (A) rectangle ($(B2Lq.south) + (9,-1)$); - \node[blue!50, anchor = south east, font = \ttfamily\bfseries, xshift = -4mm] at (D) {\bfseries\ttfamily Digital bits}; - \node[red!50, anchor = south west, font = \bfseries\ttfamily, xshift = 4mm] at (A) {Analog waveform}; + \node[blue!50, anchor = south east, font = \ttfamily\bfseries, xshift = -4mm] + at (D) {\bfseries\ttfamily Digital bits}; + \node[red!50, anchor = south west, font = \bfseries\ttfamily, xshift = 4mm] + at (A) {Analog waveform}; \end{pgfonlayer} \end{circuitikz} diff --git a/doc/thesis/figures/tikz/qpsk-constellation.tex b/doc/thesis/figures/tikz/qpsk-constellation.tex deleted file mode 100644 index d927b19..0000000 --- a/doc/thesis/figures/tikz/qpsk-constellation.tex +++ /dev/null @@ -1,23 +0,0 @@ -% vim: set ts=2 sw=2 noet: -\begin{tikzpicture}[ - axis/.style = { - thick, -latex, black, - }, - star/.style = { - draw = black, thick, fill = red!50, - circle, outer sep = 1mm, inner sep = 0, - minimum size = 1.5mm, - }, - ] - \draw[axis] (-25mm,0) to (25mm,0) node[right] {\(\phi_i\)}; - \draw[axis] (0,-25mm) to (0,25mm) node[above] {\(\phi_q\)}; - - \draw[lightgray, densely dotted, thick] (0,0) circle (15mm); - \foreach \a in {0,1,...,8}{ - \node[star] (s\a) at ({360/8*(.5 + \a)}:15mm) {}; - } - - \foreach \i/\l in {0/000,1/001,2/011,3/010,4/110,5/111,6/101,7/100}{ - \node[lightgray] at ($(s\i) + ({360/8*(.5 + \i)}:5mm)$) {\texttt{\l}}; - } -\end{tikzpicture} diff --git a/doc/thesis/tex/docmacros.sty b/doc/thesis/tex/docmacros.sty index 433fe19..0005e76 100644 --- a/doc/thesis/tex/docmacros.sty +++ b/doc/thesis/tex/docmacros.sty @@ -1,6 +1,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{tex/docmacros}[2021/09/27 v0.1 Document Macros] +\RequirePackage{mathtools} \RequirePackage{amsmath} \RequirePackage{bm} -- cgit v1.2.1