% -*- latex -*-
% FILE: "/home/evmik/jobs/wm/2015_fall_practical_computing_for_scientists/hw10/hw10.tex"
% LAST MODIFICATION: "Mon, 23 Nov 2015 18:14:39 -0500 (evmik)"
% (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
% $Id:$
\documentclass[letter,12pt]{article}

%---------------------------------------------------------------
\usepackage{listings}
\usepackage{color}
\usepackage{fullpage}
%---------------------------------------------------------------

\begin{document}
\newcommand{\problem}[1]{%
	{\flushleft  \bf #1\\}
}
\newcommand{\subproblem}[1]{%
{\flushleft  {\bf Subproblem:} #1\\}
}
\newcommand{\hw}[1]{%
	\begin{center}
		\Large  \bf Homework #1%
	\end{center}%
}
\newcommand{\mat}[1]{% matlab code
{\color{blue}\texttt{#1}}%
}

%---------------------------------------------------------------
\hw{10}

\problem{Problem 1 (5 points)}
%---------------------------------------------------------------
Have a look at the particular realization of the  $N$ point forward DFT
\begin{eqnarray*}
	C_n=\sum_{k=1}^N y_k exp( -i 2 \pi  (k-1) n /N)
\end{eqnarray*}
The normalization coefficient is omitted.

Analytically prove that the forward discrete Fourier transform is
periodic, i.e.,
$c_{n+N}=c_{n}$.
Note: recall that $exp(\pm i 2 \pi)=1$.

Does this also prove  that $c_{-n} = c_{N-n}$?



\problem{Problem 2 (5 points)}
%---------------------------------------------------------------
Use proof for the previous problem relationships and show that
the following relationship holds
for any sample set which has only real values (i.e., no complex part)
\begin{eqnarray*}
	c_n = c_{N-n}^*
\end{eqnarray*}
Where $^*$ depicts the complex conjugation.

\problem{Problem 3 (15 points)}
%---------------------------------------------------------------
Load the data from the file 'hw\_data\_for\_filter.dat' provided at the class web page. 
It contains a table with $y$ vs
$t$ data points (the first column holds the time, the second holds $y$). These data points are
taken with the same sampling rate.


\subproblem{3a (2 points)}
What is the sampling rate?

\subproblem{3b (3 points)}
Calculate forward DFT of the data (use Matlab built-ins)
and find which 2 frequency components of
the spectrum (measured in Hz not rad$^-1$) are the largest. Note, I refer to
the real frequency of the $\sin$ or $\cos$ component, i.e.,  only positive
frequencies. 

\subproblem{3c (2 points)}
What is the largest possible frequency (in Hz) in this data set which we
can scientifically discuss?

\subproblem{3d (5 points)}
Consider everything else but above 2 components of the DFT as noise.
Construct a low-pass filter  which will pass these two components. Plot the
filter frequency representation (positive and negative frequency). Explain your
choice of the filter and its parameters.

\subproblem{3e (3 points)}
Apply the filter to the data Fourier representation and calculate the inverse
DFT. Plot the resulting filtered data representation and  raw data points
in the same plot. Does your filter completely get rid of noise? If not why
is it so?


%---------------------------------------------------------------
\end{document}
%---------------------------------------------------------------
