Page MenuHomec4science

2_aliasing.tex
No OneTemporary

File Metadata

Created
Thu, Mar 13, 13:57

2_aliasing.tex

\documentclass[aspectratio=169]{beamer}
\def\stylepath{../styles}
\usepackage{\stylepath/com303}
\begin{document}
\begin{frame} \frametitle{Raw-sampling an arbitrary signal}
%\note<1>{we're using the subscript ``c'' for\\ continuous-time entities to make \\ derivations easier to follow}
\begin{figure}[t]
\center %\small
\begin{dspBlocks}{1}{0.1}
\only<1>{\makebox[10em][r]{$x_c(t)$}}\only<2>{\makebox[10em][r]{$X_c(f)$}}~~
&
\BDsampler
& ~~\only<1>{\makebox[10em][l]{$x[n] = x_c(nT_s)$}}\only<2>{\makebox[10em][l]{$X(e^{j\omega}) = ?$}}
\\
& $T_s$ &
\psset{linewidth=1.5pt}
\ncline{-}{1,1}{1,2}
\ncline{->}{1,2}{1,3}
\end{dspBlocks}
\end{figure}
\end{frame}
\begin{frame} \frametitle{Key idea}
\begin{itemize}
\item pick $T_s$ (and set $F_s = 1/T_s$)
\item pick $f_0 < F_s/2$
\end{itemize}
\vspace{2em}
\centering
\begin{figure}
\begin{dspBlocks}{1}{0.1}
\only<1>{\makebox[10em][r]{$e^{j2\pi f_0 t}$}}
\only<2-5>{\makebox[10em][r]{$e^{j2\pi (f_0 + F_s) t}$}}
\only<6>{\makebox[10em][r]{$Ae^{j2\pi f_0 t} + Be^{j2\pi (f_0 + F_s) t}$}}
~~
&
\BDsampler
&
~~
\only<1>{\makebox[10em][l]{$e^{j2\pi f_0 T_s n}$}}%
\only<2>{\makebox[10em][l]{$e^{j2\pi (f_0 + F_s) T_s n}$}}%
\only<3>{\makebox[10em][l]{$e^{j(2\pi f_0 T_s n +2\pi F_s T_s n)}$}}%
\only<4>{\makebox[10em][l]{$e^{j(2\pi f_0 T_s n +2\pi n)}$}}%
\only<5>{\makebox[10em][l]{$e^{j 2\pi f_0 T_s n}$}}%
\only<6>{\makebox[10em][l]{$(A+B)e^{j 2\pi f_0 T_s n}$}}%
\\
& $T_s$ &
\psset{linewidth=1.5pt}
\ncline{-}{1,1}{1,2}
\ncline{->}{1,2}{1,3}
\end{dspBlocks}
\end{figure}
\end{frame}
\begin{frame} \frametitle{Spectrum of raw-sampled signals}
outline: start with the inverse Fourier Transform
\[
x[n] = x_c(nT_s) = \int_{-\infty}^{\infty} X_c(f)e^{j2\pi f \, T_s n} df
\]
and manipulate the integral until it looks like
\[
x[n] = \frac{1}{2\pi}\int_{-\pi}^{\pi} f(\omega)e^{j\omega n}d\omega
\]
\end{frame}
\begin{frame} \frametitle{Spectrum of raw-sampled signals}
frequencies $F_s$ Hz apart will be aliased, so split the integration interval
\vspace{2em}
\begin{align*}
x[n] &= \int_{-\infty}^{\infty} X_c(f)e^{j2\pi f \,T_s n} df \\
&= \sum_{k = -\infty}^{\infty} \int_{kF_s - \frac{F_s}{2}}^{kF_s + \frac{F_s}{2}} X_c(f)e^{j2\pi f\, T_s n} df
\end{align*}
\end{frame}
\def\conn#1#2#3#4#5{%
\only<#1->{\psbezier[#2]{->}(#3,0)(#3,#5)(#4,#5)(#4,0)}}
\begin{frame} \frametitle{Spectrum of raw-sampled signals}
\begin{figure}
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=custom,yticks=none,ylabel={$X_c(f)$}]{-5,5}{0,1.2}
\moocStyle
\dspCustomTicks[axis=x]{%
0 0
1 $F_s/2$ -1 $-F_s/2$
2 $F_s$ -2 $-F_s$
3 $3F_s/2$ -3 $-3F_s/2$
4 $2F_s$ -4 $-2F_s$}
\psset{linewidth=0.5pt}
\conn{2}{}{2}{0}{0.5}
\conn{3}{}{2.2}{0.2}{0.6}
\conn{4}{}{1.8}{-0.2}{0.4}
\conn{5}{}{-2}{0}{0.5}
\conn{5}{}{-2.2}{-0.2}{0.6}
\conn{5}{}{-1.8}{0.2}{0.4}
\conn{6}{}{4}{0}{0.5}
\conn{6}{}{4.2}{0.2}{0.6}
\conn{6}{}{3.8}{-0.2}{0.4}
\conn{6}{}{-4}{0}{0.5}
\conn{6}{}{-4.2}{-0.2}{0.6}
\conn{6}{}{-3.8}{0.2}{0.4}
\end{dspPlot}
\end{figure}
\end{frame}
%\end{document}
\begin{frame} \frametitle{Spectrum of raw-sampled signals}
\[
x[n] = \sum_{k = -\infty}^{\infty} \int_{kF_s - \frac{F_s}{2}}^{kF_s + \frac{F_s}{2}} X_c(f)e^{j2\pi f\, T_s n} df
\]
\vspace{2em}
operate the change of variable $f \rightarrow f + kF_s$:
\begin{itemize}
\item integration limits become $\pm F_s/2$
\item $e^{j2\pi(f - kF_s)T_s n} = e^{j2\pi f\, T_s n}$
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Spectrum of raw-sampled signals}
\begin{align*}
x[n] &= \sum_{k = -\infty}^{\infty} \int_{kF_s - \frac{F_s}{2}}^{kF_s + \frac{F_s}{2}} X_c(f)e^{j2\pi f\, T_s n} df \\ \\
&= \sum_{k = -\infty}^{\infty} \int_{-F_s/2}^{F_s/2} X_c(f - kF_s)e^{j2\pi f\, T_s n} df \\ \\
&= \int_{-F_s/2}^{F_s/2} \left[\sum_{k = -\infty}^{\infty} X_c(f - kF_s)\right] e^{j2\pi f\, T_s n} df
\end{align*}
\end{frame}
\begin{frame} \frametitle{Spectrum of raw-sampled signals}
$F_s$-periodization of the spectrum; define:
\vspace{1em}
\[
\tilde{X}_c(f) = \sum_{k = -\infty}^{\infty} X_c(f - kF_s)
\]
then:
\[
x[n] = \int_{-F_s/2}^{F_s/2} \tilde{X}_c(f) e^{j2\pi f\, T_s n} df
\]
\end{frame}
\begin{frame} \frametitle{Spectrum of raw-sampled signals}
set $\omega = 2\pi f\, T_s$, so that $f = \frac{\omega}{2\pi}F_s$
\begin{align*}
x[n] &= \frac{1}{2\pi} \int_{-\pi}^{\pi} F_s\, \tilde{X}_c\left(\frac{\omega}{2\pi}F_s\right)e^{j\omega n} d\omega \\
&= \IDTFT{F_s \tilde{X}_c\left(\frac{\omega}{2\pi}F_s\right)}
\end{align*}
\vspace{3em}
\[
X(e^{j\omega}) = F_s \tilde{X}_c\left(\frac{\omega}{2\pi}F_s\right) = F_s \sum_{k = -\infty}^{\infty} X_c\left(\frac{\omega}{2\pi}F_s - kF_s \right)
\]
\end{frame}
%% create a slide with aliasing denouement
%% \BLcase{frame title}{spectral shape}{Omega_N}
%%
\def\BLcase#1#2#3{%
%% spectral shape function takes 2 args: center and width; this defines a centered version
\def\spec##1{%
#2{##1}{#3}}
%% periodized version
\def\perd{%
0
-6 2 11 {
/i exch def
x \spec{i}
add
} for}
\begin{frame}
\frametitle{#1}
\setbeamercovered{invisible}
\begin{center}
\begin{figure}
% original spectrum
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=none,yticks=none,ylabel={$X_c(f)$}]{-5,5}{0,1.2}
\moocStyle
\dspFunc{x \spec{0}}
\dspCustomTicks[axis=x]{0 0 1 $F_s/2$ -1 $-F_s/2$}
\end{dspPlot}
% periodized spectrum, in two steps
\uncover<2->{
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=custom,yticks=none,ylabel={$\tilde{X_c}(f)$}]{-5,5}{0,1.2}
\moocStyle
\dspCustomTicks[axis=x]{%
0 0 1 $F_s/2$ -1 $-F_s/2$ 2 $F_s$ -2 $-F_s$ 4 $2F_s$ -4 $-2F_s$}
% first step, copies every 2, dashed
\only<2>{%
\multido{\n=-6+2}{11}{%
\dspFunc[linecolor=red!30,linestyle=dashed]{x \spec{\n}}}}
% second step, sum of copies
\only<3->{\dspFunc[linecolor=red!30]{\perd}}
% on next slide, show main period
\only<4->{%
\dspFunc[xmin=-1,xmax=1,linecolor=blue!40]{\perd}
\pnode(-1,0){A}\pnode(1,0){B}}
\end{dspPlot}}
\uncover<4->{
\begin{dspPlot}[xtype=freq,height=1.4cm,xticks=3,yticks=none,ylabel={$X(e^{j\omega})$}]{-1,1}{0,1.2}
\moocStyle
\dspFunc[linecolor=blue!80]{\perd}
\pnode(-1,1.2){a}\pnode(1,1.2){b}
\ncline[linewidth=1pt,linecolor=blue!40,linestyle=dashed]{->}{A}{a}
\ncline[linewidth=1pt,linecolor=blue!40,linestyle=dashed]{->}{B}{b}
\end{dspPlot}}
\end{figure}
\end{center}
\end{frame}}
\BLcase{Example: signal bandlimited to $f_0$ and $F_s > 2f_0$}{\dspQuad}{0.666 }
\BLcase{Example: signal bandlimited to $f_0$ and $F_s = 2f_0$}{\dspQuad}{1 }
\BLcase{Example: signal bandlimited to $f_0$ and $F_s < 2f_0$}{\dspQuad}{1.5 }
\def\nbl#1#2{ #1 sub 4 mul abs dup mul 0.5 mul 1 add 1 exch div }
\BLcase{Example: non-bandlimited signal}{\nbl}{1}
\begin{frame} \frametitle{Sampling strategies}
given a sampling frequency $F_s$
\begin{itemize}[<+->]
\item if the signal is bandlimited to $F_s/2$ or less, raw sampling is fine (i.e. equivalent to sinc sampling up to a scaling factor $T_s$)
\item if the signal is not bandlimited, two choices:
\begin{itemize}
\item bandlimit via a lowpass filter {\em in the continuous-time domain} before sampling (i.e. sinc sampling)
\item or, raw sample the signal and incur aliasing
\end{itemize}
\item aliasing introduces errors we cannot control, so the sensible choice is to bandlimit in continuous time
\item bandlimiting is also optimal wrt least squares approximation!
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Sinc Sampling and Interpolation}
\setbeamercovered{invisible}
\begin{align*}
\hat{x}[n] &= {\langle \sinc\left(\frac{t-nT_s}{T_s}\right), x_c(t) \rangle} \ = \
{(\sinc_{T_s} \ast\, x_c )(nT_s)} \\ \pause
\hat{x_c}(t) &= \sum_n x[n] \sinc\left(\frac{t-nT_s}{T_s}\right)
\end{align*}
\uncover<3->{
\begin{figure}[t]
\center %\small
\begin{dspBlocks}{1}{0.4}
$x_c(t)$~ & \BDlowpass & \BDsamplerFramed & \BDsinc & $\hat{x_c}(t)$ \\
& $F_s/2$ & $T_s$ & $T_s$
\psset{linewidth=1.5pt}
\ncline{->}{1,1}{1,2}\ncline{->}{1,2}{1,3}
\ncline{->}{1,3}{1,4}\ncline{->}{1,4}{1,5}
\end{dspBlocks}
\end{figure}}
\end{frame}
\begin{frame} \frametitle{Least squares approximation with sinc sampling and interpolation}
\begin{center}
\psset{unit=10mm}
\begin{pspicture}(-1,0)(8,6)
{
\only<2->{\psset{linecolor=lightgray}}
\psline{->}(5,4)\rput[bl]{0}(5,4){~$\mathbf{x}$}
\psline{->}(10,2)\rput[tl]{0}(10,2){~$\mathbf{BL}$}
}
\only<3->{
\psline[linecolor=blue]{->}(3.9223, 0.7844)
\rput[tl]{0}(3.9223, 0.7844){\color{blue}~$\{ \mathbf{sinc}_n \}$}}
\only<4>{
\psline[linecolor=gray,linestyle=dashed](5.57,1.11)(5,4)}
\only<4>{
\psline[linecolor=red!50]{->}(5.57,1.11)
\rput[tl]{0}(5.57,1.11){\color{red!50}$\ \ \hat{x} = \sum_n\langle \mathbf{sinc}_n, \mathbf{x} \rangle \mathbf{sinc}_n$}}
\end{pspicture}
\end{center}
\end{frame}
\def\nbl#1{#1 sub 4 mul abs dup mul 0.5 mul 1 add 1 exch div }
\def\nblb#1{#1 sub dup abs 1 gt {pop 0} { 4 mul abs dup mul 0.5 mul 1 add 1 exch div} ifelse }
%% periodized version
\def\perd{%
0
-6 2 11 {
/i exch def
x \nblb{i}
add
} for}
\begin{frame} \frametitle{Least squares approximation with sinc sampling and interpolation}
\setbeamercovered{invisible}
\begin{center}
\begin{figure}
% original spectrum
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=none,yticks=none,ylabel={$X_c(f)$}]{-5,5}{0,1.2}
\moocStyle
\only<1-2>{\dspFunc{x \nbl{0}}}
\only<2-3>{\dspFunc[linecolor=green!70]{x \dspRect{0}{2}}}
\only<3->{\dspFunc{x \nblb{0}}}
\dspCustomTicks[axis=x]{0 0 1 $F_s/2$ -1 $-F_s/2$}
\end{dspPlot}
% periodized spectrum, in two steps
\uncover<4->{
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=custom,yticks=none,ylabel={$\tilde{X_c}(f)$}]{-5,5}{0,1.2}
\moocStyle
\dspCustomTicks[axis=x]{%
0 0 1 $F_s/2$ -1 $-F_s/2$ 2 $F_s$ -2 $-F_s$ 4 $2F_s$ -4 $-2F_s$}
% first step, copies every 2, dashed
\only<4>{%
\multido{\n=-6+2}{11}{%
\dspFunc[linecolor=red!30,linestyle=dashed]{x \nblb{\n}}}}
% second step, sum of copies
\only<5->{\dspFunc[linecolor=red!30]{\perd}}
% on next slide, show main period
\only<6->{%
\dspFunc[xmin=-1,xmax=1,linecolor=blue!40]{\perd}
\pnode(-1,0){A}\pnode(1,0){B}}
\end{dspPlot}}
\uncover<6->{
\begin{dspPlot}[xtype=freq,height=1.4cm,xticks=3,yticks=none,ylabel={$X(e^{j\omega})$}]{-1,1}{0,1.2}
\moocStyle
\dspFunc[linecolor=blue!80]{\perd}
\pnode(-1,1.2){a}\pnode(1,1.2){b}
\ncline[linewidth=1pt,linecolor=blue!40,linestyle=dashed]{->}{A}{a}
\ncline[linewidth=1pt,linecolor=blue!40,linestyle=dashed]{->}{B}{b}
\end{dspPlot}}
\end{figure}
\end{center}
\end{frame}
\begin{frame} \frametitle{Least squares approximation with sinc sampling and interpolation}
\setbeamercovered{invisible}
\begin{center}
\begin{figure}
% original spectrum
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=none,yticks=none,ylabel={$X_c(f)$}]{-5,5}{0,1.2}
\moocStyle
\dspFunc{x \nblb{0}}
\dspCustomTicks[axis=x]{0 0 1 $F_s/2$ -1 $-F_s/2$}
\end{dspPlot}
\begin{dspPlot}[xtype=freq,height=1.4cm,xticks=3,yticks=none,ylabel={$X(e^{j\omega})$}]{-1,1}{0,1.2}
\moocStyle
\dspFunc[linecolor=blue!80]{\perd}
\end{dspPlot}
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=custom,yticks=none,ylabel={$\hat{X}_c(f)$}]{-5,5}{0,1.2}
\moocStyle
\dspFunc{x \nblb{0}}
\dspCustomTicks[axis=x]{0 0 1 $F_s/2$ -1 $-F_s/2$}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame} \frametitle{Sinc Sampling and Interpolation}
\setbeamercovered{invisible}
\begin{align*}
\hat{x}[n] &= {\langle \sinc\left(\frac{t-nT_s}{T_s}\right), x_c(t) \rangle} \ = \
{(\sinc_{T_s} \ast\, x_c )(nT_s)} \\ \\
X(e^{j\omega}) &= X_c\left( \frac{\omega}{2\pi}F_s \right) \quad \mbox{prolonged by periodicity outside of $[-\pi, \pi]$}
\end{align*}
\vspace{2em}
Alternatively:
\[
X(e^{j\omega}) = X_c\left( \left(\frac{\omega}{\pi} - 2\left\lfloor \frac{\omega - \pi}{2\pi}\right\rfloor - 2 \right)F_s \right)
\]
\end{frame}
\end{document}

Event Timeline