From a6db20a6d9cfe457b5deb643932813b921a04d47 Mon Sep 17 00:00:00 2001 From: Christiaan Baaij Date: Sun, 13 Dec 2009 19:18:58 +0100 Subject: [PATCH] Add files for FIR --- christiaan/dotproduct.lhs | 56 +++++++++++++++++++++++++++++++ christiaan/fir.lhs | 69 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 christiaan/dotproduct.lhs create mode 100644 christiaan/fir.lhs diff --git a/christiaan/dotproduct.lhs b/christiaan/dotproduct.lhs new file mode 100644 index 0000000..4a150c9 --- /dev/null +++ b/christiaan/dotproduct.lhs @@ -0,0 +1,56 @@ +%include talk.fmt +\subsection{Dot Product} +\begin{frame} + \frametitle{Dot Product} + \[ + y = \overrightarrow x \bullet \overrightarrow h + \] +\end{frame} + +\begin{frame} + \frametitle{Dot Product} + \[ + y = \overrightarrow x \bullet \overrightarrow h + \] + \[ + \overrightarrow x \bullet \overrightarrow h = \sum\nolimits_{i = 1}^n {a_1 \cdot b_1 + a_2 \cdot b_2 + \ldots + a_n \cdot b_n } + \] +\end{frame} + +\begin{frame} + \frametitle{Dot Product} + \begin{itemize} + \item Two steps to define: \\ + \[ + \overrightarrow x \bullet \overrightarrow h = \sum\nolimits_{i = 1}^n {a_1 \cdot b_1 + a_2 \cdot b_2 + \ldots + a_n \cdot b_n } + \] + \begin{itemize} + \item \emph{Pairwise Multiplication}: \\ + \begin{verbatim} + zipwith (*) xs hs = + < x0*h0, x1*h1, x(n-1)*h(n-1)> + \end{verbatim} + \item \emph{Summation}: \\ + \begin{verbatim} + foldl (+) 0 zs = + (..((0+z0)+z1)+..+z(n-1)) + \end{verbatim} + \end{itemize} + \end{itemize} +\end{frame} + +\begin{frame} + \frametitle{Dot Product} + \begin{itemize} + \item Two steps to define: \\ + \[ + \overrightarrow x \bullet \overrightarrow h = \sum\nolimits_{i = 1}^n {a_1 \cdot b_1 + a_2 \cdot b_2 + \ldots + a_n \cdot b_n } + \] + \begin{itemize} + \item \emph{Combine the two}: \\ + \begin{verbatim} + xs ** hs = foldl (+) 0 (zipWith (*) xs hs) + \end{verbatim} + \end{itemize} + \end{itemize} +\end{frame} \ No newline at end of file diff --git a/christiaan/fir.lhs b/christiaan/fir.lhs new file mode 100644 index 0000000..c76e753 --- /dev/null +++ b/christiaan/fir.lhs @@ -0,0 +1,69 @@ +%include talk.fmt +\section{FIR Filter} + +\begin{frame} + \frametitle{Example: FIR Filter} + \begin{itemize} + \item FIR Filters, and digital filters in general are essential components in radio's, receivers, and cellphones. + \item Equation for a FIR Filter: \\ + \[ + y_t = \sum\nolimits_{i = 0}^{n - 1} {x_{t - i} \cdot h_i } + \] + \end{itemize} +\end{frame} + +\begin{frame} + \frametitle{FIR Filter} + \[ + y_t = \sum\nolimits_{i = 0}^{n - 1} {x_{t - i} \cdot h_i } + \] +\end{frame} + +\input{christiaan/dotproduct} + +\begin{frame} + \frametitle{FIR Filter} + \[ + y_t = \sum\nolimits_{i = 0}^{n - 1} {x_{t - i} \cdot h_i } + \] \\ + \begin{verbatim} + fir (State pxs) x = (pxs**hs, State (pxs<++x)) + where hs = $(vectorTH [2::Int16,3,-2,4]) + \end{verbatim} + \centerline{\begin{tabular}{rl} + |pxs| & Previous x's (state)\\ + |x| & New input value\\ + |pxs <++ x| & Remember new |x|, remove oldest\\ + |pxs ** hs| & Output + \end{tabular}} + +\end{frame} + +\begin{frame} + \frametitle{FIR Filter} + \centerline{\Huge{Demo}} +\end{frame} + +\begin{frame} + \frametitle{Synthesized Output} + \vspace{-0.8em} + \begin{figure} + \centerline{\includegraphics[width=\paperwidth,trim=9mm 4cm 14mm 4cm, clip=true]{fir0.png}} + \end{figure} +\end{frame} + +\begin{frame} + \frametitle{Synthesized Output} + \vspace{-0.8em} + \begin{figure} + \centerline{\includegraphics[width=\paperwidth,trim=9mm 4cm 16.5cm 4cm, clip=true]{fir1.png}} + \end{figure} +\end{frame} + +\begin{frame} + \frametitle{Synthesized Output} + \vspace{-0.8em} + \begin{figure} + \centerline{\includegraphics[width=\paperwidth,trim=3cm 4cm 4cm 4cm, clip=true]{fir2.png}} + \end{figure} +\end{frame} \ No newline at end of file -- 2.30.2