Page MenuHomec4science

1_aliasingintro.tex
No OneTemporary

File Metadata

Created
Thu, Mar 13, 16:29

1_aliasingintro.tex

\documentclass[aspectratio=169]{beamer}
\def\stylepath{../styles}
\usepackage{\stylepath/com303}
\begin{document}
\begin{frame} \frametitle{Sinc Sampling}
\setbeamercovered{invisible}
\[
\vphantom{\sinc\left(\frac{t-nT_s}{T_s}\right) \rangle}
x[n] = \only<1>{\langle \sinc\left(\frac{t-nT_s}{T_s}\right), x(t) \rangle}
\only<2->{(\sinc_{T_s} \ast x )(nT_s)}
\]
\uncover<3->{
\begin{figure}[t]
\center
\begin{dspBlocks}{1}{0.4}
$x(t)$~ & \BDlowpass & &
\raisebox{-1.4em}{\psframebox[linewidth=1.5pt]{%
\psset{xunit=1em,yunit=1em,linewidth=1.8pt}%
\pspicture(-3,-1.8)(2,1.8)%
\psline(-2.8,0)(-1.6,0)(1.2,1.4)
\psline(1.1,0)(1.8,0)
\psarc[linewidth=1pt]{<-}(-1.6,0){2em}{-10}{55}
\endpspicture}}
& $x[n]$ \\
& $F_s$ & & $T_s$
\psset{linewidth=1.5pt}
\ncline{->}{1,1}{1,2}
\ncline{1,2}{1,4}%^{$x_{LP}(t)$}
\ncline{->}{1,4}{1,5}
\end{dspBlocks}
\end{figure}}
\end{frame}
\begin{frame} \frametitle{Sinc Sampling for $F_s$-BL signals}
\setbeamercovered{invisible}
\[
x[n] = (\sinc_{T_s} \ast x )(nT_s) = T_s\,x(nT_s)
\]
\vspace{1em}
\begin{figure}[t]
\center %\small
\begin{dspBlocks}{1}{0.4}
$x(t)$~ & & &
\raisebox{-1.4em}{\psframebox[linewidth=1.5pt]{%
\psset{xunit=1em,yunit=1em,linewidth=1.8pt}%
\pspicture(-3,-1.8)(2,1.8)%
\psline(-2.8,0)(-1.6,0)(1.2,1.4)
\psline(1.1,0)(1.8,0)
\psarc[linewidth=1pt]{<-}(-1.6,0){2em}{-10}{55}
\endpspicture}}
& $x[n]$ \\
& & & $T_s$
\psset{linewidth=1.5pt}
\ncline{->}{1,1}{1,4}
\ncline{->}{1,4}{1,5}
\end{dspBlocks}
\end{figure}
\end{frame}
\begin{frame} \frametitle{``Raw'' sampling - can we always do that?}
\[
x[n] = x(nT_s)
\]
\vspace{2em}
\begin{figure}[t]
\center %\small
\begin{dspBlocks}{1}{0.1}
$x(t)$~~ & \BDsampler & ~~$x[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{Remember the wagonwheel effect?}
\begin{center}
\movie[height=6.5cm,width=6.5cm,poster]{}{ww.avi}
\end{center}
\end{frame}
\begin{frame} \frametitle{The continuous-time complex exponential}
\[
x(t) = e^{j2\pi f_0 t}
\]
\vspace{1em}
\begin{itemize}[<+->]
\item always periodic, period $t_0 = 1/f_0$
\item all angular speeds are allowed
\item $\FT{e^{j2\pi f_0 t}} = \delta(f-f_0)$
\item highest (and only) frequency is $f_0$
\end{itemize}
\end{frame}
\begin{frame} \frametitle{The continuous-time complex exponential}
\begin{center}
\begin{figure}
\begin{dspPZPlot}[width=6cm,circle=0,xticks=none,yticks=none]{1.5}
\dspCPCircle[linewidth=0.5pt,linecolor=lightgray]{0,0}{1}
\dspCPArc[linewidth=1pt]{1}{0}{60}{}
\dspCPCirclePoint[linecolor=darkred,toorg=true]{1}{30}{$e^{j2\pi f_0 t}$}
\end{dspPZPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame} \frametitle{Raw samples of the continuous-time complex exponential}
\[
x[n] = e^{j2\pi f_0 n T_s}
\]
\vspace{1em}
\begin{itemize}[<+->]
\item raw samples are snapshots at regular intervals of the rotating point
\item resulting digital frequency is $\omega_0 = 2\pi f_0 T_s = 2\pi (f_0/F_s)$
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Easy: $f_0 < F_s/2 \quad \Rightarrow \quad \omega_0<\pi$}
\begin{center}
\begin{figure}
\def\a{35}\def\s{6}
\begin{dspPZPlot}[width=6cm,circle=0,xticks=none,yticks=none]{1.5}
\dspCPCircle[linewidth=0.5pt,linecolor=lightgray]{0,0}{1}
\multido{\n=0+1}{\s}{%
\FPupn\anp{\n{} \a{} * clip}%
\FPupn\ann{\anp{} \a{} + clip}%
\dspCPCirclePoint[linecolor=lightgray,toorg=true]{1}{\anp}{$x[\n]$}
\dspCPArc{0.6}{\anp}{\ann}{}}
\FPupn\anp{\s{} \a{} * clip}%
\FPupn\ann{\anp{} \a{} + clip}%
\dspCPCirclePoint[toorg=true,linecolor=darkred]{1}{\anp}{$x[\s]$}
\dspCPArc[linestyle=dashed,linecolor=gray]{0.6}{\anp}{\ann}{}
\end{dspPZPlot}
\end{figure}
\end{center}
\end{frame}
\def\ceStep#1{% define \a (freq) and \p (initial phase)
\FPupn\np{1 #1 - clip} \FPupn\anp{\np{} \a{} * \p{} + clip} \FPupn\anpp{\a{} \anp{} - clip}%
\only<#1->{\dspCPCirclePoint[linecolor=lightgray,toorg=true]{1}{\anpp}{}}
\only<#1>{\dspCPCirclePoint[linecolor=red,toorg=true]{1}{\anp}{$x[\np]$}
\dspCPArc{0.6}{\anpp}{\anp}{$\omega_0$}}}
\begin{frame} \frametitle{Tricky: $F_s/2 < f_0 < F_s \quad \Rightarrow \quad \pi < \omega_0 < 2\pi$}
\begin{center}
\begin{figure}
\begin{dspPZPlot}[width=6cm,circle=0,xticks=none,yticks=none]{1.5}
\dspCPCircle[linewidth=0.5pt,linecolor=lightgray]{0,0}{1}
\def\a{350}\def\p{0}\def\N{5}
\only<1>{\dspCPCirclePoint[linecolor=red,toorg=true]{1}{\p}{$x[0]$}}
\multido{\n=2+1}{\N}{\ceStep{\n}}
\FPupn\np{1 \N{} + clip}
\only<\np->{\FPupn\anp{\a{} 360 - \N{} * -1 * clip}
\dspCPArcn[linewidth=3pt,linecolor=red]{0.8}{0}{\anp}{}}
\end{dspPZPlot}
\end{figure}
\end{center}
\end{frame}
\def\ceStep#1{% define \a (freq) and \p (initial phase)
\FPupn\np{1 #1 - clip} \FPupn\anp{\np{} \a{} * \p{} + clip} \FPupn\anpp{\a{} \anp{} - clip }%
\def\psspace{ }
\only<#1->{\dspCPCirclePoint[linecolor=lightgray,toorg=true]{1}{\anpp}{}}
\only<#1>{\dspCPCirclePoint[linecolor=red,toorg=true]{1}{\anp}{$x[\np]$}
\parametricplot[linecolor=blue,linewidth=\dspTickLineWidth,arrows=->]%
{\anpp}{\anp}{t \anpp \psspace
sub 360 div 0.05 mul 0.5 add dup t cos mul exch t sin mul}}}
\begin{frame} \frametitle{Trouble: $f_0 > F_s \quad \Rightarrow \quad \omega_0 > 2\pi$}
\begin{center}
\begin{figure}
\begin{dspPZPlot}[width=6cm,circle=0,xticks=none,yticks=none]{1.5}
\dspCPCircle[linewidth=0.5pt,linecolor=lightgray]{0,0}{1}
\def\a{380}\def\p{0}\def\N{5}
\only<1>{\dspCPCirclePoint[linecolor=red,toorg=true]{1}{\p}{$x[0]$}}
\multido{\n=2+1}{\N}{\ceStep{\n}}
\FPupn\np{1 \N{} + clip}
\end{dspPZPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame} \frametitle{Aliasing}
\begin{figure}[t]
\center %\small
\begin{dspBlocks}{1.8}{0.1}
$x(t)$~~ & \BDsampler & \BDfilter{interp} & ~~$\hat{x}(t)=?$ \\
& $T_s$ & $T_s$
\psset{linewidth=1.5pt}
\ncline{-}{1,1}{1,2}
\ncline{->}{1,2}{1,3}^{$x[n]$}
\ncline{->}{1,3}{1,4}
\end{dspBlocks}
\end{figure}
\end{frame}
\begin{frame}\frametitle{Aliasing}
\centering
pick $T_s$; $F_s = 1/T_s$
\vspace{1em}
input: $x(t) = e^{j2\pi f_0 t}$
digital frequency: $\omega_0 = 2\pi f_0 / F_s$
\vspace{2em}
\begin{tabular}{lll}
& digital frequency & $\hat{x}(t)$ \\ \hline \\
{\color{green} $f_0 < F_s/2$} & $0 < \omega_0 < \pi$ & $e^{j2\pi f_0 t}$ \\
{\color{green} $f_0 = F_s/2$} & $\omega_0 = \pi$ & $e^{j2\pi f_0 t}$ \\
{\color{orange} $F_s/2 < f_0 < F_s$} & $\pi < \omega_0 < 2\pi$ & {\color{orange} $e^{j2\pi f_1 t}, \quad f_1 = f_0 - F_s < 0$}\\
{\color{red} $f_0 > F_s$} & $\omega_0 > 2\pi$ & {\color{red} $e^{j2\pi f_2 t}, \quad f_2 = f_0 \mod F_s$}
\end{tabular}
\end{frame}
%\begin{frame}\frametitle{Aliasing}
% \centering
% $x(t) = e^{j\Omega_0 t}$
%
% $\Omega_N = \pi/T_s$
% \vspace{2em}
%
% \begin{tabular}{lll}
% & digital frequency & $\hat{x}(t)$ \\ \hline \\
% {\color{green} $T_s < \pi/\Omega_0$} & $0 < \omega_0 < \pi$ & $e^{j\Omega_0 t}$ \\
% {\color{orange} $\pi/\Omega_0 < T_s < 2\pi/\Omega_0$} & $\pi < \omega_0 < 2\pi$ & {\color{orange} $e^{j\Omega_1 t}, \quad \Omega_1 = \Omega_0 - 2\pi/T_s$}\\
% {\color{red} $T_s > 2\pi/\Omega_0$} & $\omega_0 > 2\pi$ & {\color{red} $e^{j\Omega_2 t}, \quad \Omega_2 = \Omega_0 \mod (2\pi/T_s)$}
% \end{tabular}
%
%\end{frame}
%
%
%\begin{frame} \frametitle{Again, with a simple sinusoid and using Hertz}
% \begin{align*}
% x(t) &= \cos(2\pi F_0 t) \\
% x[n] &= x(nT_s) = \cos(\omega_0 n) \\ \\ \\
% F_s &= 1/T_s \\
% \omega_0 &= 2\pi (F_0/F_s) \\
% \end{align*}
%\end{frame}
\def\cfreq#1#2{\only<#1>{\dspDiracs{#2 1}}}
\def\start{4}
\def\steps{18}
\begin{frame}\frametitle{Aliasing of sinusoids: increasing the input frequency}
\setbeamercovered{invisible}
\begin{center}
\begin{figure}
% original spectrum
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=none,yticks=none,ylabel={$X(f)$}]{-5,5}{0,1.2}
\moocStyle
\multido{\n=\start+1}{\steps}{%
\FPupn\f{\start{} \n{} - 0.25 *}
\cfreq{\n}{\f}}
\dspCustomTicks[axis=x]{0 0 1 $F_s/2$ -1 $-F_s/2$ 2 $F_s$ -2 $-F_s$ 3 ~ -3 ~ 4 $2F_s$ -4 $-2F_s$}
\pnode(-1,0){A}\pnode(1,0){B}
\end{dspPlot}
\vspace{1ex}
\uncover<2->{
\begin{dspPlot}[xtype=freq,height=1.4cm,xticks=2,yticks=none,ylabel={$X(e^{j\omega})$}]{-1,1}{0,1.2}
\moocStyle
{\psset{linecolor=blue!80}
\multido{\n=\start+1}{\steps}{%
\FPupn\f{\start{} \n{} - 0.25 * 1 + copy -0.01 + 2 div 0 trunc 2 mul swap - 1 swap -}
\cfreq{\n}{\f}}}
\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}
\pnode(-1,0){c}\pnode(1,0){d}
\end{dspPlot}}
\uncover<3->{
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=none,yticks=none,ylabel={$\hat{X}(f)$}]{-5,5}{0,1.2}
\moocStyle
\multido{\n=\start+1}{\steps}{%
\FPupn\f{\start{} \n{} - 0.25 * 1 + copy -0.01 + 2 div 0 trunc 2 mul swap - 1 swap -}
\cfreq{\n}{\f}}
\dspCustomTicks[axis=x]{0 0 1 $F_s/2$ -1 $-F_s/2$}
\pnode(-1,1.2){C}\pnode(1,1.2){D}
\ncline[linewidth=1pt,linecolor=green!40,linestyle=dashed]{->}{c}{C}
\ncline[linewidth=1pt,linecolor=green!40,linestyle=dashed]{->}{d}{D}
\end{dspPlot}}
\end{figure}
\end{center}
\end{frame}
\def\interval#1#2{%
\only<#1>{%
\dspCustomTicks[axis=x]{0 0 #2 $F_s/2$ -#2 $-F_s/2$}
\pnode(-#2,0){A}\pnode(#2,0){B}}}
\def\start{2}
\begin{frame}\frametitle{Aliasing of sinusoids: decreasing the sampling frequency}
\setbeamercovered{invisible}
\begin{center}
\begin{figure}
% original spectrum
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=none,yticks=none,ylabel={$X(f)$}]{-5,5}{0,1.2}
\moocStyle
\dspDiracs{1 1}
\dspCustomTicks[axis=x]{1 $f_0$}
\interval{2}{2}
\interval{3}{1.2}
\interval{4}{1}
\interval{5}{0.8}
\interval{6}{0.5}
\interval{7}{0.4}
\end{dspPlot}
\vspace{1ex}
\begin{dspPlot}[xtype=freq,height=1.4cm,xticks=2,yticks=none,ylabel={$X(e^{j\omega})$}]{-1,1}{0,1.2}
\moocStyle
{\psset{linecolor=blue!80}
\cfreq{2}{0.5}
\cfreq{3}{0.8333}
\cfreq{4}{1}
\cfreq{5}{-0.8}
\cfreq{6}{0}
\cfreq{7}{0.5}}
\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}
\pnode(-1,0){c}\pnode(1,0){d}
\end{dspPlot}
\begin{dspPlot}[sidegap=0,height=1.4cm,xticks=none,yticks=none,ylabel={$\hat{X}(f)$}]{-5,5}{0,1.2}
\moocStyle
\interval{2}{2}\cfreq{2}{1}
\interval{3}{1.2}\cfreq{3}{1}
\interval{4}{1}\cfreq{4}{1}
\interval{5}{0.8}\cfreq{5}{-0.64}
\interval{6}{0.5}\cfreq{6}{0}
\interval{7}{0.4}\cfreq{7}{0.2}
\ncline[linewidth=1pt,linecolor=green!40,linestyle=dashed]{->}{c}{A}
\ncline[linewidth=1pt,linecolor=green!40,linestyle=dashed]{->}{d}{B}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame} \frametitle{Sampling a Sinusoid}
\centering
\begin{tabular}{lll}
sampling frequency & digital frequency & interpolation \\ \hline \\
{\color{green} $F_s > 2f_0$} & $0 < \omega_0 < \pi$ & OK: $\hat{f}_0 = f_0$ \\
{\color{green} $F_s = 2f_0$} & $\omega_0 = \pi$ & OK (max frequency $\hat{f}_0 = F_s$)\\
{\color{orange} $f_0 < F_s < 2f_0$} & $\pi < \omega_0 < 2\pi$ & negative frequency: $\hat{f}_0 = f_0 - F_s$\\
{\color{red} $F_s < f_0$} & $\omega_0 > 2\pi$ & full aliasing: $\hat{f}_0 = f_0 \mod F_s$
\end{tabular}
\end{frame}
\def\sampCos#1{%
\FPupn\ntaps{#1 \dspXmin{} \dspXmax{} - * 1 + 0 trunc}%
\FPupn\endx{\dspXmin{} #1 \ntaps{} -1 + / +}%
\psplot[plotstyle=dots,dotstyle=*,showpoints=true,%
dotstyle=*,dotsize=\dspDotSize,plotpoints=\ntaps,linecolor=darkred]%
{\dspXmin}{\endx}{x 3 mul 360 mul cos}}
\def\plotSC#1#2#3{%
\only<#1>{%
\begin{dspPlot}[sidegap=0,xout=true,xlabel={$F_s=#2$Hz}]{0,#3}{-1.2,1.2}%
\moocStyle%
\dspFunc[linecolor=blue!50]{x 3 mul 360 mul cos}%
\sampCos{#2}%
\end{dspPlot}}}
\begin{frame} \frametitle{Aliasing: Sampling a Sinusoid}
\note<1>{the aliased frequency in the end \\ is $F_0 \mod F_s = 0.1$Hz}
\centering
$x(t) = \cos(6\pi t) \qquad (f_0 = 3\mbox{Hz})$
\begin{figure}
\only<1>{
\begin{dspPlot}[sidegap=0,xout=true,xlabel={}]{0,1}{-1.2,1.2}
\moocStyle
\dspFunc[linecolor=blue!50]{x 3 mul 360 mul cos}
\end{dspPlot}}%
\plotSC{2}{100}{1}%
\plotSC{3}{50}{1}%
\plotSC{4}{10}{1}%
\plotSC{5}{6}{1}%
\plotSC{6}{2.9}{1}%
\plotSC{7}{2.9}{2}%
\plotSC{8}{2.9}{4}%
\plotSC{9}{2.9}{10}%
\end{figure}
\end{frame}
\end{document}

Event Timeline