Page MenuHomec4science

1_intro.tex
No OneTemporary

File Metadata

Created
Mon, Apr 28, 19:23

1_intro.tex

\documentclass[aspectratio=169]{beamer}
\def\stylepath{../styles}
\usepackage{\stylepath/com202}
\usepackage{pst-3dplot}
\begin{document}
\begin{frame} \frametitle{What is a signal}
\centering
quantitative description of a time-varying phenomenon
\end{frame}
\begin{frame} \frametitle{Continuous-time signals}
\centering
$x(t) \qquad x : \mathbb{R} \rightarrow \mathbb{R}$
\only<2>{
\vspace{2em}
\includegraphics[height=3cm]{rc.eps}
\vspace{0.5cm}
$v(t) = V_0(1-e^{-\frac{t}{RC}})$
}
\end{frame}
\def\tempFun{x 31 div 180 mul dup 1.1 mul cos 1 add 2 div exch 4 mul sin 0.1 mul add 10 mul x 4 div add}
\begin{frame} \frametitle{Discrete-time signals}
\centering
$x[n] \qquad x : \mathbb{Z} \rightarrow \mathbb{C}$
\only<2>{
\vspace{2em}
\begin{dspPlot}[yticks=5,xticks=none,sidegap=1,height=3cm]{1,31}{0,15}
\moocStyle
\psclip{\psframe[linewidth=0](0,0)(32,15)}
\psgrid[gridlabels=0,xunit=5,yunit=5](0,0)(0,0)(32, 16)
\psplot[showpoints=true, dotstyle=triangle*, plotstyle=dots, dotsize=\dspDotSize, plotpoints=31]{1}{31}{\tempFun}
\uput[180]{0}(2,14){$ ^{\circ}$C}
\endpsclip
\end{dspPlot}
\vspace{0.5cm}
$x[n] = \ldots\ 10.23,\ 10.73,\ 10.89,\ 11.17,\ 11.15,\ 10.86,\ \ldots$
}
\end{frame}
\begin{frame} \frametitle{The unifying framework}
\centering
all types of signals can be represented as vectors\\
in a suitable vector space
\end{frame}
\begin{frame} \frametitle{The unifying framework}
\begin{itemize}
\item space of continuous-time, finite-energy signals
\item space of continuous-time bandlimited signals
\item space of discrete-time signals of lenght $N$
\item space of discrete-time periodic signals of period $N$
\item etc.
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Why use vector spaces in SP?}
Math will be easier and signal properties will automatically apply to all signal spaces:
\begin{itemize}
\item we can select the ``easiest'' space to prove a result
\item the Fourier Transform will be super easy to understand
\item and so will the proof of the sampling theorem
\end{itemize}
\vspace{1em}
Vector space is the closest thing to an algorithmic framework for SP:
\begin{itemize}
\item most vectors can be thought of as simple arrays
\item approximation and compression algorithms are simple applications of linear algebra
\item low-dimensional intuition is super helpful
\end{itemize}
\end{frame}
\begin{frame} \frametitle{The three take-home lessons today}
\begin{itemize}
\item vector spaces are very general objects
\item vector spaces are defined by their properties
\item once you know the properties are satisfied, you can use all the tools for the space
\end{itemize}
\end{frame}
\begin{frame}[fragile=singleslide] \frametitle{Analogy \#1: OOP}
\begin{verbatim}
class Polygon:
def __init__(self, num_sides, side_len=1, x=0, y=0):
self.num_sides = num_sides
self.side_len = side_len
self.center = [x, y]
def resize(self, factor):
self.side_len *= factor
def translate(self, x, y):
self.center[0] += x
self.center[1] += y
def plot(self):
...
\end{verbatim}
\end{frame}
\begin{frame}[fragile=singleslide] \frametitle{Analogy \#1: OOP}
\begin{verbatim}
class Triangle(Polygon):
def __init__(self):
super().__init__(3)
...
class Square(Polygon):
def __init__(self):
super().__init__(4)
...
\end{verbatim}
\end{frame}
\begin{frame} \frametitle{Analogy \#2: LEGO}
\centering
basic building block:
\vspace{2em}
\includegraphics[height=4cm]{lego1.eps}
\end{frame}
\begin{frame} \frametitle{Analogy \#2: LEGO}
\centering
scaling (4x2):
\vspace{2em}
\includegraphics[height=4cm]{lego2.eps}
\end{frame}
\begin{frame} \frametitle{Analogy \#2: LEGO}
\centering
adding:
\vspace{2em}
\includegraphics[height=4cm]{lego3.eps}
\end{frame}
\end{document}
\begin{frame} \frametitle{Let's look at $\mathbb{R}^2$}
\note<1>{ \begin{itemize}
\item One vector $x$
\item Length of vector $|x|$
\item Another vector $y$ with length $|y|$
\item Angle $\alpha$ between two vectors
\item Special angle: +/- 90 degrees, orthogonal!
\end{itemize}}
\begin{center}
\psset{unit=10mm}
\begin{pspicture}(-1,0)(8,6)
\SpecialCoor%
\qdisk(0,0){3pt}
\def\a{10 }\def\r{8 }
\only<2->{
\psline{->}(! \a cos \r mul \a sin \r mul)
\uput{\r}[\a](0,0){~$\mathbf{x} = [x_0 \, x_1]^T$}}
\only<3->{
\rput[tl]{0}(! \a cos \r mul 0.5 mul \a sin \r mul 0.5 mul){$\|\mathbf{x}\|$}}
\def\b{70 }\def\s{6 }
\only<4-6>{
\psline{->}(! \b cos \s mul \b sin \s mul)
\uput{\s}[\b](0,0){~$\mathbf{y} = [y_0 \, y_1]^T$}
\rput[tr]{0}(! \b cos \s mul 0.5 mul \b sin \s mul 0.5 mul){$\|\mathbf{y}\|$~}}
\only<5-6>{
\psarc[linecolor=darkred]{->}{3}{\a}{\b}\uput{3.1}[40]{0}(0,0){$\alpha$}}
\only<6>{
\uput{5.1}[40]{0}(0,0){$\langle\mathbf{x},\mathbf{y}\rangle = x_0y_0 + x_1y_1 = \|\mathbf{x}\|\|\mathbf{y}\|\cos\alpha$}}
\def\ca{100 }
\only<7->{
\psline{->}(! \ca cos \s mul \ca sin \s mul)
\uput{\s}[\ca](0,0){~$\mathbf{y}$}
\psarc[linecolor=darkred]{->}{3}{\a}{\ca}\uput{3.1}[40]{0}(0,0){$\pi/2$}
\uput{5.1}[40]{0}(0,0){$\langle\mathbf{x},\mathbf{y}\rangle =0$}}
\NormalCoor%
\end{pspicture}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Vectors can be very general objects!}
\begin{center}
Example: space of square-integrable functions over $[-1,1]$: $L_2([-1,1])$
\end{center}
\begin{columns}
\begin{column}{.5\paperwidth}
\centering
\begin{dspPlot}[width=5cm,height=2.7cm,sidegap=0,xout=true,xlabel={$\mathbf{x}^{(1)}=x_1(t)=\sin(f_1\,t),\quad f_1=2\pi$}]{-1,1}{-1.1,1.1}
\moocStyle
\dspFunc{x 180 mul 2 mul sin }
\end{dspPlot}
\end{column}
\begin{column}{.5\paperwidth}
\centering
\begin{dspPlot}[width=5cm,height=2.7cm,sidegap=0,xout=true,xlabel={$\mathbf{x}^{(2)}=x_2(t)=t$}]{-1,1}{-1.1,1.1}
\moocStyle
\dspFunc{x }
\end{dspPlot}
\end{column}
\end{columns}
\vspace{1ex}
\[
\langle\mathbf{x}^{(1)},\mathbf{x}^{(2)}\rangle = \int_{-1}^{1} x_1(t)x_2(t)dt
\]
\vspace{1ex}
\end{frame}
% Slide on sinusoids being orthogonal
\begin{frame}
\frametitle{Orthogonality in a functional vector space.}
\begin{center}
Example: harmonically-related sinusoids ($L_2([-1,1]))$
\end{center}
\begin{columns}
\begin{column}{.5\paperwidth}
\centering
\begin{dspPlot}[width=5cm,height=2.7cm,sidegap=0,xout=true,xlabel={$\mathbf{x}^{(1)}=\sin(f_1\,t),\quad f_1=2\pi$}]{-1,1}{-1.1,1.1}
\moocStyle
\dspFunc{x 180 mul 2 mul sin }
\end{dspPlot}
\end{column}
\begin{column}{.5\paperwidth}
\centering
\begin{dspPlot}[width=5cm,height=2.7cm,sidegap=0,xout=true,xlabel={$\mathbf{x}^{(2)}=\sin(f_2\,t),\quad f_2=5\pi$}]{-1,1}{-1.1,1.1}
\moocStyle
\dspFunc{x 180 mul 5 mul sin }
\end{dspPlot}
\end{column}
\end{columns}
\vspace{1ex}
\[
\mathbf{x}^{(1)} \perp \mathbf{x}^{(2)} \mbox{ if $f_1 \neq f_2$ and $f_1, f_2$ integer multiples of a fundamental (harmonically related)}
\]
\end{frame}
\begin{frame}
\frametitle{Orthogonality in a functional vector space.}
\[
\langle\mathbf{x}^{(1)},\mathbf{x}^{(2)}\rangle = \int_{-1}^1 \sin(f_1\,t)\sin(f_2\,t)dt
\]
\centering
\def\fun{ dup 180 mul 2 mul sin exch 180 mul 5 mul sin mul }
\begin{dspPlot}[sidegap=0,xout=true,xlabel={$\sin(f_1\,t)\,\sin(f_2\,t),\quad f_1=2\pi, f_2 = 5\pi$}]{-1,1}{-1.1,1.1}
\moocStyle
\only<1>{\dspFunc{x \fun}}
\SpecialCoor
\only<2->{
\pscustom[fillstyle=solid,fillcolor=green!30,linestyle=none]{%
\dspFunc[linecolor=green]{x \fun dup 0 ge {} {pop 0} ifelse}}
\pscustom[fillstyle=solid,fillcolor=red!30,linestyle=none]{%
\dspFunc[linecolor=red]{x \fun dup 0 ge {pop 0} {} ifelse}}}
\end{dspPlot}
\end{frame}
% TEXT:
% Obvious
% Slide bases, orthogonal and biorthogonal
% XXX need to add a third case, of 2 collinear vectors.
% So left: orthogonal basis
% Center: birothogonal basis
% Right: collinear vectors
\begin{frame}
\frametitle{Vectors spanning a space}
\psset{unit=15mm}
\begin{columns}
\begin{column}{.5\paperwidth}
\centering
\begin{pspicture}(-1,-.5)(3,3)
\psline[linewidth=0.5pt,linecolor=gray](2.5,0) \psline[linewidth=0.5pt,linecolor=gray](0,2.5)
\psline[linecolor=darkgray]{->}(1,0)\rput[tr]{0}(1,-0.1){$\mathbf{e}^{(0)}$}
\psline[linecolor=darkgray]{->}(0,1)\rput[tr]{0}(-.2,1){$\mathbf{e}^{(1)}$}
\psline{->}(0.5,2)\rput[bl]{0}(0.5,2){$\mathbf{x}$}
\psline[linewidth=1.5pt,linestyle=dotted,linecolor=gray](0,2)(0.5,2)
\psline[linewidth=1.5pt,linestyle=dotted,linecolor=gray](0.5,0)(0.5,2)
\end{pspicture}
orthogonal basis
\end{column}
\begin{column}{.5\paperwidth}
\centering
\begin{pspicture}(-1,-.5)(3,3)
\SpecialCoor
\psline[linewidth=0.5pt,linecolor=gray](2.5,0)
\psline[linewidth=0.5pt,linecolor=gray](2.2,2.2)
\psline[linecolor=darkgray]{->}(1,0)\rput[tr]{0}(1,-0.1){$\mathbf{v}^{(0)}$}
\psline[linecolor=darkgray]{->}(1,1)\rput[tr]{0}(0.7,1){$\mathbf{v}^{(1)}$}
\psline{->}(2,1)\rput[bl]{0}(2.1,1){$\mathbf{x}$}
\psline[linewidth=1.5pt,linestyle=dotted,linecolor=gray](1,1)(2,1)
\psline[linewidth=1.5pt,linestyle=dotted,linecolor=gray](1,0)(2,1)
\end{pspicture}
non-orthogonal basis
\end{column}
\end{columns}
\end{frame}
% TEXT:
% Obvious
% Slide bases, too many vectors
\begin{frame}
\frametitle{Too many vectors for the space: example in $\mathbb{R}^2$}
\begin{center}
\psset{unit=20mm}
\begin{pspicture}(-1.2,-1.2)(1.2,1.2)
\def\a{1,0}\def\b{-0.5,0.866}\def\c{-0.5,-0.866}
\psline{->}(\a)\uput{1.1}[0](0,0){$\mathbf{x}^{(0)}$}
\psline{->}(\b)\uput{1.1}[120](0,0){$\mathbf{x}^{(1)}$}
\only<1->{
\psline{->}(\c)\uput{1.1}[240](0,0){$\mathbf{x}^{(2)}$}}
\only<2->{
\psline[linecolor=lightgray]{->}(\c)\uput{1.1}[240](0,0){$\mathbf{x}^{(2)}$}
\psline[linecolor=gray]{->}(\b)(-1,0)}
%\only<2>{\uput{1.1}[180](0,0){\color{gray}$\mathbf{x}_2$}}
\only<3->{
\psline[linecolor=red]{->}(-1,0)\uput{1.1}[180](0,0){\color{red}$-\mathbf{x}^{(0)}$}}
\end{pspicture}
\end{center}
Linear dependence:
\[
\exists \{a_0, a_1, a_2\} \mbox{ s.t. } a_0 \mathbf{x}^{(0)} + a_1 \mathbf{x}^{(1)} + a_2 \mathbf{x}^{(2)} = 0
\]
\end{frame}
% TEXT:
% Obvious
% Slide bases, not enough vectors, approximation
\begin{frame}
\frametitle{Not enough vectors for the space: example in $\mathbb{R}^3$}
\begin{columns}
\begin{column}{.3\paperwidth}
subspace projection: $\hat{\mathbf{x}}$ is the closest approximation to ${\mathbf{x}}$ in the space spanned by $\{\mathbf{e}^{(0)}, \mathbf{e}^{(1)} \}$
\end{column}
\begin{column}{.5\paperwidth}
\centering
\psset{unit=3cm}
\begin{pspicture}(-1.5,-.8)(1.5,1.8)
\psset{Alpha=40,linewidth=1pt}
\pstThreeDCoor[linecolor=black,linewidth=1pt,%
xMax=1.5,yMax=1.5,zMax=1.5,%
xMin=-.2,yMin=-.2,zMin=-.2,%
nameX=$\mathbf{e}^{(0)}$,
nameY=$\mathbf{e}^{(1)}$,
nameZ=$\mathbf{e}^{(2)}$]
\pstThreeDLine[linestyle=dashed,linewidth=0.5pt](0,.5,0)(1,.5,0)
\pstThreeDLine[linestyle=dashed,linewidth=0.5pt](1,.5,0)(1,0,0)
\pstThreeDLine[linestyle=dashed,linewidth=0.5pt](1,.5,0)(1,.5,2)
\pstThreeDLine[linecolor=gray,linewidth=1.8pt]{->}(0,0,0)(1,.5,0)
\pstThreeDLine[linewidth=1.8pt]{->}(0,0,0)(1,.5,2)
\pstThreeDPut(1,.5,2.15){$\mathbf{x}$}
\pstThreeDPut(1.15,.65,0){$\hat{\mathbf{x}}$}
\end{pspicture}
\end{column}
\end{columns}
\end{frame}
% TEXT:
% Obvious
\def\partSum#1#2{%
\only<#1>{\dspFunc{% square wave expansion y = sum_n sin(2pi(2n+1)t)/(2n+1)
x 180 mul
0 % accumulator a
0 1 #2 % start, inc, end for loop
{2 mul 1 add % 2n+1 = k
dup % stack: x a k k
3 index % x a k k x
mul sin exch div
add}
for
exch pop}
\dspText(1.2,0){$N=#2$}}}
% Slide bases, how about infinity?
\begin{frame}
\frametitle{Interesting questions when the space has $\infty$ dimensions}
\begin{center}
$\sum_{k=0}^{N}\mathbf{x}^{(2k+1)}, \qquad \mathbf{x}^{(n)} = \sin(\pi\,n\,t)/n, \quad t \in [-1,1]$
\begin{dspPlot}[sidegap=0,xout=true]{-1,1}{-1.1,1.1}
\moocStyle
\partSum{1}{0}
\partSum{2}{1}
\partSum{3}{2}
\partSum{4}{10}
\partSum{5}{50}
\partSum{6}{150}
\end{dspPlot}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Signals and vector spaces: motivation}
\begin{itemize}[<+->]
\item finite-length and periodic signals live in $\mathbb{C}^N$
\item infinite-length signals live in $\ell_2(\mathbb{Z})$
\vspace{1em}
\item different bases are different observation tools for signals
\item subspace projections are useful in filtering and compression
\end{itemize}
\end{frame}
\end{document}

Event Timeline