diff --git a/teaching/COM303/2017/homework/hw01/hw01.tex b/teaching/COM303/2017/homework/hw01/hw01.tex
index 42b94cb..a80576a 100644
--- a/teaching/COM303/2017/homework/hw01/hw01.tex
+++ b/teaching/COM303/2017/homework/hw01/hw01.tex
@@ -1,212 +1,209 @@
-\documentclass[a4paper]{article}
-
+\documentclass[12pt,a4paper]{article}
 \usepackage{../styles/defsDSPcourse}
-\usepackage{dspBlocks}
-\usepackage{graphicx}
 
 
 \title{COM-303 - Signal Processing for Communications}
 \author{Homework \#1}
 \date{}
 
 
 \begin{document}
 \maketitle
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{exercise}{Digital signals}
 
-  Which one(s) of the following signals is/are digital?
+  Say which of the following signals are analog and which are digital:
   \begin{enumerate}
     \item Music recorded on a CD.
     \item Music listened by the audience at a live concert.
     \item Music recorded on a LP record (vinyl).
     \item Photo recorded using a photographic film.
     \item Photo recorded using a CCD sensor.
     \item A page on a book.
     \item The image of a book page on a Kindle. 
   \end{enumerate}
 
 \end{exercise}
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{exercise}{Sampling music}
 
   A music song recorded in a studio is stored as a digital sequence on a CD. The analog signal representing the music is 2 minutes long and is sampled at a frequency $f_s=44100\;s^{-1}$. How many samples should be stored on the CD? 
 
 \end{exercise}
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{exercise}{Elementary signals and operators}
 
   Using elementary operators, express the delta signal $\delta[n]$ in terms of
   the unit step $u[n]$ and conversely.
 
 \end{exercise}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{exercise}{Moving average}
   
   Consider the following signal,
   \begin{equation}
     x[n] = \delta[n] + 2\delta [n-1] + 3\delta [n-2].
   \end{equation}
   Compute its moving average $y[n]=\frac{x[n]+x[n-1]}{2}$, where we call $x[n]$ the input and $y[n]$ the output.
 
 \end{exercise}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{exercise}{Operators and linearity}
   A \emph{linear} operator is one for which the following holds:
   \[
   \left\{
   \begin{array}{l}
       S\{\alpha x[n]\} = \alpha S\{x[n]\} \\
       S\{x[n] + y[n]\} = S\{x[n]\} + S\{y[n]\}
   \end{array}
   \right.
   \]
 
   \begin{enumerate}
     \item Show that the delay operator $D\{x[n]\} = x[n-1]$ is linear.
     \item Show that the squaring operator $S\{x[n]\} = x^2[n]$ is \emph{not} linear.
   \end{enumerate}
     
 \end{exercise}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{exercise}{Operators with matrix notation}
 
   In $\mathbb{C}^N$, any linear operator on a finite-length signal $x[n]$ can be expressed as a matrix-vector multiplication. Let us see an example:  in $\mathbb{C}^N$, define the delay operator as the left circular shift of a vector
   \[
       D\{x[n]\} = [x[N-1] \; x[0] \; x[1] \; \ldots \;
       x[N-2]]^T.
   \]
   Assume $N=4$ for convenience; it is easy to see that
   \[
       D\{x[n]\}=D\{\mathbf{x}\} = \begin{bmatrix}
   0 & 0 & 0 & 1\\
   1 & 0 & 0 & 0\\
   0 & 1 & 0 & 0\\
   0 & 0 & 1 & 0
   \end{bmatrix} \mathbf{x} = \mathbf{Dx}
   \]
   
   Write out the matrix form of the differentiation operator $\Delta\{x[n]\} = x[n]- D\{x[n]\} = x[n] - x[n-1]$ in $\mathbb{C}^4$.
 
 \end{exercise}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{exercise}{SP with Lego}
   Given the following filter:
 
   \begin{figure}[ht!]
     \centering
     \begin{dspBlocks}{0.7}{0.6}
      $x[n]$ & \BDsplit & \BDsplit &         & \BDadd &         & \BDadd & $y[n]$\\
             &          &        & \BDdelay & & & & \\
             &          & \BDsplit &         & \BDadd & \BDdelayN{3} &  \\
             &          &        & \BDdelay & & & & \\
         \ncline{1,1}{1,3}\ncline{->}{1,3}{1,5}\taput{$a$}
         \ncline{1,5}{1,6}%\taput{$p[n]$}
         \ncline{->}{1,6}{1,7}\taput{$b$}
         \ncline{->}{1,7}{1,8}
         \ncline{1,2}{3,2} \ncline{2,3}{1,3}
         \ncline{->}{2,5}{1,5}
         \ncline{4,3}{3,3} \ncline{->}{4,5}{3,5} \ncline{->}{3,7}{1,7}\trput{$-1$}
         \ncline{3,2}{3,3} \ncline{3,3}{3,5}\taput{$c$}
         \ncline{->}{3,5}{3,6}%\taput{$q[n]~~~~~$}
         \ncline{3,6}{3,7}
         \ncline{2,3}{2,4}\ncline{2,4}{2,5}\ncline{3,7}{3,7}%\tbput{$r[n]$}
         \ncline{4,3}{4,4}\ncline{4,4}{4,5}
     \end{dspBlocks}
   \end{figure}
   
   What is the input-output relationship?
 
 \end{exercise}
 
 
 %\begin{exercise}{Bases}
 %Let $\{\mathbf{x}^{(k)}\}_{k=0,\ldots,N-1}$ be a basis for a
 %subspace $S$. Prove that any vector $\mathbf{z}\in S$ is
 %\emph{uniquely} represented
 %in this basis.\\\\
 %\emph{Hint:} prove by contradiction.
 %\end{exercise}
 %
 %
 %\begin{exercise}{Fourier Basis}
 %Consider the {\it Fourier basis} $\{ \wb^{(k)}\}_{k=0,
 %\ldots,N-1}$, defined as:
 %\[
 %\wb_n^{(k)}=e^{-j\frac{2\pi}{N}nk}.
 %\]
 %\begin{enumerate}
 %
 %\item Prove that it is an {\it orthogonal basis} in $\setC^N$.
 %
 %\item Normalize the vectors in order to get an {\it orthonormal
 %basis}.
 %
 %\end{enumerate}
 %\end{exercise}
 %
 %
 %\begin{exercise}{vector spaces}
 %Show that the set of all ordered n-tuples $[a_1,a_2, \dots
 %,a_n]$ with the natural definition for the sum: $[a_1,a_2, \dots
 %,a_n]+[b_1,b_2, \dots ,b_n]=[a_1+b_1,a_2+b_2, \dots ,a_n+b_n]$ and
 %the multiplication by a scalar: $\alpha[a_1,a_2, \dots
 %,a_n]=[\alpha a_1,\alpha a_2, \dots ,\alpha a_n]$ form a vector
 %space. Give its dimension and find a basis.
 %\end{exercise}
 %
 %\begin{exercise}{Bases \& Matlab}
 %Consider the following change of basis matrix in $\mathbb{C}^8$, with respect to the standard orthonormal basis:
 %\[
 %    \mathbf{H} = \begin{bmatrix}
 %1 & -1 & 0 & 0 & 0 & 0 & 0 & 0\\
 %0 & 0 & 1 & -1 & 0 & 0 & 0 & 0\\
 %0 & 0 & 0 & 0 & 1 & -1 & 0 & 0\\
 %0 & 0 & 0 & 0 & 0 & 0 & 1 & -1\\
 %1 & 1 & -1 & -1 & 0 & 0 & 0 & 0\\
 %0 & 0 & 0 & 0 & 1 & 1 & -1 & -1\\
 %1 & 1 & 1 & 1 & -1 & -1 & -1 & -1 &\\
 %1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 &\\
 %\end{bmatrix}.
 %\]
 %
 %\begin{enumerate}
 %\item What is an easy way to prove that the rows in $\mathbf{H}$ do indeed form a basis? (\emph{Hint}: it's enough to show that they are linearly independent, which is to say, that the matrix has full rank...)
 %\item Use Matlab to verify point (a).
 %\end{enumerate}
 %The basis described by $\mathbf{H}$ is called the \emph{Haar basis} and it is one of the most celebrated cornerstones of a branch of signal processing called wavelet analysis (which we won't study in this class). To get a feeling for its properties, however, consider the following set of Matlab experiments:
 %\begin{enumerate}
 %\setcounter{enumi}{2}
 %\item Verify that $\mathbf{H}\mathbf{H}^H$ is a diagonal matrix, which means the vectors are orthogonal.
 %\item Consider a constant signal {\tt x = ones(8,1)} and compute its coefficients in the Haar basis.
 %\item Consider an alternating signal \verb| x = (-1).^(0:7)'| and compute its coefficients in the Haar basis.
 %\end{enumerate}
 %\end{exercise}
 %
 %\begin{exercise}{Series of complex numbers}
 %Let $s[n]:=\frac{1}{2^n} + j\frac{1}{3^n}$. Compute $\sum_{n=1}^{\infty}s[n]$.
 %\end{exercise}
 %
 %
 %
 %
 %
 
 \end{document}
diff --git a/teaching/COM303/2017/homework/hw01/sol01.tex b/teaching/COM303/2017/homework/hw01/sol01.tex
index 3682b71..e91a5b9 100644
--- a/teaching/COM303/2017/homework/hw01/sol01.tex
+++ b/teaching/COM303/2017/homework/hw01/sol01.tex
@@ -1,137 +1,136 @@
-\documentclass[a4paper, fleqn]{article}
+\documentclass[12pt,a4paper,fleqn]{article}
 
 \usepackage{../styles/defsDSPcourse} 
-\usepackage{dspBlocks}
 
 \title{COM-303 - Signal Processing for Communications}
 \author{Solutions for Homework \#1}
 \date{}
 
 \begin{document}
 \maketitle
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{solution}{Digital signals}
   \begin{enumerate}
     \item Music recorded on a CD : {\bfseries digital}
     \item Music listened by the audience at a live concert : {\bfseries analog}
     \item Music recorded on a LP record (vinyl) : {\bfseries analog}
     \item Photo recorded using a photographic film : {\bfseries analog}
     \item Photo recorded using a CCD sensor : {\bfseries digital}
     \item A page on a book : {\bfseries analog}
     \item The image of a book page on a Kindle : {\bfseries digital}
   \end{enumerate}
 
 \end{solution}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{solution}{Sampling music}
  To compute the number of samples $N$, we need to multiply the length in seconds of the signal by the sampling frequency, i.e., the number of samples per second: 
  \[
    N=44100 \times 2 \times 60 = 5,292,000
  \]
  This assumes that the audio is mono; for stereo data, there are two independent channels so the number of samples is double.
 \end{solution}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{solution}{Elementary signals and operators}
   \begin{align*}
     \delta[n] &= u[n]-u[n-1] \\
     u[n] &= \sum_{k=0}^{\infty}\delta[n-k]
   \end{align*}
 \end{solution}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{solution}{Moving average}
 
   We compute $y[n]$ by substituting the expression for $x[n]$ into $y[n]= (x[n]+x[n-1])/2$:
   \[
     y[n]=\frac{\delta[n]+2\delta[n-1]+3\delta[n-2]+\delta[n-1]+2\delta[n-2]+3\delta[n-3]}{2}
   \]
 
   By collecting the delta signals that have the same delay we finally obtain:
   \[
      y[n]=0.5\delta[n]+1.5\delta[n-1]+2.5\delta[n-2]+1.5\delta[n-3].
   \]
 \end{solution}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{solution}{Operators and linearity}
 
   \begin{enumerate}
     \item $D\{\alpha x[n]\} = \alpha x[n-1] = \alpha D\{x[n]\}$ \\
       $D\{x[n] + y[n]\} = x[n-1] + y[n-1]  = D\{x[n]\} + D\{y[n]\}$.
     \item $S\{\alpha x[n]\} = \alpha^2 x^2[n] = \alpha^2 S\{x[n]\} \neq \alpha S\{x[n]\}$.
   \end{enumerate}
 \end{solution}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{solution}{Operators with matrix notation}
   \[
     \mathbf{\Delta} = \mathbf{I-D} = 
       \begin{bmatrix}
         1 & 0 & 0 & -1\\
         -1 & 1 & 0 & 0\\
         0 & -1 & 1 & 0\\
         0 & 0 & -1 & 1
       \end{bmatrix}.
   \]
 \end{solution}
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{solution}{SP with Lego}
   To determine the input-output relationship of a complex circuit, it is a good strategy to first look at the intermediate signals that appear at key nodes in the graph. Once the expressions for these signals are computed, they can be combined to produce the global output of the circuit. 
   
   In the graph below, call $p[n]$, $q[n]$, $r[n]$ the internal signals in the circuit at the shown locations:
   \vspace{1em}
 
   \begin{figure}[ht!]
     \centering
     \begin{dspBlocks}{0.7}{0.6}
      $x[n]$ & \BDsplit & \BDsplit &         & \BDadd &         & \BDadd & $y[n]$\\
             &          &        & \BDdelay & & & & \\
             &          & \BDsplit &         & \BDadd & \BDdelayN{3} &  \\
             &          &        & \BDdelay & & & & \\
         \ncline{1,1}{1,3}\ncline{->}{1,3}{1,5}\taput{$a$}
         \ncline{1,5}{1,6}\taput{$p[n]$}
         \ncline{->}{1,6}{1,7}\taput{$b$}%\ncline[linewidth=0pt]{1,5}{1,5}
         \ncline{->}{1,7}{1,8}
         \ncline{1,2}{3,2} \ncline{2,3}{1,3}
         \ncline{->}{2,5}{1,5}
         \ncline{4,3}{3,3} \ncline{->}{4,5}{3,5} \ncline{->}{3,7}{1,7}\trput{$-1$}
         \ncline{3,2}{3,3} \ncline{3,3}{3,5}\taput{$c$}
         \ncline{->}{3,5}{3,6}\taput{$q[n]~~~~~$}
         \ncline{3,6}{3,7}
         \ncline{2,3}{2,4}\ncline{2,4}{2,5}\ncline{3,7}{3,7}\tbput{$r[n]$}
         \ncline{4,3}{4,4}\ncline{4,4}{4,5}
     \end{dspBlocks}
   \end{figure}
   
   Simply by inspection, we can remark the following facts:
   \begin{enumerate}
     \item $p[n] = ax[n] + x[n-1]$
     \item $q[n] = cx[n] + x[n-1]$
     \item $r[n] = q[n-3]$
     \item $y[n] = bp[n] - r[n]$
   \end{enumerate}
   so that in the end
   \[
     y[n] = abx[n] + bx[n-1] - cx[n-3] -x[n-4]
   \]
 
 \end{solution}
 
 
 \end{document}
diff --git a/teaching/COM303/2017/homework/hw02/hw02.tex b/teaching/COM303/2017/homework/hw02/hw02.tex
new file mode 100644
index 0000000..d01b78b
--- /dev/null
+++ b/teaching/COM303/2017/homework/hw02/hw02.tex
@@ -0,0 +1,127 @@
+\documentclass[12pt,a4paper,fleqn]{article}
+\usepackage{../styles/defsDSPcourse}
+
+
+\title{COM-303 - Signal Processing for Communications}
+\author{Homework \#2}
+\date{}
+
+
+\begin{document}
+\maketitle
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{exercise}{Bases}
+  Let $\{\mathbf{x}^{(k)}\}_{k=0,\ldots,N-1}$ be a basis for a subspace $S$. Prove that any vector $\mathbf{z}\in S$ is \emph{uniquely} represented in this basis.
+  
+  \emph{Hint: remember that the vectors in a basis are linearly independent and use this to prove the thesis by contradiction.}
+\end{exercise}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{exercise}{Plancherel-Parseval Equality}
+  Let $x[n]$ and $y[n]$ be two complex valued sequences and $X[k]$ and $Y[k]$ their corresponding DFTs.
+  \begin{enumerate}
+    \item Show that
+      \[
+        \sum_{n=0}^{N-1} x[n]y^*[n] = \frac{1}{N} \sum_{k=0}^{N-1} X[k]Y^*[k],
+      \]
+      where the superscript $*$ denotes conjugation. 
+    \item What is the physical meaning of the above formula when $x[n]=y[n]$ ?
+  \end{enumerate}
+\end{exercise}
+
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{exercise}{DFT of elementary functions}
+  Derive the formula for the DFT of the length-$N$ signal
+  \[
+    x[n] = \cos((2\pi/N)Ln + \phi).
+  \]
+\end{exercise}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{exercise}{DFT}
+  Consider the length-64 signal $x[n]$ in the figure below, which is the sum of the three 64-periodic signals plotted in the bottom panels of the figure. Compute the DFT coefficients $X[k], k = 0, 1, \ldots, 63$.
+
+  \begin{figure}[h!]
+    \centering 
+   	\begin{dspPlot}[xticks=10,xout=true,yticks=1]{0, 63}{-2.1, 6.1}
+ 			\dspSignal{x 64 div 360 mul 3 mul cos 3 mul
+ 			           x 64 div 360 mul 7 mul sin 
+ 			           2 add add   }
+   	\end{dspPlot}
+   	\begin{tabular}{ccc}
+   	  \begin{dspPlot}[width=3.5cm,height=2cm,xticks=10,xout=true,yticks=1,sidegap=0]{0, 63}{-3.1, 3.1}
+   	   	\dspFunc{x 64 div 360 mul 3 mul cos 3 mul}
+   	  \end{dspPlot}
+   	  &
+   	  \begin{dspPlot}[width=3.5cm,height=2cm,xticks=10,xout=true,yticks=1,sidegap=0]{0, 63}{-3.1, 3.1}
+   	   	\dspFunc{x 64 div 360 mul 7 mul sin}
+   	  \end{dspPlot}
+   	  &
+   	  \begin{dspPlot}[width=3.5cm,height=2cm,xticks=10,xout=true,yticks=1,sidegap=0]{0, 63}{-3.1, 3.1}
+   	   	\dspFunc{2}
+   	  \end{dspPlot}
+   	\end{tabular}
+  \end{figure}
+ 
+\end{exercise}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{exercise}{DFT computation}
+  Compute the 8 DFT coefficients of the signal $\mathbf{x} = \begin{bmatrix} -1 & -1 & 1 & 1 & -1 & -1 & 1 & 1 \end{bmatrix}^T$.
+\end{exercise}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{exercise}{Structure of DFT formulas}
+  The DFT and IDFT formulas are similar, but not identical. Consider a length-$N$ signal $x[n], N = 0, \ldots, N-1$; what is the length-$N$ signal $y[n]$ obtained as
+  \[
+      y[n] = \mbox{DFT}\{\mbox{DFT}\{x[n]\}\}
+  \]
+  (i.e. by applying the DFT algorithm twice in a row)?
+\end{exercise}
+
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{exercise}{Signal repetitions}
+  Consider a length-$N$ signal $\mathbf{x} = [x[0]\, x[1]\, \ldots \, x[N-1]]^T$ and its DFT $\mathbf{X} = [X[0]\, X[1]\, \ldots \, X[N-1]]^T$.
+  
+  Consider now the length-$2N$ vector obtained by duplicating each element of the original vector
+  \[
+    \mathbf{x_2} = [x[0] \quad x[0] \quad x[1] \quad x[1] \quad x[2] \quad x[2] \quad \ldots \quad x[N-1] \quad x[N-1]]^T
+  \]
+  and express its $2N$-point DFT in terms of the $N$ original DFT coefficients $X[k]$.
+\end{exercise}
+
+
+%\begin{exercise}{DFT \& Matlab}
+%\begin{enumerate}
+%\item
+%Consider the signal $x(n)=\cos{(2\pi f_0 n)}$. Draw the DFT of the signal in $N=128$ points without running Matlab, for $f_0=21/128$.
+%
+%\item In Matlab, use the \textit{fft} function to compute and draw the DFT for  $f_0=21/128$ and $f_0=21/127$.
+%Explain the differences that we can see in these two signal spectra. 
+%
+%\item
+%Repeat the drawing in Matlab, this time using the \textit{dftmtx} function and check that
+%the results are the same. What is the preferred option between the two?
+%\end{enumerate}
+%\end{exercise}
+
+
+
+
+\end{document}
diff --git a/teaching/COM303/2017/homework/hw02/sol02.tex b/teaching/COM303/2017/homework/hw02/sol02.tex
new file mode 100644
index 0000000..15250d4
--- /dev/null
+++ b/teaching/COM303/2017/homework/hw02/sol02.tex
@@ -0,0 +1,247 @@
+\documentclass[12pt,a4paper,fleqn]{article}
+
+\usepackage{../styles/defsDSPcourse} 
+
+\title{COM-303 - Signal Processing for Communications}
+\author{Solutions for Homework \#1}
+\date{}
+
+\begin{document}
+\maketitle
+
+
+\begin{solution}{Bases}
+  Suppose by contradiction that the vector $\mathbf{z}\in S$ admits two distinct representations in the basis $\{\mathbf{x}^{(k)}\}_{k=0,\ldots,N-1}$. In other words, suppose that there exist two set of scalars $\alpha_0,\ldots,\alpha_{N-1}$ and $\beta_0,\ldots,\beta_{N-1}$, with $\alpha_i \neq \beta_i$ for all $i$, such that
+  \[
+    \mathbf{z}=\sum_{k=0}^{N-1}\alpha_k\mathbf{x}^{(k)}
+  \]
+  and
+  \[
+    \mathbf{z}=\sum_{k=0}^{N-1}\beta_k\mathbf{x}^{(k)}.
+  \]
+  In this case we can write 
+  \[
+    \sum_{k=0}^{N-1}\alpha_k\mathbf{x}^{(k)}=\sum_{k=0}^{N-1}\beta_k\mathbf{x}^{(k)}
+  \]
+  or, equivalently, 
+  \[
+    \sum_{k=0}^{N-1}(\alpha_k-\beta_k)\mathbf{x}^{(k)}=0.
+  \]
+  The above expression is a linear combination of basis vectors that is equal to zero. Because of the linear independence of a set of basis vector, the only set of coefficients that satisfies the above equation is a set of null coefficients so that it must be $\alpha_i \neq \beta_i$ for all $i$, in contradiction with the hypothesis.
+\end{solution}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{solution}{Plancherel-Parseval Equality}
+
+  \begin{enumerate}
+    \item We expand the sum of the multiplication of DFTs $X[k]$ and $Y[k]$, that is,
+      \begin{align*}
+        \sum_{k=0}^{N-1} (X[k] Y^*[k]) & = \sum_{k=0}^{N-1} \left(\sum_{n=0}^{N-1}  x[n] e^{-j2\pi n k/N} \right) \left(\sum_{m=0}^{N-1}  y[m] e^{-j2\pi m k/N} \right)^*\\
+            &= \sum_{n=0}^{N-1} \sum_{m=0}^{N-1} x[n] y^*[m] \sum_{k=0}^{N-1} e^{-j2\pi (n-m) k/N}.
+      \end{align*}
+      Since 
+      \[
+        \sum_{k=0}^{N-1} e^{-j2\pi (n-m) k/N} = \begin{cases}
+            0 & m\neq n\\
+            N & m= n,
+          \end{cases}
+      \]
+      the result is proved.
+
+    \item Note that, if we consider signals as vectors in $\mathbb{C}^N$, the formula is just the inner product between the vectors. If $x[n]=y[n]$, then $\langle x[n], x[n]\rangle$ corresponds to the energy of the signal in the time domain while $\langle X[k], X[k]\rangle /N$ corresponds to the energy of the signal in the frequency domain. In this case, the Plancherel-Parseval equality illustrates the energy conservation property from the time domain to the frequency domain. This property is also known as the \emph{Parseval theorem}. Note that, because we choose not to normalize the Fourier basis vectors, the energy is conserved up to a scaling factor $N$.
+  \end{enumerate}
+\end{solution}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{solution}{DFT of elementary functions}
+We have:
+\begin{eqnarray*}
+    x[n] & = &  \frac{e^{j\phi}}{2}e^{j(2\pi/N)Ln} + \frac{e^{-j\phi}}{2}e^{-j(2\pi/N)Ln} \\
+        & = & \frac{e^{j\phi}}{2}e^{j(2\pi/N)Ln} + \frac{e^{-j\phi}}{2}e^{-j(2\pi/N)Ln}e^{j(2\pi/N)Nn} \\
+        & = & \frac{e^{j\phi}}{2}e^{j(2\pi/N)Ln} +
+        \frac{e^{-j\phi}}{2}e^{j(2\pi/N)(N-L)n}.
+\end{eqnarray*}
+Therefore, we can write in vector notation:
+\[
+    \mathbf{x} = \frac{e^{j\phi}}{2} \mathbf{w}^{(L)} + \frac{e^{-j\phi}}{2}
+    \mathbf{w}^{(N-L)},
+\]
+and the result follows from the linearity of the expansion formula:
+\begin{eqnarray*}
+    X[k] & = & \langle \mathbf{w}^{(k)},\; \mathbf{x} \rangle \\
+         & = & \left\langle \mathbf{w}^{(k)},\; \frac{e^{j\phi}}{2}\mathbf{w}^{(L)} + \frac{e^{-j\phi}}{2}\mathbf{w}^{(N-L)} \right\rangle
+               = \frac{e^{j\phi}}{2} \langle \mathbf{w}^{(k)},\; \mathbf{w}^{(L)}
+               \rangle + \frac{e^{-j\phi}}{2} \langle \mathbf{w}^{(k)},\; \mathbf{w}^{(N-L)}
+               \rangle 
+\end{eqnarray*}
+Now, if $L \neq N - L$, we have:
+\begin{eqnarray*}
+    X[k] & = & \left\{ \begin{array}{ll} \frac{N}{2}e^{j\phi} & \textrm{if } k=L\\
+         \frac{N}{2}e^{-j\phi} & \textrm{if } k=N-L
+         \\ 0 & \textrm{otherwise.} \end{array}\right.
+\end{eqnarray*}
+Otherwise, if $L = N - L$, we have:
+
+\begin{eqnarray*}
+    X[k]  & = & \left\{ \begin{array}{ll} \frac{N}{2}e^{j\phi} +
+    \frac{N}{2}e^{-j\phi} & \textrm{if } k=L = N - L\\ 
+    0 & \textrm{otherwise.} \end{array}\right.
+\end{eqnarray*}
+\end{solution}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{solution}{DFT computation}
+  There are many ways to solve this problem. A simple method is to observe that we can write $\mathbf{x = a + b}$ with
+  \begin{align*}
+    \mathbf{a} &= \begin{bmatrix} -1 & 0 & 1 & 0 & -1 & 0 & 1 & 0 \end{bmatrix}^T \\
+    \mathbf{b} &= \begin{bmatrix} 0 & -1 & 0 & 1 & 0 & -1 & 0 & 1 \end{bmatrix}^T
+  \end{align*} 
+  which, in signal notation, corresponds to  
+  \begin{align*}
+    a[n] &= \sin((2\pi/8)2n - \pi/2)\\
+    b[n] &= \cos((2\pi/8)2n + \pi/2)
+  \end{align*}
+  
+  Using the result from the previous exercise we have
+  \[
+    A[k] = \begin{cases}
+      -4j e^{j\pi/2} = -4 & k=2 \\
+      4j e^{-j\pi/2} = -4 & k=6 
+      \end{cases}
+  \]
+  and
+  \[
+    B[k] = \begin{cases}
+      4 e^{j\pi/2} = 4j & k=2 \\
+      4 e^{-j\pi/2} = -4j & k=6 
+      \end{cases}
+  \]
+  so that
+  \[
+    \mathbf{X} = \begin{bmatrix} 0 & 4(-1+j) & 0 & 0 & 0 & 0 & 4(-1-j) & 0 \end{bmatrix}^T
+  \]
+\end{solution}
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{solution}{DFT Example}
+  By simple visual inspection we can determine that
+  \begin{eqnarray*}
+      a[n] & = & 2 \\
+      b[n] & = & 3\cos(3(2\pi/64)n) \\
+      c[n] & = & \sin(7(2\pi/64)n) = - \cos(7(2\pi/64)n+\pi/2).
+  \end{eqnarray*}
+  
+  The DFT coefficients are $X[k] = A[k] + B[k] + C[k]$, with
+  \begin{eqnarray*}
+      A[k] & = & 2N\delta[k] \\
+      B[k] & = & (3N/2)\delta[k-3] + (3N/2)\delta[k-61] \\
+      C[k] & = & -(jN/2)\delta[k-7] + (jN/2)\delta[k-57]
+  \end{eqnarray*}
+  and $N = 64$, so that in the end we have
+  \begin{eqnarray*}
+      X[0] & = & 128  \\
+      X[3] & = & 96  \\
+      X[7] & = & -32j \\
+      X[57] & = & 32j \\
+      X[61] & = & 96
+  \end{eqnarray*}
+  and $X[k] = 0$ for all the other values of $k$.
+\end{solution}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{solution}{Structure of DFT formulas}
+  Let $f[n] = \mbox{DFT}\{x[n]\}$. We have:
+  \begin{eqnarray*}
+    y[n] & = & \sum_{k=0}^{N-1} f[k]e^{-j\frac{2\pi}{N}nk} \\
+         & = & \sum_{k=0}^{N-1} \biggr\{ \sum_{i=0}^{N-1} x[i]e^{-j\frac{2\pi}{N}ik} \biggl\} e^{-j\frac{2\pi}{N}nk} \\
+         & = & \sum_{i=0}^{N-1} x[i] \sum_{k=0}^{N-1} e^{-j\frac{2\pi}{N}(i+n)k}.
+  \end{eqnarray*}
+  Now,
+  \[
+    \sum_{k=0}^{N-1} e^{-j\frac{2\pi}{N}(i+n)k} = \left\{
+      \begin{array}{ll}
+        N & \mbox{for } (i+n) = 0, N, 2N, 3N, \ldots \\
+        0 & \mbox{otherwise}
+      \end{array}
+      \right. = N\delta[(i+n) \mod N]
+  \]
+  so that
+  \begin{eqnarray*}
+    y[n] & = & \sum_{i=0}^{N-1}x[i]N\delta[(i+n) \mod N]\\
+         & = & \left\{
+          \begin{array}{ll}
+            Nx[0] & \mbox{for } n = 0\\
+            Nx[N-n] & \mbox{otherwise}.
+          \end{array}
+          \right.
+  \end{eqnarray*}
+  In other words, if $\mathbf{x}=[1\; 2\; 3\; 4\; 5]^T$ then $\mbox{DFT}\{\mbox{DFT}\{\mathbf{x}\}\} = 5[1\; 5\; 4\; 3\; 2]^T =  [5\; 25\; 20\; 15\; 10]^T$.
+\end{solution}
+
+
+
+
+%\begin{solution}{DFT \& Matlab}
+%\begin{enumerate}
+%
+%\item The signal after DFT should only have two peaks, which corresponds the $21$-st DFT coefficient and the $107$-th DFT coefficient.
+%
+%\item
+%The spectrum of the signal $x[n]$, for both frequencies, is given
+%in the following figure that is obtained using the Matlab commands
+%given below.
+%\begin{verbatim}
+%    >> N=128;fo1=21/128;fo2=21/127;
+%    >> n=0:N-1;
+%    >> x1=cos(2*pi*fo1*n);x2=cos(2*pi*fo2*n);
+%    >> X1=fft(x1);X2=fft(x2);
+%    >> subplot(223),stem(n-N/2,fftshift(abs(X1)))
+%    >> subplot(224),stem(n-N/2,fftshift(abs(X2)))
+%\end{verbatim}
+%\begin{center}
+%\includegraphics[width=12cm,height=4cm]{ex5.eps}
+%\end{center}
+%Since we take the cosine wave example, we expect to see just one
+%sample at the frequency of the signal. This is the case in the
+%left figure, where we have the DFT signal spectrum for the signal
+%with $f_0=21/128$, and the $21$st DFT coefficient represents the
+%exact signal frequency. However, in the right figure, the
+%frequency of the signal $f_0=21/127$ does not coincide with any
+%DFT frequency component. The signal energy is spread over each of
+%the DFT components. This is called frequency leakage. Therefore,
+%we can conclude that if the signal period exactly fits the
+%measurement time (number of samples), the frequency spectrum is
+%correct, while if the period does not match the measurement time,
+%the frequency spectrum is incorrect - it is broadened.
+%
+%\item
+%We can achieve the same results using the \textit{dftmtx} function instead, as
+%illustrated below.
+%\begin{verbatim}
+%    >> W=dftmtx(N);
+%    >> X3=W*x1;X4=W*x2;
+%    >> norm(X1-X3)
+%    >> norm(X2-X4)
+%    >> subplot(223),stem(n-N/2,fftshift(abs(X3)))
+%    >> subplot(224),stem(n-N/2,fftshift(abs(X4)))
+%\end{verbatim}
+%In practice, however, the discrete Fourier transform is computed more
+%efficiently and uses less memory with an FFT algorithm than by using the Fourier transform matrix.
+%\end{enumerate}
+%\end{solution}
+
+
+
+
+
+\end{document}