Exam simulation

Lecture 6 · Digital Signal Processing · University of Klagenfurt, 2022

Nunzio Alexandro Letizia

This lecture

Lecture 6 of 6

  1. The exam simulation, solved in class
  2. The written exam of July 2022, with its solutions

Each paper has three exercises: Fourier analysis, the DFT, and a digital filter with a random input. 100 and 110 points; written test and assignments counted half each.

From Digital Signal Processing at the University of Klagenfurt, first taught in 2020: this is the edition of summer 2022, so some of it may be a little dated. All lectures.

The exam simulation

01

Exercise 1: Fourier series and transform

Let x_p(t) be the periodic version, with period T_0=2, of the signal x(t) in the figure, with 0<D\le1. (40 points)

  1. Compute the Fourier series of x_p(t).
  2. Having found that \displaystyle x_p(t)=\frac{D}{2}+\frac{2}{\pi}\sum_{k=1}^{\infty}\frac{\sin\left(\frac{\pi Dk}{2}\right)}{k}\cos\left(\pi kt-\frac{\pi Dk}{2}\right), prove that \displaystyle\sum_{k=1}^{\infty}\frac{\sin^2\left(\frac{\pi Dk}{2}\right)}{k^2}=\left(D-\frac{D^2}{2}\right)\frac{\pi^2}{4}.
  3. Compute the Fourier transform X(f) of x(t), and sketch its magnitude and phase.
  4. Find the convolution y(t)=x*x(t) and its Fourier transform Y(f).

A single rectangular pulse of height one between t equal to zero and t equal to D.

Exercise 1: solution

1. One period on [-1,1], with \frac{2}{T_0}=1 and x=1 on [0,D]:

a_0=D,\qquad a_k=\int_0^D\cos(\pi kt)\,dt=\frac{\sin(\pi kD)}{\pi k},\qquad b_k=\int_0^D\sin(\pi kt)\,dt=\frac{1-\cos(\pi kD)}{\pi k}

which combine into the form of item 2, with amplitudes A_k=\frac2\pi\frac{\sin(\pi kD/2)}{k}.

2. Parseval, \frac{2}{T_0}\int|x_p|^2=\frac{A_0^2}{2}+\sum_kA_k^2, with \int_{-1}^1x^2\,dt=D:

D=\frac{D^2}{2}+\frac{4}{\pi^2}\sum_{k=1}^{\infty}\frac{\sin^2\left(\frac{\pi kD}{2}\right)}{k^2}\ \Longrightarrow\ \sum_{k=1}^{\infty}\frac{\sin^2\left(\frac{\pi kD}{2}\right)}{k^2}=\left(D-\frac{D^2}{2}\right)\frac{\pi^2}{4}

3. x(t)=\mathrm{rect}\left(\frac{t-D/2}{D}\right), so X(f)=D\,\mathrm{sinc}(Df)\,e^{-j\pi fD}: magnitude D|\mathrm{sinc}(Df)|, with zeros at f=\frac kD; phase -\pi fD, plus jumps of \pi where the sinc is negative.

4. Y(f)=X^2(f)=D^2\,\mathrm{sinc}^2(Df)\,e^{-j2\pi fD}, so y(t)=D\,\mathrm{triangle}\left(\frac{t-D}{D}\right): a triangle on [0,2D], peak D at t=D.

Exercise 2: the DFT

The DFT of an N-point signal x(n) is (10 points)

X(h)=\left[0,\ e^{j\theta},\ \underbrace{0,0,\dots,0}_{N-3\text{ values}},\ e^{-j\theta}\right],\qquad0\le h\le N-1

Find the N-point signal x(n), and simplify your answer.

Only X(1) and X(N-1) are non-zero in the inverse DFT:

x(n)=\frac1N\sum_{h=0}^{N-1}X(h)\,e^{j2\pi\frac{nh}{N}}=\frac1N\left(e^{j\theta}e^{j\frac{2\pi n}{N}}+e^{-j\theta}e^{j2\pi\frac{n(N-1)}{N}}\right)=\frac1N\left(e^{j\left(\frac{2\pi n}{N}+\theta\right)}+e^{-j\left(\frac{2\pi n}{N}+\theta\right)}\right)

