% vim: fdm=marker fmr=<<<,>>>
\documentclass[../thesis.tex]{subfiles}

\graphicspath{
	{.}
	{../../figures/}
	{../../../figures/}
}

\begin{document}
\chapter{Measuring with Radio Antennas}
\label{sec:waveform}
Electric fields,
Antenna Polarizations,
Frequency Bandwidth,
\\

Time Domain,
Sampling,
Waveform + Time vector,
\\

Analysis:
Fourier Transforms,
Correlation

\hrule

Radio antennas are sensitive to changes in their surrounding electric fields.
Depending on the antenna geometry, multiple polarisations of the electric field can be recorded simultaneously.
\\

Recording 



\section{Analysis Methods}% <<<
\label{sec:waveform:analysis}

\subsection{Correlation}% <<<<
\label{sec:correlation}
\Todo{intro}
The correlation is a measure of how similar two signals $u(t)$ and $v(t)$ are as a function of a time delay $\tau$.

It is defined as
\begin{equation}
	\label{eq:correlation_cont}
	\phantom{,}
	\Corr(\tau; u,v) = \int_{-\infty}^{\infty} \dif t \, u(t)\, v^*(t-\tau)
	,
\end{equation}
where the integral reduces to a sum for a finite amount of samples in either $u(t)$ or $v(t)$.
Still, $\tau$ remains a continuous variable.

\begin{figure}
	\begin{subfigure}{\textwidth}
		\includegraphics[width=\textwidth]{pulse/waveform_12_correlation.pdf}
		\caption{
			Correlation
		}%
		\label{subfig:correlation}
	\end{subfigure}%
	\\
	\begin{subfigure}{0.45\textwidth}
		\includegraphics[width=\textwidth]{pulse/waveform_1.pdf}
		\caption{
			Waveform 1
		}
		\label{}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.45\textwidth}
		\includegraphics[width=\textwidth]{pulse/waveform_2.pdf}
		\caption{
			Waveform 2
		}
		\label{}
	\end{subfigure}
	\caption{
		Top: Correlation of Waveform 1 and Waveform 2
	}
	\label{fig:correlation}
\end{figure}

% >>>
\subsection{Fourier Transform}% <<<<
\label{sec:fourier}
\Todo{intro}

% DTFT from CTFT
The continuous formulation of the \acrlong{FT} takes the following form,
\begin{equation}
	\label{eq:fourier}
	\phantom{.}
	X(f) = \int_\infty^\infty \dif{t}\, x(t)\, e^{-i 2 \pi f t}
	.
\end{equation}
It decomposes the signal $x(t)$ into complex-valued plane waves $X(f)$ of frequency $f$.

When $x(t)$ is sampled at discrete times, the integral of \eqref{eq:fourier} is discretized in time to result in the \acrlong{DTFT}:
\begin{equation}
	%\tag{DTFT}
	\label{eq:fourier:dtft}
	X(f) = \sum_{n=0}^{N-1}   x(t[n])\, e^{ -i 2 \pi f t[n]}
\end{equation}
where $x(t) \in \mathcal{R} $ is sampled at times $t[n]$.
Considering a finite sampling size $N$ and periodicity of the signal, the bounds of the integral in \eqref{eq:fourier} collapse to $t[0]$ up to $t[N]$.
\\
From this it follows that the lowest resolvable frequency is $f_\mathrm{lower} = \tfrac{1}{T} = \tfrac{1}{t[N] - t[0]}$.
\\
Additionally, when the sampling of $x(t)$ is equally spaced, the $t[n]$ terms can be written as a sequence, $t[n] - t[0] = n \Delta t = \tfrac{n}{f_s}$, with $f_s$ the sampling frequency.
The highest resolvable frequency, known as the Nyquist frequency, is limited by this sampling frequency as $f_\mathrm{nyquist} = \tfrac{f_s}{2}$.
\\

% DFT sampling of DTFT / efficient multifrequency FFT
Implementing the above decomposition of $t[n]$, \eqref{eq:fourier:dtft} can be rewritten in terms of multiples $k$ of the sampling frequency, becoming the \acrlong{DFT}
\begin{equation*}
	\label{eq:fourier:dft}
	\phantom{,}
	X(k) = \sum_{n=0}^{N-1}   x[n]\, \cdot e^{ -i 2 \pi {\frac{k n}N} }
	,
\end{equation*}
with $k = \tfrac{f}{f_s}$.
For integer $0 \leq k < N $, efficient algorithms exist that derive all $X( 0 \leq k < N )$ in $\mathcal{O}( N \log N )$ calculations, a~\acrlong{FFT}, sampling a subset of the frequencies.\Todo{citation?}


\begin{figure}
	\includegraphics[width=\textwidth]{fourier/dtft_dft_comparison.pdf}
	\caption{
		Comparison of the \gls{DTFT} and \gls{DFT} of the same waveform.
		The \gls{DFT} can be interpreted as sampling the \gls{DTFT}
	}
	\label{fig:fourier:dtft_dft}
\end{figure}
\bigskip

% Linearity fourier for real/imag
In the previous equations, the resultant quantity $X(f)$ is a complex value.
Since a complex plane wave can be linearly decomposed as
\begin{equation*}
	\phantom{,}
	\label{eq:complex_wave_decomposition}
	\begin{aligned}
		e^{-i x}
		&
		= \cos(x) + i\sin(-x)
		%\\ &
		= \Re\left(e^{-i x}\right) + i \Im\left( e^{-i x} \right)
		,
	\end{aligned}
\end{equation*}
the above transforms can be decomposed into explicit real and imaginary parts aswell,
i.e.,~\eqref{eq:fourier:dtft} becomes
\begin{equation}
	\phantom{.}
	\label{eq:fourier:dtft_decomposed}
	\begin{aligned}
		X(f)
		&
		= X_R(f) + i X_I(f)
		%\\ &
		\equiv \Re(X(f)) + i \Im(X(f))
		\\ &
		=     \sum_{n=0}^{N-1} \, x[n] \, \cos( 2\pi f t[n] )
		  - i \sum_{n=0}^{N-1} \, x[n] \, \sin( 2\pi f t[n] )
		.
	\end{aligned}
\end{equation}

% FT term to phase and magnitude
The normalised amplitude at a given frequency $A(f)$ is calculated from \eqref{eq:fourier:dtft} as
\begin{equation}
	\label{eq:complex_magnitude}
	\phantom{.}
	A(f) \equiv \frac{ 2 \sqrt{ X_R(f)^2 + X_I(f)^2 } }{N}
	.
\end{equation}
Likewise, the complex phase at a given frequency $\pTrue(f)$ is obtained by
\begin{equation}
	\label{eq:complex_phase}
	\phantom{.}
	\pTrue(f) \equiv \arctantwo\left( X_I(f), X_R(f) \right)
	.
\end{equation}
Note the factor $2$ in the definition of the amplitude in \eqref{eq:complex_magnitude}.
It is introduced to compensate for expecting a real input signal $x(t)$ and mapping negative frequencies to their positive equivalents.
\\

% Recover A\cos(2\pi t[n] f + \phi) using above definitions
Applying \eqref{eq:fourier:dtft_decomposed} to a signal $x(t) = A\cos(2\pi t[n] f + \pTrue)$ with the above definitions obtains
an amplitude $A$ and phase $\pTrue$ at frequency $f$.
When the minus sign in the exponent of \eqref{eq:fourier} is not taken into account, the calculated phase in \eqref{eq:complex_phase} will have an extra minus sign.


% >>>>
\subsubsection{Hilbert Transform (optional)}% <<<<
% >>>>
% >>>
\end{document}
