Page MenuHomec4science

2_relationships.tex
No OneTemporary

File Metadata

Created
Thu, Mar 13, 08:12

2_relationships.tex

\documentclass[aspectratio=169]{beamer}
\def\stylepath{../../styles}
\usepackage{\stylepath/com303}
\begin{document}
\begin{frame}
\frametitle{Overview:}
\begin{itemize}
\item DFT, DFS, DTFT
\item DTFT of periodic sequences
\item DTFT of finite-support sequences
\item Zero padding
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Transforms}
\begin{itemize}[<+->]
\item DFT, DFS: change of basis in $\mathbb{C}^{N}$
\item DTFT: ``formal'' change of basis in $\ell_2(\mathbb{Z})$
\item basis vectors are ``building blocks'' for any signal
\vspace{1em}
\item DFT: numerical algorithm (computable)
\item DTFT: mathematical tool (proofs)
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Embedding finite-length signals}
\begin{itemize}[<+->]
\item $N$-tap signal $x[n]$
\item natural spectral representation: DFT $X[k]$
\item two ways to embed $x[n]$ into an infinite sequence:
\vspace{1ex}
\begin{itemize}
\item periodic extension:
$
\tilde{x}[n] = x[n \mod N]
$
\item finite-support extension:
$
\bar{x}[n] = \begin{cases} x[n] & 0 \leq n < N \\ 0 & \mbox{otherwise} \end{cases}
$
\end{itemize}
\item how does $X[k]$ relate to the DTFT of the embedded signals?
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{DTFT of periodic signals}
\note<1>{use the DFS reconstruction formula in the second passage.\\Over the $[-\pi, \pi]$ interval the DTFT of a periodic sequence\\ is a set of regularly spaced deltas at the $N$ roots of unity\\ whose amplitude is proportional to the DFS (DFT)\\ coefficients of the sequence.\\ In other words, \emph{the DTFT is uniquely determined by the DFS and vice versa}}
\[
\tilde{x}[n] = x[n \mod N]
\]
\begin{align*}
\tilde{X}(e^{j\omega}) &= \sum_{n=-\infty}^{\infty} \tilde{x}[n]e^{-j\omega n} \\ \pause
&= \sum_{n=-\infty}^{\infty} \left(\frac{1}{N} \sum_{k=0}^{N-1} \tilde{X}[k]e^{j\frac{2\pi}{N}n k} \right) e^{-j\omega n} \\ \pause
&= \frac{1}{N}\sum_{k=0}^{N-1} \tilde{X}[k] \left(\sum_{n=-\infty}^{\infty}e^{j\frac{2\pi}{N}n k}e^{-j\omega n} \right)
\end{align*}
\end{frame}
\begin{frame}
\frametitle{We've seen this before}
\begin{align*}
\sum_{n=-\infty}^{\infty}e^{j\frac{2\pi}{N}n k}e^{-j\omega n} &= \DTFT{e^{j\frac{2\pi}{N}n k}} \\
&= \tilde{\delta}(\omega - \frac{2\pi}{N}k)
\end{align*}
\end{frame}
\begin{frame}
\frametitle{DTFT of periodic signals}
\[
\tilde{X}(e^{j\omega}) = \frac{1}{N} \sum_{k=0}^{N-1}X[k] \tilde{\delta}(\omega - \frac{2\pi}{N}k)
\]
\end{frame}
%% x[n] = 2n/(N-1) - 1
\def\sawTD{ 3200 add cvi 32 mod 2 mul 32 1 sub div 1 sub }
%% X[k] = 0 if k=0, (N/N-1)(-1 + jcot(pi/N)k
\def\sawFM{ dup 0 eq {pop 0} {180 32 div mul dup cos exch sin div dup mul 1 add sqrt 32 32 1 sub div mul} ifelse }
\def\sawFMSV#1{#1 dup 0 eq {pop 0} {180 32 div mul dup cos exch sin div dup mul 1 add sqrt 32 32 1 sub div mul} ifelse }
\begin{frame}
\frametitle{32-tap sawtooth}
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=16]{0,31}{-1.2, 1.2}
\moocStyle
\dspSignal{x \sawTD}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{DFT of 32-tap sawtooth}
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=16,yticks=5]{0,31}{0, 16}
\moocStyle
\dspSignal{x \sawFM}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{32-periodic sawtooth}
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=32,xout=true]{-100,100}{-1.2, 1.2}
\moocStyle
\dspSignal{x \sawTD}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{DTFT of periodic extension}
\begin{center}
\begin{figure}
\begin{dspPlot}[xtype=freq,yticks=none]{-1,1}{0, 16}
\moocStyle
% no Dirac in zero since it's zero and the arrow would be funny-looking
% \dspDiracs{0 \sawFMSV{0}}
\multido{\n=1+1}{16}{
\FPupn\f{16 \n{} / 3 trunc}
\FPupn\g{-16 \n{} / 3 trunc}
\dspDiracs{{\f} \sawFMSV{\n}}
\dspDiracs{{\g} \sawFMSV{\n}}}
\dspCustomTicks[axis=x]{0.0625 {\pnode{a}}}
\dspText(0.3,-4){\rnode{b}{~~$\omega=\frac{2\pi}{N}$}}
\nccurve[linewidth=0.2pt,angleA=180,angleB=-90]{->}{b}{a}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{DTFT of finite-support signals}
\[
\bar{x}[n] = \begin{cases} x[n] & 0 \leq n < N \\ 0 & \mbox{otherwise} \end{cases}
\]
\begin{align*}
\bar{X}(e^{j\omega}) &= \sum_{n=-\infty}^{\infty} \bar{x}[n]e^{-j\omega n} = \sum_{n=0}^{N-1} x[n]e^{-j\omega n} \\ \pause
&= \sum_{n=0}^{N-1} \left(\frac{1}{N} \sum_{k=0}^{N-1} X[k]e^{j\frac{2\pi}{N}n k} \right) e^{-j\omega n} \\ \pause
&= \frac{1}{N} \sum_{k=0}^{N-1} X[k] \left(\sum_{n=0}^{N-1}e^{-j(\omega - \frac{2\pi}{N}k)n} \right)
\end{align*}
\end{frame}
\begin{frame}
\frametitle{DTFT of finite-support signals}
\centering
\[
\sum_{n=0}^{N-1}e^{-j(\omega - \frac{2\pi}{N}k)n} = \bar{R}(e^{j(\omega - \frac{2\pi}{N}k)})
\]
% where $R(e^{j\omega})$ is the DTFT of ${r}[n]$, the interval indicator signal:
where $\bar{R}(e^{j\omega})$ is the DTFT of $\bar{r}[n]$, the rectangular signal:
\[
\bar{r}[n] = \begin{cases} 1 & 0 \leq n < N \\ 0 & \mbox{otherwise} \end{cases}
\]
\end{frame}
\begin{frame}
\frametitle{Rectangular step signal}
\[
\bar{r}[n] = \begin{cases} 1 & 0 \leq n < N \\ 0 & \mbox{otherwise} \end{cases}
\]
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=custom]{-20,20}{-.5, 1.2}
\moocStyle
\dspSignal{x 0 lt {0} {x 9 gt {0} {1} ifelse} ifelse}
\dspCustomTicks[axis=x]{0 0 9 $N-1$}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{DTFT of rectangular step signal}
\begin{align*}
\bar{R}(e^{j\omega}) &= \sum_{n=0}^{N-1}e^{-j\omega n} \\ \pause
&= \frac{1 - e^{-j\omega N}}{1 - e^{-j\omega}} \\ \pause
% collect half the frequency in front on num and den
&= \frac{e^{-j\frac{\omega N}{2}} \left[ e^{j\frac{\omega N}{2}} - e^{-j\frac{\omega N}{2}} \right]}%
{e^{-j\frac{\omega}{2}} \left[ e^{j\frac{\omega}{2}} - e^{-j\frac{\omega}{2}} \right]} \\ \pause
&= \frac{\sin \left( \frac{\omega}{2}N \right)}{\sin \left( \frac{\omega}{2} \right) }e^{-j\frac{\omega}{2}(N-1)}
\end{align*}
\end{frame}
\def\sinInt#1#2{ #1 #2 div 2 mul sub 90 mul dup 0 eq { pop 1} {dup #2 mul sin exch dup #1 1 sub mul cos exch sin div mul #2 div} ifelse }
\begin{frame}
\frametitle{DTFT of interval signal $(N=9)$}
\begin{figure}
\begin{dspPlot}[xtype=freq,yticks=none,ylabel={$\Re\{R(e^{j\omega})\}$}]{-1,1}{-.5, 1.2}
\moocStyle
\dspFunc{x \sinInt{0}{9} }
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{DTFT of finite-support signals}
\centering
define $\Lambda(\omega) = \frac{1}{N}\bar{R}(e^{j\omega})$
\[
\bar{X}(e^{j\omega}) = \sum_{k=0}^{N-1} X[k] \Lambda(\omega - \frac{2\pi}{N}k)
\]
smooth interpolation of DFT values
\end{frame}
\begin{frame}
\frametitle{32-tap sawtooth}
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=16]{0,31}{-1.2, 1.2}
\moocStyle
\dspSignal{x \sawTD}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{DFT of 32-tap sawtooth}
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=16,yticks=5]{0,31}{0, 16}
\moocStyle
\dspSignal{x \sawFM}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Sawtooth: finite support extension}
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=32,xout=true]{-100,100}{-1.2, 1.2}
\moocStyle
\dspSignal{x 0 lt {0} {x 32 ge {0} {x \sawTD} ifelse} ifelse }
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\def\tComp#1#2{\only<#1->{\dspFunc[linewidth=0.5pt,linecolor=blue!50]{x \sinInt{#2}{32} \sawFMSV{#2} mul}}}
\begin{frame}
\frametitle{DTFT of finite support extension (sketch)}
\begin{center}
\begin{figure}
\begin{dspPlot}[xtype=freq,yticks=none]{-1,1}{0, 16}
\moocStyle
\multido{\n=0+1}{16}{
\FPupn\f{16 \n{} / 3 trunc}
\FPupn\g{-16 \n{} / 3 trunc}
\dspTaps[linecolor=lightgray]{{\f} \sawFMSV{\n}}
\dspTaps[linecolor=lightgray]{{\g} \sawFMSV{\n}}}
\tComp{2}{1}
\tComp{3}{2}
\tComp{4}{3}
\tComp{5}{4}
\tComp{6}{5}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
%% magnitude:
%% r(\omega) = (N-1)*cos((N+1)*w) - (N+1)*cos(N*w) + (N+1)*cos(w) -(N-1);
%% i(\omega) = -(N-1)*sin((N+1)*w) + (N+1)*sin(N*w) - (N+1)*sin(w);
%% m(\omega) = 1/(N-1) * (1/4)(1+cot^2(w/2)) * sqrt(r*r + i*i)
\def\N{32.0 }
\def\magX{ /w exch 180 mul def %
/r \N 1 sub \N 1 add w mul cos mul
\N 1 add \N w mul cos -1 mul mul
\N 1 add w cos mul
\N 1 sub -1 mul
add add add
def
/i \N 1 sub \N 1 add w mul sin -1 mul mul
\N 1 add \N w mul sin mul
\N 1 add w sin -1 mul mul
add add
def
w 2 div dup cos exch sin 0.000001 add div dup mul 1 add r r mul i i mul add sqrt mul 4 \N 1 sub mul div }
\begin{frame}
\frametitle{DTFT of finite support extension}
\note<1>{We saw this (and computed it in closed form)\\ in module 4.4!}
\begin{center}
\begin{figure}
\begin{dspPlot}[xtype=freq,yticks=none]{-1,1}{0, 16}
\moocStyle
\multido{\n=0+1}{16}{
\FPupn\f{16 \n{} / 3 trunc}
\FPupn\g{-16 \n{} / 3 trunc}
\dspTaps[linecolor=lightgray]{{\f} \sawFMSV{\n}}
\dspTaps[linecolor=lightgray]{{\g} \sawFMSV{\n}}}
\dspFunc{x \magX }
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{As a comparison...}
\begin{center}
\begin{figure}
\begin{dspPlot}[xtype=freq,yticks=none]{-1,1}{0, 16}
\moocStyle
\dspDiracs{0 \sawFMSV{0}}
\multido{\n=1+1}{16}{
\FPupn\f{16 \n{} / 3 trunc}
\FPupn\g{-16 \n{} / 3 trunc}
\dspDiracs[linecolor=black]{{\f} \sawFMSV{\n}}
\dspDiracs[linecolor=black]{{\g} \sawFMSV{\n}}}
\dspFunc{x \magX }
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{About zero-padding}
\centering
When computing the DFT numerically \\ one may ``pad'' the data vector with zeros to obtain ``nicer'' plots
\end{frame}
\begin{frame}
\frametitle{DFT of 32-tap sawtooth}
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=16,yticks=5]{0,31}{0, 16}
\moocStyle
\dspSignal{x 16 div \magX}
\end{dspPlot}
\end{figure}
$\mathbf{x} = [ x_0 \, x_1 \, \ldots \, x_{31} ]$
\end{center}
\end{frame}
\begin{frame}
\frametitle{DFT of 32-tap sawtooth, zero-padded to 96 points}
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=16,yticks=5]{0,95}{0, 16}
\moocStyle
\dspSignal{x 48 div \magX}
\end{dspPlot}
\end{figure}
$\mathbf{x} = [ x_0 \, x_1 \, \ldots \, x_{31} \, 0 \, \ldots \, 0 ]$
\end{center}
\end{frame}
%\begin{frame}
% \frametitle{DFT of 32-tap sawtooth, zero-padded}
% \begin{center}
% \begin{figure}
% \begin{dspPlot}[xticks=16,yticks=5]{0,191}{0, 16}
% \moocStyle
% \dspSignal{x 96 div \magX}
% \end{dspPlot}
% \end{figure}
% $\mathbf{x} = [ x_0 \, x_1 \, \ldots \, x_{31} \, 0 \, \ldots \, 0 ]$
% \end{center}
%\end{frame}
\begin{frame}
\frametitle{About zero-padding}
\[
x_M[n] = \begin{cases}
x[n] & \mbox{for $0 \leq n < N$} \\
0 & \mbox{for $N \leq n < M$}
\end{cases}
\]
\end{frame}
\begin{frame}
\frametitle{About zero-padding}
\begin{align*}
X_M[h] &= \sum_{n=0}^{M-1} x'[n]e^{-j\frac{2\pi}{M}nh} = \sum_{n=0}^{N-1} x[n]e^{-j\frac{2\pi}{M}nh} \\ \pause
&= \sum_{n=0}^{N-1} \left(\frac{1}{N} \sum_{k=0}^{N-1} X[k]e^{j\frac{2\pi}{N}nk} \right) e^{-j\frac{2\pi}{M}nh} \\ \pause
&= \frac{1}{N} \sum_{k=0}^{N-1} X[k] \left(\sum_{n=0}^{N-1}e^{-j(\frac{2\pi}{M}h - \frac{2\pi}{N}k)n} \right) \\ \pause
& = \bar{X}(e^{j\omega})|_{\omega = \frac{2\pi}{M}h}
\end{align*}
\end{frame}
\begin{frame}
\frametitle{About zero-padding}
\begin{itemize}
\item zero padding does not add information
\item a zero-padded DFT is simply a sampled DTFT of the finite-support extension
\end{itemize}
\end{frame}
\def\zps#1{%
\begin{frame}
\frametitle{DFT of 32-tap sawtooth, zero-padded}
\begin{center}
\FPupn\dN{#1 2 * 0 trunc}
\dN-point DFT
\begin{figure}
\begin{dspPlot}[xticks=custom,yticks=5,sidegap=0]{0,#1}{0, 16}
\moocStyle
\dspSignal{x #1 div \magX}
\only<1>{\dspCustomTicks[axis=x]{0 0 #1 #1}}
\only<2->{
\dspFunc[linecolor=blue!50]{x #1 div \magX}
\dspCustomTicks[axis=x]{0 0 #1 $\pi$}}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}}
\zps{16}
\zps{48}
\zps{100}
\end{document}

Event Timeline