x(n)=\frac2N\cos\left(\frac{2\pi n}{N}+\theta\right)

Exercise 3: a digital filter

A very simple high-pass filter is the FIR filter \ y(n)=\frac1N\sum_{k=0}^{N-1}(-1)^k\,x(n-k), with N=8. (50 points)

  1. Sketch its impulse response h(n).
  2. What is its DC gain \hat H(0)?
  3. Find the transfer function H(z) and sketch the zero/pole diagram.
  4. Find the frequency response \hat H(f) and sketch its magnitude.
  5. The input x(n) is the moving average of two consecutive independent, zero mean, unit variance Gaussian samples w(n). Find the power spectral density R_{yy}(f) of the output.
  6. Find the output power M_y.

Exercise 3: solution

1. h(n)=\frac18\left[\delta(n)-\delta(n-1)+\delta(n-2)-\dots-\delta(n-7)\right]: eight stems, \pm\frac18. 2. \hat H(0)=\sum_nh(n)=0.

3. H(z)=\dfrac18\sum_{k=0}^{7}\left(-z^{-1}\right)^k=\dfrac18\cdot\dfrac{1-z^{-8}}{1+z^{-1}}: zeros at the 8th roots of unity except z=-1, and 7 poles at z=0.

4. \hat H(f)=\dfrac18\,e^{-j\left(7\pi f-\frac\pi2\right)}\,\dfrac{\sin(8\pi f)}{\cos(\pi f)}: zero at f=\frac k8, except at f=\frac12, where |\hat H|=1.

Left: seven zeros on the unit circle, none at minus one, and the poles at the origin. Right: the magnitude, zero at DC and a main lobe at one half.

5. x(n)=\frac{w(n)+w(n-1)}{2}, so R_{xx}(f)=\left|\frac12+\frac12e^{-j2\pi f}\right|^2=\cos^2(\pi f) and \ R_{yy}(f)=|\hat H(f)|^2R_{xx}(f)=\dfrac{\sin^2(8\pi f)}{64}.

6. Over one period: \ M_y=\int_0^1\dfrac{\sin^2(8\pi f)}{64}\,df=\dfrac{1}{128}.

The written exam

02

Exercise 1: Fourier series and transform

Let x_p(t) be the periodic version, with period T_0=2, of the signal x(t) in the figure, with 0\le D<1. (40 points)

  1. Compute the Fourier series of x_p(t).
  2. Having found that \displaystyle x_p(t)=\frac{1+D}{2}+\frac{2}{(1-D)\pi^2}\sum_{k=1}^{\infty}\frac{(-1)^{k+1}+\cos(\pi kD)}{k^2}\cos(\pi kt), prove that \displaystyle\sum_{k=1}^{\infty}\frac{1}{(2k-1)^2}=\frac{\pi^2}{8}.
  3. Compute the Fourier transform X(f) of x(t).
  4. How are the coefficients A_k of the Fourier series related to the Fourier transform X(f)?

A symmetric trapezoid: zero at t equal to minus one and one, flat at one between minus D and D.

Exercise 1: solution

1. Even, so b_k=0; the falling edge on [D,1] is \frac{1-t}{1-D}:

a_0=1+D,\qquad a_k=2\left[\int_0^D\cos(\pi kt)\,dt+\int_D^1\frac{1-t}{1-D}\cos(\pi kt)\,dt\right]=\frac{2\left((-1)^{k+1}+\cos(\pi kD)\right)}{(1-D)\pi^2k^2}

2. At t=0 with D=0, the triangle, x_p(0)=1:

1=\frac12+\frac{2}{\pi^2}\left(\frac{2}{1^2}+\frac{2}{3^2}+\frac{2}{5^2}+\dots\right)\ \Longrightarrow\ \sum_{k=1}^{\infty}\frac{1}{(2k-1)^2}=\frac{\pi^2}{8}

