\documentclass{article}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{graphicx}
\usepackage{listings}

\lstset{% Default options for all algorithm listings read
  language=matlab,
  %labelstep=5,
  %frame=trbl,
  %indent=15pt,
  %indent=12pt,
  showlines=false,
  stringstyle=\itshape%,
  %basicstyle=\ttfamily\footnotesize
}

\author{Nada Amin\\
\texttt{namin@mit.edu}
}

\title{6.003 Lab 2}

\begin{document}

\date{April 6, 2005}

\maketitle

\pagestyle{myheadings}
\markright{Nada Amin (6.003 Lab 1) (4/6/05)}

\section*{Basic Problems}
\subsection*{(b)}
\begin{figure}[htp]
   \centering
   \includegraphics[width=1\textwidth]{d2}
   \caption{Plot of $D_2(e^{jw})$}
   \label{fig:fig-a}
\end{figure}

\begin{figure}[htp]
   \centering
   \includegraphics[width=1\textwidth]{d9}
   \caption{Plot of $D_9(e^{jw})$}
   \label{fig:fig-a}
\end{figure}

\section*{Advanced Problems}
\subsection*{(f)}
Here is a table of indices and their corresponding $\omega$ that I
found to be the closest to each of the touch-tone frequencies.

\begin{tabular}{|lrrr|} \hline
touch-tone context & real $\omega$ & closest $\omega$ & closest index \\ \hline
$\omega_{row}(1)$    & $0.5346$ & $0.5338$ & $175$ \\
$\omega_{row}(2)$    & $0.5906$ & $0.5921$ & $194$ \\
$\omega_{row}(3)$    & $0.6535$ & $0.6535$ & $214$ \\
$\omega_{row}(4)$    & $0.7217$ & $0.7210$ & $236$ \\
$\omega_{column}(1)$ & $0.9273$ & $0.9265$ & $303$ \\
$\omega_{column}(2)$ & $1.0247$ & $1.0247$ & $335$ \\
$\omega_{column}(3)$ & $1.1328$ & $1.1321$ & $370$ \\
\hline
\end{tabular}

\subsection*{(g)}
Here is a list of values of $|D_8(e^{jwk})|^2$ for each value of $w_k$
that I determined in part (f).

\begin{tabular}{|lr|} \hline
touch-tone context & $|D_8(e^{jwk})|^2$  \\ \hline
$\omega_{row}(1)$    & $3.9811 \cdot 10^0$\\
$\omega_{row}(2)$    & $1.6592 \cdot 10^2$\\
$\omega_{row}(3)$    & {\bf $2.5049 \cdot 10^5$}\\
$\omega_{row}(4)$    & $5.2769 \cdot 10^1$\\
$\omega_{column}(1)$ & $4.8526 \cdot 10^1$\\
$\omega_{column}(2)$ & {\bf $2.5022 \cdot 10^5$}\\
$\omega_{column}(3)$ & $9.0996 \cdot 10^0$\\
\hline
\end{tabular}

We observe that two frequencies ($\omega_{row}(3)$ and
$\omega_{column}(2)$) have larger energy values by at least $3$ order
of magnitudes. Not surprisingly, these are the frequencies that are
actually present in the signal for digit $8$.

\subsection*{(h-i)}
I decoded the provided signals into the following phone numbers:

\begin{tabular}{|l|l|} \hline
signal & phone number \\ \hline
{\tt x1} & 968-7335\\ \hline
{\tt x2} & 324-0716\\ \hline
{\tt hardx1} & 968-7335\\\hline
{\tt hardx2} & 324-0716\\ \hline
\end{tabular}

\pagebreak
\section*{MATLAB Code}
\subsection*{\texttt{ttdecode.m}}
\lstinputlisting{ttdecode.m}

\subsection*{\texttt{find\_index.m}}
\lstinputlisting{find_index.m}

\subsection*{Script for Basic Problems}
\lstinputlisting{basic.m}

\subsection*{Script for Advanced Problems}
\lstinputlisting{adv.m}

\end{document}

