Page MenuHomec4science

PracticeHW2.tex
No OneTemporary

File Metadata

Created
Thu, Mar 13, 10:37

PracticeHW2.tex

\documentclass[a4paper,fleqn]{article}
\usepackage{dspTricks}
\usepackage{dspFunctions}
\usepackage{dspBlocks}
\usepackage{comment}
\usepackage{pst-plot}
\usepackage{enumitem}
\usepackage{styles/EPFLexercises}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% OUPUT SELECTOR
\newif\ifexercises
\newif\ifanswers
%% choose one
\exercisestrue\answersfalse % only exercises
%\exercisesfalse\answerstrue % only solutions
\exercisestrue\answerstrue % both
\begin{document}
\newcounter{tmpc}
\includegraphics[height=0.04\paperwidth]{styles/dspBanner.eps}
\hfill
\includegraphics[height=0.04\paperwidth]{styles/epfl.ps}
\vspace{2em}
\begin{center}%
\sffamily{\LARGE \bfseries DSP2 -- Practice Homework \ifanswers{\\ \vspace{1ex} Solutions}\fi} \\
\vspace{1em}
\end{center}
\centerline{\rule{\textwidth}{.5pt}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{LTI systems.}
Consider the transformation $\mathcal{H}\{\mathbf x\}[n] = nx[n]$. Does $\mathcal{H}$ define an LTI system?
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The system is not time-invariant. To see this consider the following signals
\begin{eqnarray*}
x[n] &=& \delta[n] \\
y[n] &=& \delta[n-1]
\end{eqnarray*}
We have $\mathcal{H}\{\mathbf{x}\} = \mathbf{0}$. Clearly, it is $y[n]= x[n-1]$ but
\[
\mathcal{H}\{\mathbf{y}\}[n] = \delta[n-1] \neq 0.
\]
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Convolution.}
Let $x[n]$ be a discrete-time sequence defined as
\[
x[n] = \left\{
\begin{array}{ll}
M-n & 0\leq n\leq M, \\
M+n & -M\leq n\leq 0, \\
0 & \mbox{otherwise}.
\end{array}
\right.
\]
for some odd integer $M$.
\begin{enumerate}
\item Show that $x[n]$ can be expressed as the convolution of two discrete-time sequences $x_1[n]$ and $x_2[n]$.
\item Using the results found in (a), compute the DTFT of $x[n]$.
\end{enumerate}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
\begin{enumerate}
\item $x[n]$ can be written as the convolution of $x_1[n]$ and $x_2[n]$ defined as
\begin{align*}
x_1[n] &= x_2[n] = \left\{
\begin{array}{ll}
1 & -(M-1)/2\leq n\leq(M-1)/2 \\
0 & \mbox{otherwise}.
\end{array}
\right.\\
&=u[n+(M-1)/2]-u[n-(M+1)/2].
\end{align*}
Then,
\begin{align*}
x_1[n]*x_2[n] &= \Sigma_k x_1[k]x_2[n-k]\\
&\stackrel{(1)}{=} \Sigma_k x_1[k]x_1[k-n] \\
&\stackrel{(2)}{=} x[n]
\end{align*}
(1) follows from the fact that $x_1[n]=x_2[n]$ and the symmetry of $x_1[n]$. (2) follows by noticing that the sum corresponds to
the size of the overlapping area between $x_1[k]$ and its $n$-shifted version $x_1[k-n]$.
\item The DTFT of $x_1[n]$ can be easily computed directly using the DTFT formula which, in this case, is a combination of simple geometric sums:
\[
X_1(e^{j\omega}) = \sum_{n = -(M-1)/2}^{0} e^{j\omega n} - 1 + \sum_{n=0}{(M-1)/2} e^{j\omega n}.
\]
Alternatively, we can use the DTFT of the shifted step sequences $u[n]$:
\begin{align*}
X_1(e^{j\omega}) &\stackrel{(1)}{=} \left(\frac{1}{1-e^{-j\omega}} + \frac{1}{2}\tilde{\delta}(\omega)\right)\left(e^{j\omega(M-1)/2}-e^{-j\omega(M+1)/2}\right) \\
&\stackrel{(2)}{=} \frac{e^{j\omega(M-1)/2}-e^{-j\omega(M+1)/2}}{1-e^{-j\omega}}
= \frac{e^{-j\omega/2}(e^{j\omega M/2}-e^{-j\omega M/2})}{e^{-j\omega/2}(e^{j\omega/2}-e^{-j\omega/2})}\\
&= \frac{\sin(\omega M/2)}{\sin(\omega/2)}
\end{align*}
(1) follows from the DTFT of $u[n]$ (2) follows from $e^{j\omega(M-1)/2}\tilde{\delta}(\omega)=e^{-j\omega(M+1)/2}\tilde{\delta}(\omega)=\tilde{\delta}(\omega).$
Finally, using the convolution theorem, we can write
\begin{align*}
X(e^{j\omega}) &= X_1(e^{j\omega})X_2(e^{j\omega}) \\
&= X_1(e^{j\omega})X_1(e^{j\omega}) \\
&= \left(\frac{sin(\omega M/2)}{sin(\omega/2)}\right)^2.
\end{align*}
\end{enumerate}
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Impulse response.}
Consider a system whose impulse response is shown below. Determine and carefully sketch the response of this system to the input $x[n] = u[n-4]$.
\begin{center}
\begin{dspPlot}[height=3cm,xticks=2,yticks=1]{-10,10}{-3, 3}
\dspTapsAt{-10}{0 0 0 0 0 0 0 0 0 0 1 1 1 1 -2 -2 0 0 0 0 0}
\end{dspPlot}
\end{center}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
\begin{center}
\begin{dspPlot}[height=3cm,xticks=2,yticks=1]{-10,10}{-5, 5}
\dspTapsAt{-10}{0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 2 0 0}
\end{dspPlot}
\end{center}
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Series/Parallel.}
Calculate the impulse response of the system shown below given that the impulse responses of the processing blocks are
\begin{itemize}
\item $h_1[n] = 3 (-1)^n (\frac{1}{4})^n u[n - 2]$
\item $h_2[n] = h_3[n] = u[n + 2]$
\item $h_4[n] = \delta[n - 1]$
\end{itemize}
Also determine the causality of the system and its BIBO stability.
\begin{center}
\begin{dspBlocks}{0.8}{0.1}
& & & \BDfilter{$\mathcal{H}_2$} & & & \\%
$x[n]$~~~~ & \BDfilter{$\mathcal{H}_1$} & \BDsplit & & & \BDadd & ~~~~~$y[n]$ \\%
& & & \BDfilter{$\mathcal{H}_3$} & \BDfilter{$\mathcal{H}_4$} & & \\%
\psset{arrows=->,linewidth=1.5pt}
\ncline{2,1}{2,2} \ncline{-}{2,2}{2,3}
\ncline{-}{1,3}{3,3}
\ncline{1,3}{1,4} \ncline{3,3}{3,4}
\ncline{3,4}{3,5}\ncline{-}{3,5}{3,6}
\ncline{-}{1,4}{1,6}
\ncline{1,6}{2,6}
\ncline{3,6}{2,6} \ncline{2,6}{2,7}
\end{dspBlocks}
\end{center}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
We have
\begin{eqnarray*}
h[n] & = & h_1[n] * (h_2[n] - h_3[n] * h_4[n]) \\
& = & h_1[n]*(u[n+2] - u[n+2]*\delta[n - 1]) \\
& = & h_1[n]*(u[n+2] - u[n+1]) \\
& = & h_1[n]*\delta[n+2] \\
& = & h_1[n+2] \\
& = & 3 (-1)^n (\frac{1}{4})^{n + 2} u[n].
\end{eqnarray*}
A discrete system is BIBO stable if the impulse response is absolutely summable. We have
\begin{eqnarray*}
\displaystyle\sum\limits_{n=-\infty}^\infty \vert h[n] \vert = 3\frac{1}{1 - 1/4}-3\left(1+\frac{1}{4}\right) = \frac{1}{4},
\end{eqnarray*}
which means the system is BIBO stable. The system is causal because $h[n] = 0$ for $n<0$.
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{System properties.}
For each of the input-output relationships listed below, determine if the corresponding transformation is linear, time-invariant, BIBO stable and causal. For LTI transformations, characterize the corresponding systems by their impulse response.
\begin{enumerate}
\item $\mathcal{H}_1\{\mathbf x\}[n] = x[-n]$,
\item $\mathcal{H}_2\{\mathbf x\}[n] = e^{-j\omega n} x[n]$,
\item $\mathcal{H}_3\{\mathbf x\}[n] = \displaystyle \sum_{k=n-L}^{n+L}x[k]$,
\end{enumerate}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
\begin{enumerate}
\item
\begin{itemize}
\item $\mathcal{H}_1$ is linear:
\[
\mathcal{H}_1\{a \mathbf{x}_1 + b\mathbf{x}_2\}[n] = a x_1[-n] + b x_2[-n] = a \mathcal{H}_1\{\mathbf{x}_1\}[n] + b\mathcal{H}_1\{\mathbf{x}_2\}[n].
\]
\item $\mathcal{H}_1$ is NOT time invariant: set $d[n] = x[n-N]$; then
\[
\mathcal{H}_1\{\mathbf{d}\}[n] = d[-n] = x[-n-N] \neq \mathcal{H}_1\{\mathbf{x}\}[n-N] = x[-n + N].
\]
\item$\mathcal{H}_1$ is BIBO stable:
\[
|x[n]| \leq M\Rightarrow |\mathcal{H}_1\{\mathbf x\}[n] | \leq M.
\]
\item$\mathcal{H}_1$ is not causal since producing the output for negative values of the index requires knowledge of the values of the input in the future.
\item$\mathcal{H}_1$ is not LTI and therefore it cannot be characterized by an impulse response.
\end{itemize}
\item
\begin{itemize}
\item $\mathcal{H}_2$ is linear:
\[
\mathcal{H}_2\{a \mathbf{x}_1 + b\mathbf{x}_2\}[n] = e^{-j\omega n}(a x_1[n] + b x_2[n])= a \mathcal{H}_2\{\mathbf{x}_1\}[n] + b\mathcal{H}_2\{\mathbf{x}_2\}[n].
\]
\item$\mathcal{H}$ is NOT time invariant (except in the trivial case $\omega=0$): set $d[n] = x[n-N]$; then
\[
\mathcal{H}_2\{\mathbf{d}\}[n] = e^{-j\omega n} d[n] = e^{-j\omega n} x[n-N] \neq \mathcal{H}_2\{\mathbf{x}\}[n-N] = e^{j\omega N} e^{-j\omega n} x[n-N].
\]
\item $\mathcal{H}$ is BIBO stable:
\[
|x[n]| \leq M \Rightarrow |\mathcal{H}_2\{\mathbf x\}[n]| = |x[n]| \leq M.
\]
\item $\mathcal{H}_2$ is a memoryless transformation of the input and therefore it can be considered causal.
\item $\mathcal{H}_2$ is not LTI and therefore it cannot be characterized by an impulse response.
\end{itemize}
\item
\begin{itemize}
\item$\mathcal{H}_3$ is linear:
\[
\mathcal{H}_3\{a \mathbf{x}_1 + b \mathbf{x}_2\}[n] = \sum_{k=n-L}^{n+L}(a x_1[k] + b x_2[k]) = a \mathcal{H}_3\{\mathbf{x}_1\}[n] + b\mathcal{H}_3\{\mathbf{x}_2\}[n].
\]
\item$\mathcal{H}$ is time invariant: set $d[n] = x[n-N]$; then
\[
\mathcal{H}_3\{\mathbf d\}[n] = \sum_{k=n-L}^{n+L} d[k] = \sum_{k=n-L}^{n+L} x[k-N] = \sum_{k=(n-N)-L}^{(n-N)+L} x[k] = \mathcal{H}_3\{\mathbf x\}[n - N].
\]
\item $\mathcal{H}$ is BIBO stable:
\[
|x[n]| \leq M \Rightarrow \mathcal{H}_3\{x\}[n] \leq |2L + 1|M.
\]
\item $\mathcal{H}$ is not causal.
\item The system impulse response is
\begin{align*}
h[n]= \begin{cases}
1 & \text{if }|n|\leq |n_0|, \\
0 & \text{otherwise}.
\end{cases}
\end{align*}
\end{itemize}
\end{enumerate}
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Zero phase filtering.}
Let $\mathcal{R}$ be the time reversal operator for sequences so that
\[
\mathcal{R}\{\mathbf{x}\}[n] = x[-n]
\]
Let $\mathcal{H}$ be a linear time invariant system with a real-valued impulse response. What are the properties of a system implementing the
following transformation, assuming that the input signal $\mathbf{x}$ is real-valued?
\[
\mathcal{R}\{\mathcal{H}\{\mathcal{R}\{\mathcal{H}\{\mathbf x\}\}\}\}
\]
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
Let $X(e^{j\omega})$ be the DTFT of the sequence $\mathbf{x}$ and let $H(e^{j\omega})$ be the frequency response of the filter. Since both impulse response and signal are real, their DTFT are Hermitian-symmetric, i.e., $X(e^{j\omega}) = X^*(e^{-j\omega})$.
By the time reversal property of the DTFT, the DTFT of $x[-n]$ is $X(e^{-j\omega})$ which, because of the Hermitian symmetry, is also equal to $X^*(e^{j\omega})$. With this, we can write the following list of time-frequency correspondences
\begin{align*}
\mathcal{H}\{\mathbf{x}\} &\stackrel{\mbox{DTFT}}{\longleftrightarrow} H(e^{j\omega})X(e^{j\omega})\\
\mathcal{R}\{\mathcal{H}\{\mathbf{x}\}\} &\stackrel{\mbox{DTFT}}{\longleftrightarrow} H^*(e^{j\omega})X^*(e^{j\omega})\\
\mathcal{H}\{\mathcal{R}\{\mathcal{H}\{\mathbf{x}\}\}\} &\stackrel{\mbox{DTFT}}{\longleftrightarrow} H(e^{j\omega})H^*(e^{j\omega})X^*(e^{j\omega})\\
\mathcal{R}\{\mathcal{H}\{\mathcal{R}\{\mathcal{H}\{\mathbf{x}\}\}\} &\stackrel{\mbox{DTFT}}{\longleftrightarrow} H^*(e^{j\omega})H(e^{j\omega})X(e^{j\omega}) = |H(e^{j\omega})|^2 X(e^{j\omega})
\end{align*}
Therefore the chain of operators implements an LTI system with zero phase delay and magnitude response equal to the squared magnitude response of the original filter.
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Pole-zero plot and stability}
Consider a causal LTI system with the following transfer function
\[
H(z)=\frac{3+4.5z^{-1}}{1+ 1.5z^{-1}} - \frac{2}{1-0.5z^{-1}}
\]
Sketch the pole-zero plot of the transfer function and specify its region of convergence. Is the system stable?
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
To investigate the stability of the system, let's compute the overall transfer function and eliminate possible common factors; factorization in first-order terms yields
\[
H(z) = \frac{3+4.5z^{-1}}{1+ 1.5z^{-1}} - \frac{2}{1-0.5z^{-1}}=\frac{(z-1.5)(z+1.5)}{(z-0.5)(z+1.5)}
\]
We can see that the zeros of this system are in $z_{01}=1.5$ and $z_{02}=-1.5$ and the poles in $z_{p1}=0.5$ and $z_{p2}=-1.5$. From a theoretical point of view the zero in $z_{01}=-1.5$ cancels out the pole in $z_{p2}=-1.5$ and we obtain the following ROC, extending outwards from $z=0.5$ and including the unit circle, so that the system is stable:
\begin{center}
\begin{dspPZPlot}[roc=0.5]{2.5}
\dspPZ[label=none]{0.5,0}
\dspPZ[label=none,type=zero]{1.5,0}
\end{dspPZPlot}
\end{center}
In other words, the second subsystem in the cascade has stabilized the overall processing function by canceling the zero in the first subsystem.
Note however that, in practice, the stabilization of a system with this technique is a risky enterprise since the exact cancellation of the pole outside the unit circle will be extremely sensitive to numerical precision issues. If the coefficients of the filter (or the internal accumulators) are subject to truncation or rounding, the implicit position of the zero may drift ever so slightly from the implicit position of the pole and the system will no longer be stable.
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Stability.}
Consider a causal discrete system represented by the following
difference equation
\[
y[n]-3.25y[n-1]+0.75y[n-2]=x[n-1]+3x[n-2].
\]
\begin{enumerate}
\item Compute the transfer function and check the stability of this system.
\item If the input signal is $x[n]=\delta[n]-3\delta[n-1]$, compute the $z$-transform of the output signal and discuss the stability result you found before.
\item Consider now the input signal $x[n]=\delta[n]-0.25\delta[n-1]$; assume the filter is implemented in fixed-precision arithmetic and that the the processing unit can only handle numbers in the range [-1024, 1024]. Starting processing for $n=0$, how many samples can we process before we hit overflow or underflow?
\end{enumerate}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
\begin{enumerate}
\item By taking the $z$-transform of the CCDE we have
\[
Y(z)(1-3.25z^{-1}+0.75z^{-2})=X(z)(z^{-1}+3z^{-2}),\nonumber
\]
from which we obtain the transfer function
\begin{align*}
H(z) &= \frac{Y(z)}{X(z)} = \frac{z^{-1}+3z^{-2}}{1-3.25z^{-1}+0.75z^{-2}} \\
&=\frac{z^{-1}(1+3z^{-1})}{(1-0.25z^{-1})(1-3z^{-1})}.
\end{align*}
Since the system is causal, the region of convergence is $|z|>3$. This does not include the unit circle and therefore the system is unstable.
\item The $z$-transform of the output signal is
\begin{align*}
Y(z) &= H(z)X(z) = \frac{z^{-1}(1+3z^{-1})}{(1-0.25z^{-1})(1-3z^{-1})}(1-3z^{-1})\\
&= \frac{z^{-1}+3z^{-2}}{1-0.25z^{-1}}.
\end{align*}
The ROC for $Y(z)$ is $|z| > 0.25$, which includes the unit circle. This implies that $y[n]$ has a well-defined DTFT and therefore is finite-energy. What's happening is that the input signal has a spectral null exactly at the location of the pole of the system. Since in this case no energy ``excites'' the system pole, the output is a stable singal.
\item The $z$-transform of the output signal is
\[
Y(z) = H(z)X(z) = \frac{z^{-1}+3z^{-2}}{1-3z^{-1}} = z^{-1}\frac{1}{1-3z^{-1}} + 3z^{-2} \frac{1}{1-3z^{-1}}
\]
Since we know that
\[
\mathcal{Z}\left\{3^n u[n]\right\} = \frac{1}{1-3z^{-1}}
\]
we can easily invert $Y(z)$ to obtain
\[
y[n] = 3^{n-1}u[n-1] + 3^{n-1} u[n-2] = \begin{cases}
0 & n < 1 \\
1 & n = 1 \\
2 \cdot 3^{n-1} & n \ge 2.
\end{cases}
\]
It appears that the input is monotonically increasing and, to see when we reach overflow, we need to find the first value of $n$ for which
\[
2 \cdot 3^{n-1} > 1000
\]
which yields $n = 6$.
\end{enumerate}
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Properties of the z-transform.}
Let $x[n]$ be a discrete-time sequence and $X(z)$ its corresponding $z$-transform with appropriate ROC.
\begin{enumerate}
\item Prove that the following relation holds:
\[
nx[n] \stackrel{Z}{\longleftrightarrow} -z\frac{d}{dz}X(z).
\]
\item Show that
\[
(n+1)\alpha^{n}u[n] \stackrel{Z}{\longleftrightarrow} \frac{1}{(1-\alpha z^{-1})^2}, \qquad |z|>|\alpha|. %
\]
\item Suppose that the above expression corresponds to the impulse response of an LTI system. What can you say about the causality of such a system? About its stability?
\item Let $\alpha=0.8$, what is the spectral behavior of the corresponding filter? What if $\alpha=-0.8$?
\end{enumerate}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
\begin{enumerate}
\item Let $X(z)=\Sigma_n x[n]z^{-n}$. We have that
\begin{align*}
\frac{d}{dz}X(z) &= \frac{d}{dz}\left(\Sigma_n x[n]z^{-n}\right) \\
&= \Sigma_n (-n)x[n]z^{-n-1} \\
&= -z^{-1}\Sigma_n nx[n]z^{-n}
\end{align*}
and the relation follows directly.
\item We have that
\[
\alpha^n u[n] \stackrel{Z}{\longleftrightarrow} \frac{1}{1-\alpha z^{-1}}. %
\]
Using the previous result, we find
\[
n\alpha^n u[n] \stackrel{Z}{\longleftrightarrow} - z\frac{d}{dz}\left(\frac{1}{1-\alpha z^{-1}}\right) = \frac{\alpha z^{-1}}{(1-\alpha z^{-1})^2}.
\]
Thus,
\[
(n+1)\alpha^{n+1}u[n+1] \stackrel{Z}{\longleftrightarrow} z\frac{\alpha z^{-1}}{(1-\alpha z^{-1})^2}
\]
and
\[
(n+1)\alpha^{n}u[n+1] \stackrel{Z}{\longleftrightarrow} \frac{1}{(1-\alpha z^{-1})^2}. %
\]
The relation follows by noticing that
\[
(n+1)\alpha^{n}u[n+1]=(n+1)\alpha^{n}u[n]
\]
since when $n=-1$ both sides are equal to zero.
\item The system is causal since the ROC corresponds to the outside of a circle of radius $\alpha$ (or equivalently since the impulse response is zero when $n<0$). The system is stable when the unit circle lies inside the ROC, i.e.\ when $|\alpha|\leq1$.
\item When $\alpha=0.8$, the angular frequency of the pole is $\omega=0$. Thus the filter is lowpass. When $\alpha=-0.8$, $\omega=\pi$ and the filter is highpass.
\end{enumerate}
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Interleaving sequences.}
Consider two two-sided sequences $h[n]$ and $g[n]$ and consider a third sequence $x[n]$ which is built by interleaving the values of $h[n]$ and $g[n]$:
\[
x[n] = \ldots, h[-3], g[-3], h[-2], g[-2], h[-1], g[-1], h[0], g[0], h[1], g[1], h[2], g[2], h[3], g[3], \ldots
\]
with $x[0] = h[0]$.
\begin{enumerate}
\item Express the $z$-transform of $x[n]$ in terms of the $z$-transforms of $h[n]$ and $g[n]$.
\item Assume that the ROC of $H(z)$ is $0.64 < |z| <4$ and that the ROC of $G(z)$ is $0.25 < |z| <9$. What is the ROC of $X(z)$?
\end{enumerate}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
\begin{enumerate}
\item We have that:
\begin{eqnarray*}
X(z) &=& \sum_{n=-\infty}^{\infty} h[n]z^{-2n} + g[n]z^{-(2n+1)}\\
&=& H(z^2) + z^{-1}G(z^2)
\end{eqnarray*}
\item The ROC is determined by the poles of the transform. Since the sequence is two sided, the ROC is a ring bounded by two poles $z_L$ and $z_R$ such that $|z_L| < |z_R|$ and no other pole has magnitude between $|z_L|$ and $|z_R|$. Consider $H(z)$; if $z_0$ is a pole of $H(z)$, $H(z^2)$ will have two poles at $\pm z_0^{1/2}$; however, the square root preserves the monotonicity of the magnitude and therefore no new poles will appear between the circles $|z| = \sqrt{|z_L|}$ and $|z| = \sqrt{|z_R|}$. Therefore the ROC for $H(z^2)$ is the ring $\sqrt{|z_L|} < |z| < \sqrt{|z_R|}$. The ROC of the sum $H(z^2) + z^{-1}G(z^2)$ is the intersection of the ROCs, and so
\[
\mbox{ROC } = 0.8 < |z| < 2.
\]
\end{enumerate}
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Transfer function, poles, and zeros}
The figures below show the zeros and poles of three different filters with the unit circle for reference. Each zero is represented with a 'o' and each pole with a 'x' on the plot. Multiple zeros and poles are indicated by the multiplicity number shown to the upper right of the zero or pole.Sketch the magnitude of each frequency response and determine the type of filter.
\begin{tabular}{ccc}
% [b, a] = butter(3, .1)
\begin{dspPZPlot}[]{1.5}
\dspPZ[label=none]{0.8238, 0.2318}
\dspPZ[label=none]{0.8238, -0.2318}
\dspPZ[label=none]{0.7265, 0}
\dspPZ[label=3,type=zero]{-1,0}
\end{dspPZPlot}
&
\begin{dspPZPlot}[]{1.5}
% butter(3, .8, 'high')
\dspPZ[label=none]{-0.6253, 0.3934}
\dspPZ[label=none]{-0.6253, -0.3934}
\dspPZ[label=none]{-0.5095, 0}
\dspPZ[label=3,type=zero]{1,0}
\end{dspPZPlot}
&
\begin{dspPZPlot}[]{1.5}
% [b, a] = butter(3, [.1 .8], 'stop')
\dspPZ[label=none]{0.8238, 0.2318}
\dspPZ[label=none]{0.8238, -0.2318}
\dspPZ[label=none]{0.7265, 0}
\dspPZ[label=none]{-0.6253, 0.3934}
\dspPZ[label=none]{-0.6253, -0.3934}
\dspPZ[label=none]{-0.5095, 0}
\dspPZ[label=3,type=zero]{0.3446, 0.9388}
\dspPZ[label=3,type=zero]{0.3446, -0.9388}
\end{dspPZPlot}
\\
(a) & (b) & (c)
\end{tabular}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
To obtain the frequency response of a filter, we analyze the $z$-transform on the unit circle, that is, in $z=e^{j\omega}$. the following figures shows the exact magnitude of each frequency response.
\begin{center}
\begin{dspPlot}[xtype=freq,xlabel={(a)}]{-1,1}{0,1.3}
\dspFunc{x \dspTFM{ 0.0029 0.0087 0.0087 0.0029}{ 1.0000 -2.3741 1.9294 -0.5321}}
\end{dspPlot}
\begin{dspPlot}[xtype=freq,xlabel={(b)}]{-1,1}{0,1.3}
\dspFunc{x \dspTFM{ 0.0181 -0.0543 0.0543 -0.0181}{ 1.0000 1.7600 1.1829 0.2781}}
\end{dspPlot}
\begin{dspPlot}[xtype=freq,xlabel={(c)}]{-1,1}{0,1.3}
\dspFunc{x \dspTFM{ 0.0495 -0.1024 0.2192 -0.2210 0.2192 -0.1024 0.0495}{ 1.0000 -0.6334 -0.9990 0.3049 0.6742 -0.0974 -0.1378}}
\end{dspPlot}
\end{center}
\vspace{1em}
The first filter is a low-pass filter. Note that there are three poles located in low frequency (near $\omega=0$), while
there is a zero located in high frequency ($\omega=\pi$). The second filter is just the opposite. The zero is located in
low frequency, while the influence of the three poles is maximum
in high frequency ($\omega=\pi$). Therefore, it is a high-pass
filter. In the third system, there are poles which affect low and high
frequency and two zeros close to $w=\pi/2$. Therefore, this system
is a stop-band filter. Incidentally, these are all Butterworth filters; this can be determined considering that
\begin{itemize}
\item they are IIR filters (they contain poles)
\item they have monotonic frequency responses (i.e. no oscillations). Butterworth filters are the only filters that exhibit this property.
\end{itemize}
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Denoising.}
Consider the signal $x[n] = \sin(\omega_0 n) + s[n]$ where $\omega_0 = 2\pi/50$ and $s[n]$ is a zero-mean, Gaussian white noise sequence with power spectral density $P_s(e^{j\omega}) = \sigma^2 = 10^{-2}$. A realization of the signal is plotted in the following figure:
\begin{center}
\begin{dspPlot}[xticks=25,xout=true,sidegap=0,height=3cm]{0,200}{-2,2}
\dspFuncData[linecolor=blue!60]{0 0.053 1 0.099 2 0.309 3 0.428 4 0.263 5 0.455 6 0.540 7 0.811 8 0.991 9 0.872 10 1.032 11 1.037 12 0.893 13 1.038 14 0.907 15 1.103 16 0.902 17 1.008 18 0.728 19 0.743 20 0.582 21 0.280 22 0.270 23 0.310 24 0.120 25 -0.112 26 -0.188 27 -0.224 28 -0.467 29 -0.384 30 -0.652 31 -0.504 32 -0.878 33 -0.824 34 -1.057 35 -1.023 36 -1.042 37 -0.958 38 -0.904 39 -0.952 40 -0.988 41 -0.823 42 -0.764 43 -0.758 44 -0.627 45 -0.547 46 -0.580 47 -0.292 48 -0.314 49 -0.186 50 0.018 51 0.095 52 0.236 53 0.428 54 0.586 55 0.568 56 0.717 57 0.747 58 0.867 59 0.949 60 0.889 61 1.010 62 1.058 63 1.007 64 1.155 65 0.890 66 0.831 67 0.669 68 0.862 69 0.771 70 0.580 71 0.572 72 0.386 73 0.278 74 0.137 75 0.044 76 -0.115 77 0.030 78 -0.485 79 -0.667 80 -0.702 81 -0.794 82 -0.814 83 -0.861 84 -0.927 85 -0.897 86 -0.943 87 -0.923 88 -0.820 89 -0.860 90 -1.079 91 -1.138 92 -0.754 93 -0.954 94 -0.678 95 -0.584 96 -0.259 97 -0.375 98 -0.299 99 -0.102 100 0.025 101 0.132 102 0.188 103 0.246 104 0.513 105 0.453 106 0.581 107 0.904 108 0.802 109 0.891 110 1.041 111 0.952 112 1.101 113 0.964 114 1.084 115 1.014 116 0.884 117 0.758 118 0.666 119 0.658 120 0.544 121 0.441 122 0.466 123 0.219 124 0.240 125 -0.053 126 -0.028 127 -0.301 128 -0.350 129 -0.385 130 -0.629 131 -0.728 132 -0.570 133 -0.749 134 -0.948 135 -0.886 136 -1.018 137 -0.927 138 -0.856 139 -1.143 140 -0.848 141 -0.759 142 -0.840 143 -0.596 144 -0.669 145 -0.711 146 -0.701 147 -0.401 148 -0.177 149 -0.094 150 0.041 151 0.068 152 0.263 153 0.204 154 0.406 155 0.506 156 0.737 157 0.769 158 0.729 159 0.904 160 0.882 161 0.916 162 1.084 163 1.009 164 1.022 165 1.039 166 0.923 167 0.899 168 0.839 169 0.802 170 0.635 171 0.623 172 0.370 173 0.244 174 0.295 175 -0.051 176 -0.126 177 -0.157 178 -0.353 179 -0.341 180 -0.484 181 -0.655 182 -0.848 183 -0.788 184 -1.043 185 -0.927 186 -0.901 187 -0.977 188 -0.910 189 -0.778 190 -0.859 191 -0.878 192 -0.780 193 -0.728 194 -0.816 195 -0.629 196 -0.359 197 -0.372 198 -0.190 199 -0.226 200 0}
\end{dspPlot}
\end{center}
The signal is filtered with a stable, real-valued, causal LTI system whose frequency response satisfies $|H(e^{j\omega})| \le 1$ for all frequencies. For each of the following plots, explain if the signal in the plot could be the result of filtering $x[n]$ with $H(e^{j\omega})$; explain your answers in detail.
\begin{center}
\begin{dspPlot}[xticks=25,xout=true,sidegap=0,height=3cm]{0,200}{-2,2}
\dspText(-20,0){(a)}
\dspFuncData[linecolor=blue!60]{0 0.053 1 0.130 2 0.369 3 0.513 4 0.369 5 0.574 6 0.665 7 0.931 8 1.098 9 0.955 10 1.081 11 1.042 12 0.846 13 0.931 14 0.734 15 0.859 16 0.585 17 0.618 18 0.267 19 0.215 20 -0.006 21 -0.359 22 -0.407 23 -0.393 24 -0.593 25 -0.819 26 -0.872 27 -0.866 28 -1.050 29 -0.890 30 -1.064 31 -0.807 32 -1.059 33 -0.871 34 -0.961 35 -0.779 36 -0.647 37 -0.414 38 -0.215 39 -0.126 40 -0.037 41 0.238 42 0.389 43 0.466 44 0.645 45 0.748 46 0.710 47 0.967 48 0.885 49 0.927 50 1.018 51 0.957 52 0.938 53 0.951 54 0.914 55 0.687 56 0.621 57 0.430 58 0.332 59 0.200 60 -0.062 61 -0.129 62 -0.249 63 -0.445 64 -0.415 65 -0.768 66 -0.883 67 -1.066 68 -0.860 69 -0.901 70 -1.008 71 -0.898 72 -0.933 73 -0.862 74 -0.798 75 -0.663 76 -0.578 77 -0.175 78 -0.426 79 -0.342 80 -0.114 81 0.047 82 0.266 83 0.437 84 0.566 85 0.761 86 0.848 87 0.966 88 1.129 89 1.110 90 0.872 91 0.755 92 1.041 93 0.707 94 0.816 95 0.711 96 0.811 97 0.447 98 0.258 99 0.180 100 0.025 101 -0.149 102 -0.370 103 -0.576 104 -0.556 105 -0.841 106 -0.912 107 -0.758 108 -0.993 109 -1.002 110 -0.910 111 -1.018 112 -0.848 113 -0.926 114 -0.708 115 -0.644 116 -0.609 117 -0.541 118 -0.413 119 -0.183 120 -0.044 121 0.116 122 0.407 123 0.424 124 0.702 125 0.654 126 0.906 127 0.839 128 0.969 129 1.085 130 0.959 131 0.944 132 1.151 133 0.986 134 0.766 135 0.772 136 0.552 137 0.525 138 0.451 139 -0.004 140 0.103 141 -0.011 142 -0.304 143 -0.279 144 -0.572 145 -0.831 146 -1.028 147 -0.924 148 -0.880 149 -0.956 150 -0.959 151 -1.045 152 -0.937 153 -1.055 154 -0.885 155 -0.789 156 -0.536 157 -0.455 158 -0.425 159 -0.157 160 -0.069 161 0.090 162 0.395 163 0.465 164 0.628 165 0.796 166 0.827 167 0.946 168 1.019 169 1.105 170 1.048 171 1.129 172 0.953 173 0.886 174 0.979 175 0.656 176 0.587 177 0.546 178 0.324 179 0.297 180 0.103 181 -0.127 182 -0.387 183 -0.397 184 -0.726 185 -0.683 186 -0.728 187 -0.870 188 -0.863 189 -0.784 190 -0.908 191 -0.961 192 -0.887 193 -0.848 194 -0.940 195 -0.749 196 -0.465 197 -0.458 198 -0.251 199 -0.257}
\end{dspPlot}
\begin{dspPlot}[xticks=25,xout=true,sidegap=0,height=3cm]{0,200}{-2,2}
\dspText(-20,0){(b)}
\dspFuncData[linecolor=blue!60]{0 0.098 1 0.172 2 0.401 3 0.616 4 0.715 5 0.936 6 0.901 7 1.267 8 1.168 9 1.174 10 1.565 11 1.467 12 1.542 13 1.461 14 1.371 15 1.119 16 1.420 17 1.238 18 1.136 19 1.067 20 0.740 21 0.650 22 0.667 23 0.433 24 0.060 25 -0.220 26 -0.245 27 -0.352 28 -0.458 29 -0.713 30 -0.994 31 -0.996 32 -1.273 33 -1.363 34 -1.423 35 -1.550 36 -1.501 37 -1.587 38 -1.526 39 -1.520 40 -1.468 41 -1.408 42 -1.143 43 -1.095 44 -1.021 45 -1.028 46 -0.885 47 -0.749 48 -0.113 49 -0.091 50 0.026 51 0.091 52 0.258 53 0.607 54 0.879 55 0.712 56 0.982 57 1.147 58 1.067 59 1.441 60 1.385 61 1.665 62 1.458 63 1.538 64 1.359 65 1.364 66 1.240 67 1.306 68 1.286 69 0.967 70 0.925 71 0.672 72 0.562 73 0.493 74 0.200 75 -0.104 76 -0.274 77 -0.390 78 -0.571 79 -0.809 80 -0.864 81 -0.900 82 -1.181 83 -1.287 84 -1.577 85 -1.504 86 -1.613 87 -1.536 88 -1.444 89 -1.321 90 -1.247 91 -1.369 92 -1.299 93 -1.074 94 -0.978 95 -0.805 96 -0.645 97 -0.700 98 -0.319 99 -0.197 100 -0.076 101 0.119 102 0.501 103 0.471 104 0.599 105 0.903 106 1.228 107 1.158 108 1.297 109 1.263 110 1.594 111 1.486 112 1.550 113 1.402 114 1.559 115 1.465 116 1.242 117 1.270 118 1.111 119 1.038 120 0.857 121 0.704 122 0.449 123 0.341 124 0.265 125 0.174 126 -0.304 127 -0.135 128 -0.400 129 -0.706 130 -0.912 131 -1.097 132 -1.072 133 -1.336 134 -1.403 135 -1.338 136 -1.430 137 -1.407 138 -1.447 139 -1.514 140 -1.478 141 -1.278 142 -1.334 143 -1.037 144 -0.948 145 -0.853 146 -0.722 147 -0.516 148 -0.020 149 -0.199 150 -0.156 151 0.380 152 0.434 153 0.487 154 0.984 155 0.937 156 1.056 157 1.078 158 1.160 159 1.180 160 1.384 161 1.368 162 1.562 163 1.465 164 1.650 165 1.578 166 1.374 167 1.238 168 1.271 169 0.912 170 0.949 171 0.656 172 0.512 173 0.306 174 0.246 175 -0.078 176 -0.294 177 -0.318 178 -0.595 179 -0.686 180 -0.917 181 -1.000 182 -1.412 183 -1.220 184 -1.172 185 -1.323 186 -1.382 187 -1.521 188 -1.479 189 -1.449 190 -1.417 191 -1.440 192 -1.302 193 -1.173 194 -1.075 195 -0.798 196 -0.469 197 -0.685 198 -0.360 199 -0.332}
\end{dspPlot}
\begin{dspPlot}[xticks=25,xout=true,sidegap=0,height=3cm]{0,200}{-2,2}
\dspText(-20,0){(c)}
\dspFuncData[linecolor=blue!60]{0 0.022 1 0.325 2 -0.205 3 0.484 4 0.421 5 0.275 6 0.672 7 0.138 8 0.135 9 0.513 10 0.621 11 0.591 12 0.423 13 1.094 14 0.451 15 0.988 16 1.167 17 0.844 18 0.802 19 0.558 20 0.094 21 0.467 22 0.688 23 0.828 24 -0.018 25 -0.542 26 -0.070 27 -0.123 28 -0.444 29 -0.865 30 0.087 31 -1.471 32 -0.941 33 -1.285 34 -1.117 35 -0.845 36 -0.936 37 -1.235 38 -0.739 39 -0.775 40 -0.735 41 -1.047 42 -0.495 43 -0.550 44 0.152 45 -0.233 46 -0.096 47 -0.350 48 -0.678 49 -0.249 50 -0.253 51 -0.063 52 0.434 53 0.183 54 0.183 55 0.451 56 0.631 57 0.907 58 0.527 59 1.011 60 0.977 61 1.424 62 0.927 63 0.953 64 0.592 65 0.489 66 1.008 67 0.761 68 0.938 69 0.387 70 1.224 71 0.522 72 0.717 73 0.173 74 0.071 75 0.230 76 0.060 77 -0.622 78 -0.879 79 -0.848 80 -1.060 81 -0.665 82 -0.908 83 -0.967 84 -1.358 85 -0.691 86 -0.836 87 -1.028 88 -0.658 89 -1.274 90 -0.813 91 -0.789 92 -0.728 93 -1.014 94 -0.576 95 -0.759 96 -0.781 97 -0.769 98 0.097 99 -0.407 100 -0.058 101 -0.278 102 0.150 103 -0.709 104 0.119 105 0.112 106 0.346 107 0.699 108 0.736 109 1.553 110 0.760 111 0.899 112 0.475 113 0.839 114 0.536 115 0.961 116 1.189 117 0.979 118 0.537 119 0.141 120 1.074 121 1.165 122 0.408 123 -0.081 124 0.525 125 -0.198 126 -0.282 127 0.047 128 -0.830 129 -1.134 130 -0.448 131 -0.551 132 -0.739 133 -0.679 134 -0.544 135 -0.628 136 -1.172 137 -0.728 138 -0.940 139 -1.151 140 -1.349 141 -0.689 142 -0.962 143 -0.755 144 -0.949 145 -1.105 146 -0.425 147 -0.389 148 0.151 149 0.142 150 0.351 151 -0.124 152 -0.063 153 -0.055 154 0.648 155 1.517 156 0.927 157 0.513 158 1.123 159 0.529 160 0.476 161 1.221 162 0.739 163 1.103 164 1.451 165 1.085 166 1.215 167 0.309 168 0.991 169 1.397 170 0.768 171 -0.032 172 0.300 173 0.082 174 0.253 175 0.137 176 0.010 177 -0.370 178 -0.568 179 -0.678 180 -0.303 181 -1.302 182 -0.840 183 -0.754 184 -1.122 185 -0.792 186 -1.006 187 -1.311 188 -0.944 189 -1.072 190 -1.088 191 -1.142 192 -0.824 193 -1.386 194 -0.817 195 -0.769 196 -0.786 197 -0.151 198 -0.493 199 0.055}
\end{dspPlot}
\end{center}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The filter will act on the deterministic sinusoidal component and on the noise component independently; therefore the output can be written as
\begin{align*}
y[n] &= h[n] \ast (\sin(\omega_0 n) + s[n]) \\
&= A\sin(\omega_c + \theta) + h[n]\ast s[n] \\
&= A\sin(\omega_c + \theta) + v[n]
\end{align*}
where $A = |H(e^{j\omega_c})|$ and $\theta = \angle H(e^{j\omega_c})$.
\begin{enumerate}
\item NO: the frequency of the sinusoidal component in the output is clearly different than the frequency of the input; since a filter cannot change the frequency of a sinusoidal input this signal cannot be a valid output
\item NO: the amplitude of the sinusoidal component has increased, but this cannot happen since by design $|H(e^{j\omega})| \le 1$ for all $\omega$
\item NO: the variance of the noise seems to have increased in the output. However the variance of the output noise is
\begin{align*}
\sigma_v^2 &= r_v[0] \\
&= \frac{1}{2\pi}\int_{-\pi}^{\pi}|H(e^{j\omega})|^2\, P_s(e^{j\omega}) d\omega\\
&= \sigma_s^2\, \frac{1}{2\pi}\int_{-\pi}^{\pi}|H(e^{j\omega})|^2\,d\omega\\
&\le \sigma_s^2\, \frac{1}{2\pi}\int_{-\pi}^{\pi}d\omega\\
&\le \sigma_s^2
\end{align*}
so the variance of the output noise cannot increase after filtering with the given $H(e^{j\omega})$.
\end{enumerate}
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Autocorrelation.}
Assume $w[n]$ is a white process with variance $\sigma^2$ and consider the WSS process
\[
s[n] = w[n] + 0.5w[n-1]
\]
\begin{enumerate}
\item compute the autocorrelation $r_s[n]$ of the process $s[n]$
\item write out the $3\times 3$ autocorrelation matrix for $s[n]$
\item compute the cross-correlation $r_{ws}[n]$ between $w[n]$ and $s[n]$
\item suppose we want to find an optimal filter (in the least squares sense) to obtain $w[n]$ from $s[n]$
\end{enumerate}
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
\begin{enumerate}
\item We have
\begin{align*}
r_x[k] &= \expt{w[n]w[n-k]} \\
&= \expt{(w[n] + 0.5w[n-1])(w[n-k] + 0.5w[n-1-k])} \\
&= \expt{w[n]w[n-k]} + 0.5\expt{w[n]w[n-1-k]} + 0.5\expt{w[n-1]w[n-k]} + 0.25\expt{w[n-1]w[n-1-k]} \\
&= \sigma^2 \left[\delta[k] + 0.5\delta[k+1] + 0.5\delta[k-1] + 0.25\delta[k]\right] \\
&= \sigma^2 \left[1.25\delta[k] + 0.5\delta[k+1] + 0.5\delta[k-1]\right]
\end{align*}
\item The $3\times 3$ autocorrelation matrix is
\[
\begin{bmatrix}
1.25\sigma^2 & 0.5\sigma^2 & 0 \\
0.5\sigma^2 & 1.25\sigma^2 & 0.5\sigma^2 \\
0 & 0.5\sigma^2 & 1.25\sigma^2
\end{bmatrix}
\]
\item $r_{ws}[k] = \expt{s[n]w[n-k]} = \sigma^2\delta[n] + 0.5\sigma^2\delta[k-1]$
\end{enumerate}
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexercises{%
\begin{exercise}{Topic.}
The exercise
\end{exercise}
}\fi
\ifanswers{%
\begin{solution}{}
The solution
\end{solution}
}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}

Event Timeline