3. The trapezoid is \frac{1}{1-D}\,\mathrm{rect}\left(\frac{t}{1+D}\right)*\mathrm{rect}\left(\frac{t}{1-D}\right), so

X(f)=(1+D)\,\mathrm{sinc}\left((1+D)f\right)\mathrm{sinc}\left((1-D)f\right)

4. The coefficients are samples of the transform: A_k=\frac{2}{T_0}X\left(\frac{k}{T_0}\right), here A_k=X\left(\frac k2\right).

Exercise 2: the DFT

An N-point signal is x_N(n)=[1,\,1,\,\underbrace{0,\dots,0}_{N-4},\,1,\,1], 0\le n\le N-1, N\ge4. (30 points)

  1. Find the 4-point DFT of y(n)=x_4(n), in polar coordinates.
  2. Find the N-point DFT X(h) of x_N(n).
  3. Express it in polar coordinates, and find \alpha and \beta such that |X(h)|=4\left|\cos\left(\alpha\frac{\pi h}{N}\right)\cos\left(\beta\frac{\pi h}{N}\right)\right|.

1. x_4=[1,1,1,1]: \ Y(h)=\sum_{n=0}^{3}e^{-j2\pi\frac{nh}{4}}=e^{-j\frac34\pi h}\,\dfrac{\sin(\pi h)}{\sin\left(\frac{\pi h}{4}\right)}=[4,\,0,\,0,\,0].

2. The last two samples are the first two shifted back by N:

X(h)=e^{-j\frac{2\pi h}{N}}+1+e^{j\frac{2\pi h}{N}}+e^{j\frac{4\pi h}{N}}=\left(1+e^{j\frac{2\pi h}{N}}\right)\left(e^{-j\frac{2\pi h}{N}}+e^{j\frac{2\pi h}{N}}\right)=4\,e^{j\frac{\pi h}{N}}\cos\left(\frac{\pi h}{N}\right)\cos\left(\frac{2\pi h}{N}\right)

3. So \alpha=1, \beta=2 (or the other way round); the phase is \frac{\pi h}{N}, plus \pi where the product of the cosines is negative.

Exercise 3: a digital filter

A discrete-time system is \ y(n)=y(n-1)+x(n)-x(n-2). (40 points)

  1. Find the transfer function H(z) and sketch the zero/pole diagram.
  2. Find the impulse response h(n) and sketch it.
  3. Find the frequency response \hat H(f) and sketch its magnitude. What type of filter is it?
  4. The input x(n) is made of zero mean Gaussian samples with power spectral density R_{xx}(f)=\mathrm{rect}(4f-1), f\in[0,1). Find the PSD R_{yy}(f) of the output.
  5. Find the powers M_x and M_y at the input and at the output.

Exercise 3: solution

1. H(z)=\dfrac{1-z^{-2}}{1-z^{-1}}=1+z^{-1}: the pole at z=1 cancels a zero; what remains is a zero at z=-1 and a pole at z=0. 2. h(n)=\delta(n)+\delta(n-1): despite the feedback, a FIR filter.

3. \hat H(f)=1+e^{-j2\pi f}=2\cos(\pi f)\,e^{-j\pi f}, |\hat H(f)|=2|\cos(\pi f)|: a low-pass filter, a two-point moving sum.

4. R_{yy}(f)=4\cos^2(\pi f)\,\mathrm{rect}(4f-1), non-zero for \frac18<f<\frac38.

5. Over one period, \ M_x=\int_{1/8}^{3/8}1\,df=\frac14 and \ M_y=\int_{1/8}^{3/8}4\cos^2(\pi f)\,df=\frac12+\frac1\pi\left(\sin\frac{3\pi}{4}-\sin\frac\pi4\right)=\frac12.

In item 4 the paper said “independent” samples, which would make the PSD flat: it is dropped here. As in lecture 5, a PSD on \left(\frac18,\frac38\right) alone is not even, so the input is complex.

This was the last lecture. The exams and simulations of all three years are on the course page, as PDFs.