Page MenuHomec4science

midterm.tex
No OneTemporary

File Metadata

Created
Thu, Mar 13, 14:10

midterm.tex

\documentclass[a4paper,13pt,fleqn]{article}
\usepackage{defsDSPcourse}
\usepackage{dspTricks}
\usepackage{dspFunctions}
\usepackage{dspBlocks}
\newif\ifanswers
\answerstrue
\def\onebyone{} %\newpage}
\begin{document}
\vspace{5em}
\begin{center}%
\sffamily
{\LARGE \bfseries COM-303 - Signal Processing for Communications \\ ``Mock'' Midterm Exam} \\
\vspace{1em}
{\large }
\vspace{1em}
\end{center}
\centerline{\rule{\textwidth}{.5pt}}
\begin{itemize}
\item This is a no-grade, take-home midterm exam: try to work on the problems as if taking a real exam, i.e.: work uninterruptedly for 2 hours, do not use the internet and use only handwritten notes for support.
\item The solution will be discussed in class after the spring break.
\item There are 6 problems with different scores for a total of 100 points.
\end{itemize}
\centerline{\rule{\textwidth}{.5pt}}
\vspace{1em}
\onebyone
\begin{exercise}{(5 points)}
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
\[
\mathbf{y} = [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]$.
\ifanswers{\em\vspace{3em}\par{\bfseries Solution: }
\begin{align*}
Y[k] &= \sum_{n = 0}^{2N-1} y[n] e^{-j\frac{2\pi}{2N}nk} \\
&= \sum_{n = 0}^{N-1} x[n] e^{-j\frac{2\pi}{2N}(2n)k} - \sum_{n = 0}^{N-1} x[n] e^{-j\frac{2\pi}{2N}(2n+1)k} \\
&= \sum_{n = 0}^{N-1} x[n] e^{-j\frac{2\pi}{N}nk} - \sum_{n = 0}^{N-1} x[n] e^{-j\frac{2\pi}{N}nk}\, e^{-j\frac{2\pi}{2N}k}\\
&= (1 - e^{-j\frac{\pi}{N}k})X[k]
\end{align*}
}\fi
\end{exercise}
\onebyone
\begin{exercise}{(10 points)}
Consider the infinite-length discrete-time signal
\[
s[n] = \cos(\frac{\pi}{2}n) + \cos(\frac{5\pi}{8}n) \qquad n \in \mathbb{Z}
\]
Consider now the finite-length signal
\[
x[n] = s[n], \quad n = 0, 1, \ldots N-1
\]
Determine the minimum value for $N$ so that the DFT $X[k]$ satisfies the following requirements:
\begin{itemize}
\item $X[k]$ has only four nonzero values
\item the nonzero values are non-contiguous (i.e. there should be one or more zero values for $X[k]$ between the nonzero values); this corresponds to being able to resolve the frequencies of the sinusoids of the original signal.
\end{itemize}
\ifanswers{\em\vspace{3em}\par{\bfseries Solution: }
The original signal contains two sinusoids at frequencies
\begin{align*}
\omega_0 &= \frac{\pi}{2} \\
\omega_1 &= \frac{5\pi}{8}
\end{align*}
In order for the DFT of the finite-length signal to contain only four nonzero values we must choose $N$ so that both frequencies are integer multiples of the fundamental frequency for the space of length-$N$ signals; that is, we need to find a value for $N$ such that
\begin{align*}
\omega_0 &= k_0 \frac{2\pi}{N} \\
\omega_1 &= k_1 \frac{2\pi}{N}
\end{align*}
for integer values of $k_{0,1}$. By replacing the values for $\omega_{0,1}$ we have
\begin{align*}
k_0 &= \frac{N}{4}\\
k_1 &= \frac{5}{16} N
\end{align*}
so that, in order to have $k_{0,1} \in \mathbb{N}$, $N$ must be a multiple of 16. If we choose $N=16$, however, we have that $k_0 = 4$ and $k_1 = 5$ which does not fulfill the requirement of having at least one zero value between the nonzero DFT values. We therefore must choose at least $N=32$, for which $k_0 = 8$ and $k_1 = 10$.
}\fi
\end{exercise}
\onebyone
\begin{exercise}{(25 points)}
Determine the impulse response $h[n]$ of an ideal filter whose real-valued frequency response $H(e^{j\omega})$ is shown in the following figure:
\begin{center}
\begin{dspPlot}[height=3cm,xtype=freq,xticks=4,yticks=1,ylabel={$H(e^{j\omega})$}]{-1,1}{0, 1.2}
\dspFunc{x \dspRect{0}{1} x \dspTri{0}{.25} sub}
\dspCustomTicks[axis=x]{0.125 $\pi/8$}
\end{dspPlot}
\end{center}
\ifanswers{\em\vspace{3em}\par{\bfseries Solution: }
The real-valued frequency response in the figure can be decomposed as the difference between an ideal lowpass with cutoff frequency $\pi/2$ and an ideal filter with triangular characteristic and support between $-\pi/4$ and $\pi/4$:
\[
H(e^{j\omega}) = \rect(\omega/\pi) - T(e^{j\omega})
\]
In order to find the expression for $T(e^{j\omega})$, consider that the convolution of a rect shape with itself produces a triangular shape with twice the support:
\[
\rect(t) = \begin{cases}
1 & \mbox{for $|t| < 1/2$} \\
0 & \mbox{otherwise}
\end{cases}
\]
\[
\rect(t) \ast \rect(t) = \begin{cases}
1 - |t| & \mbox{for $|t| < 1$} \\
0 & \mbox{otherwise}
\end{cases}.
\]
In our case, using a lowpass with cutoff $\pi/8$:
\begin{align*}
\rect\bigg(\frac{\omega}{\pi/4}\bigg) * \rect\bigg(\frac{\omega}{\pi/4}\bigg) &=
\frac{1}{2\pi}\int_{-\pi}^{\pi} \, \rect\bigg(\frac{\sigma}{\pi/4}\bigg)\rect\bigg(\frac{\omega - \sigma}{\pi/4}\bigg) d\sigma \\
&= \begin{cases}
1/8 - |\omega/2\pi| & \mbox{for $|\omega| < \pi/4$} \\
0 & \mbox{otherwise}
\end{cases}
\end{align*}
We can therefore write
\[
H(e^{j\omega}) = \rect\bigg(\frac{\omega}{\pi}\bigg) - 8\,\rect\bigg(\frac{\omega}{\pi/4}\bigg) * \rect\bigg(\frac{\omega}{\pi/4}\bigg)
\]
In order to find the impulse response, simply remember that convolution in frequency is multiplication in time:
\[
h[n] = (1/2)\sinc(n/2) - (1/8)\sinc^2(n/8)
\]
}\fi
\end{exercise}
\onebyone
\begin{exercise}{(10 points)}
Consider a filter with frequency response $H(e^{j\omega}) = \cos 2\omega + 3\cos 5\omega$.
\begin{enumerate}
\item write out the impulse response $h[n]$
\item what is the delay introduced by the filter?
\item write the frequency response of a causal implementation of the filter.
\end{enumerate}
\ifanswers{\em\vspace{3em}\par{\bfseries Solution: }
From the frequency response
\[
H(e^{j\omega}) = \frac{1}{2}e^{j2\omega} + \frac{1}{2}e^{-j2\omega} + \frac{3}{2}e^{j5\omega} + \frac{3}{2}e^{-j5\omega}
\]
it's immediate to derive the transfer function
\[
H(z) = \frac{3}{2}z^{5} + \frac{1}{2}z^{2} + \frac{1}{2}z^{-2} + \frac{3}{2}z^{-5}
\]
so that the FIR impulse response looks like so:
\begin{center}
\begin{dspPlot}[height=2cm,xout=true]{-8,8}{0,2}
\dspTapsAt{-8}{0 0 0 1.5 0 0 0.5 0 0 0 0.5 0 0 1.5 0 0 0}
\end{dspPlot}
\end{center}
The frequency response of the filter is real-valued; therefore its phase response is zero and so the filter introduces no delay. This is also apparent by the shape of the impulse response, which is symmetrical around zero.
\vspace{1em}
To make the filter causal, we need to add a delay so that all the nonzero values of the impulse response are for positive values of the index. This can be achieved with a delay by five, so that the resulting frequency response becomes
\[
H_c(e^{j\omega}) = e^{-j5\omega}\,H(e^{j\omega})
\]
}\fi
\end{exercise}
\onebyone
\begin{exercise}{(30 points)}
Consider the following system
\begin{center}
\begin{dspBlocks}{0.9}{0.3}
$x[n]~~$ & \BDadd & \BDfilter{$H_1(z)$} & \BDsplit & \BDfilter{$H_3(z)$} & $~~y[n]$ \\
& & \BDfilter{$H_2(z)$} & & & & & & \\
\end{dspBlocks}
\BDConnHNext{1}{1}\BDConnHNext{1}{2}\BDConnHNext{1}{5}\BDConnHNext{1}{6}
\ncline{->}{1,3}{1,5}\taput{$t[n]$}\ncline{->}{1,7}{1,9}
\ncline{1,4}{2,4}\ncline{->}{2,4}{2,3}\ncline{2,2}{2,3}\ncline{->}{2,2}{1,2}
\end{center}
where the finite-length impulse responses of the three filters $H_1(z)$, $H_2(z)$, $H_3(z)$ are as in the following figures:
\begin{center}
\psset{unit=1.6cm}
\begin{tabular}{ccc}
\begin{dspPlot}[width=4cm, height=3cm,xout=true]{-2,4}{-5,5}
\dspTapsAt{-2}{0 0 1 -2 0 0 0}
\end{dspPlot}
&
\begin{dspPlot}[width=4cm, height=3cm,xout=true]{-2,4}{-5,5}
\dspTapsAt{-2}{0 0 2 3 0 0 0}
\end{dspPlot}
&
\begin{dspPlot}[width=4cm, height=3cm,xout=true]{-2,4}{-5,5}
\dspTapsAt{-2}{0 0 1 0 -4 0 0}
\end{dspPlot}
\\
$H_1(z)$ & $H_2(z)$ & $H_3(z)$
\end{tabular}
\end{center}
\begin{enumerate}
\item compute the global transfer function of the system
\item sketch its pole-zero plot
\item determine if the system stable
\end{enumerate}
\ifanswers{\em\vspace{3em}\par{\bfseries Solution: }
To find the overall transfer function of the system let's first consider the auxiliary signal $t[n]$ as in the figure. In the $z$-domain we have
\[
Y(z) = H_3(z)T(z)
\]
and
\[
T(z) = [X(z) + H_2(z)T(z)]H_1(z)
\]
from which
\[
H(z) = \frac{H_1(z)H_3(z)}{1 - H_1(z)H_2(z)}
\]
Let's consider now the individual transfer functions; all filters are FIR filter and from the plots we have
\begin{align*}
H_1(z) &= 1 - 2z^{-1} \\
H_2(z) &= 2 + 3z^{-1} \\
H_3(z) &= 1 - 4z^{-2} \\
\end{align*}
By plugging these values in the expression for the transfer function we have
\begin{align*}
H(z) &= \frac{(1 - 2z^{-1})(1 - 4z^{-2})}{-1 + z^{-1} + 6z^{-2}} \\
&= \frac{(1 - 2z^{-1})(1 - 2z^{-1})(1 + 2z^{-1})}{(1 + 2z^{-1})(1 - 3z^{-1})} \\
&= \frac{(1 - 2z^{-1})^2}{(1 - 3z^{-1})}
\end{align*}
The pole-zero plot is the following
\begin{center}
\begin{dspPZPlot}[xticks=none,yticks=none]{3.5}
\dspPZ[type=zero,label=none]{2,0}
\dspPZ[type=pole,label=none]{3,0}
\end{dspPZPlot}
\end{center}
and, since the pole is outside the unit circle, the system is unstable.
}\fi
\end{exercise}
\onebyone
\begin{exercise}{(20 points)}
The figures below show the pole-zero plots of two filters, $H_1(z)$ and $H_2(z)$. The poles and the zeros lie on circles of radius $\alpha$ and $1/\alpha$. Sketch as accurately as you can the magnitude responses of both filters, highlighting the differences if any.
{
\centering
\begin{tabular}{cc}
\begin{dspPZPlot}[xticks=none,yticks=none]{2}
\dspPZ[type=zero,label=none]{0.35,0.606}
\dspPZ[type=pole,label=none]{-0.7,0}
\dspPZ[type=zero,label=none]{0.35,-0.606}
\dspPZ[type=zero,label=none]{-1.4,0}
\pscircle[linewidth=0.1pt,linestyle=dashed,dimen=middle](0,0){1.4\dspUnitX}
\dspText(1.4,-.2){$\alpha^{-1}$}
\pscircle[linewidth=0.1pt,linestyle=dashed,dimen=middle](0,0){0.7\dspUnitX}
\dspText(0.7,-.2){$\alpha$}
\end{dspPZPlot}
&
\begin{dspPZPlot}[xticks=none,yticks=none]{2}
\dspPZ[type=zero,label=none]{0.35,0.606}
\dspPZ[type=zero,label=none]{-0.7,0}
\dspPZ[type=zero,label=none]{0.35,-0.606}
\dspPZ[type=pole,label=none]{-1.4,0}
\pscircle[linewidth=0.1pt,linestyle=dashed,dimen=middle](0,0){1.4\dspUnitX}
\dspText(1.4,-.2){$\alpha^{-1}$}
\pscircle[linewidth=0.1pt,linestyle=dashed,dimen=middle](0,0){0.7\dspUnitX}
\dspText(0.7,-.2){$\alpha$}
\end{dspPZPlot}
\\
$H_1(z)$ & $H_2(z)$
\end{tabular}
}
\ifanswers{\em\vspace{3em}\par{\bfseries Solution: }
The frequency response of $H_1(z)$ and $H_2(z)$ can be decomposed into a cascade of two filters: the first filter is determined by the two zeros in the right half-plane while the second filter accounts for the pole-zero pair in the left half-plane. The two complex-conjugate zeros in the right half-plane are at $z_0$ and $z_0^*$ with $z_0 = \alpha e^{j\omega_0}$ for some angle $\omega_0$; their response is described by the transfer function:
\begin{align*}
B(z) &= (1 - z_0\,z^{-1})(1 - z_0^*\,z^{-1}) \\
&= 1 - 2\alpha \cos(\omega_0) \, z^{-1} + \alpha^2 z^{-2}.
\end{align*}
Take now the pole-zero pair in the left half-plane in the plot for $H_1(z)$; the resulting transfer function is
\[
A(z) = \frac{1 - (1/\alpha)z^{-1}}{1 - \alpha z^{-1}}
\]
In the second plot, the roles of the pole and the zero are reversed; we can thus write
\begin{align*}
H_1(z) &= B(z)\,A(z) \\
H_2(z) &= B(z)/A(z)
\end{align*}
The magnitude response of $A(z)$ is that of an allpass filter; from
\[
A(z) = \frac{1 - (1/\alpha)z^{-1}}{1 - \alpha z^{-1}} =
\frac{z^{-1}}{\alpha}\cdot\frac{z^{-1} - \alpha}{z - \alpha}
\]
we can derive
\[
|A(e^{j\omega})| = \left|\frac{e^{-j\omega}}{\alpha}\right| \cdot \left|\frac{e^{-j\omega} - \alpha}{e^{j\omega} - \alpha}\right| = |\alpha|^{-1}\, \left|\frac{[e^{-j\omega} - \alpha]}{[e^{-j\omega} - \alpha]^*}\right| = |\alpha|^{-1}
\]
so that the only difference between the magnitude responses of $H_1(z)$ and $H_2(z)$ is a scaling factor:
\begin{align*}
|H_1(e^{j\omega})| &= |B(e^{j\omega})|/|\alpha| \\
|H_2(e^{j\omega})| &= |\alpha||B(e^{j\omega})|
\end{align*}
The shape of the magnitude response will be the same for both filters and is determined by $B(z)$, which is a simple notch filter, sketched here for $\alpha = 0.8$ and $\omega_0 = \pi/4$:
\begin{center}
\begin{dspPlot}[height=3cm,xtype=freq,xticks=4,yticks=none,ylabel={$|B(e^{j\omega})|$}]{-1,1}{0, 3}
\dspFunc{x \dspTFM{1 -1.1314 0.64}{1}}
\end{dspPlot}
\end{center}
Note however that the phase response of $H_1(z)$ and $H_2(z)$ will be different because of the phase response introduced by $A(z)$ and $1/A(z)$.
}\fi
\end{exercise}
\end{document}

Event Timeline