Back to ELEC317 Login to download
ELEC 317 Midterm Test (Spring 1999) Mar. 22, 1999.
Answer all questions. Some questions may be more difficult than others.
1. (40%) Signal processing
Given a 1x3 signal A and a 1x3 filter B (in Matlab notation)
A=[40 60 80];
B=[1/4 1/2 1/4];

(10%) What is C, the linear convolution of A and B? You should compute C by hand.

(10%) What is D, the circular convolution of A and B? You should compute D by hand.

(5%) What is the Matlab command to compute C from A and B in part a (one Matlab

(10%) Write the Matlab command(s) to compute D (for one period only) from A and B in part b .

(5%) Is B a lowpass filter or highpass filter? Why?

2. (30%) Image filtering and restoration

(5%) Show above are three images A, B, and C. Indicate which one is
a1. Lena filtered with ones(5)/25.
a2. Lena filtered with ones(17)/289.
a3. Lena filtered with [0 -1 0; -1 4 -1; 0 -1 0].

(10%) Suppose a 256x256 image A has most pixels in the range of [0..100], and very few in [101..255]. And you would like most pixels to be in [0..200] so that you can see the details better. You decide to use contrast stretching technique you learn in this course to do this. What is the equation of the contrast stretching function? Draw the function.

(15%) Write the Matlab commands to implement the contrast stretching on A, which you designed in part b.

3. (30%) Image Transform Let A be a NxN square matrix. A transform T(u) is defined as v=T(u)=Au, which maps a N-dimensional vector u to a N-dimensional vector v.
(5%) What is the definition of a unitary matrix?

(10%) Show that energy is conserved under a unitary transform.

(15%) Let T(u) be the Discrete Fourier Transform such that

N .1 . j 21 kn
v(k) =
u(n)WN , k = 0,1,..., N .1 WN = eN
Show that, if u is a real vector,
v *(N . k) = v(k)

ELEC317 Midterm Test Solution:
Problem 1
1a. A=[40 60 80]; B=[1/4 1/2 1/4];
C[0] =A[0]B[0]
C[1] =A[0]B[1] +A[1]B[0]
C[2] =A[0]B[2] +A[1]B[1] +A[2]B[0]
C[3] = A[1]B[2] +A[2]B[1]
C[4] = A[2]B[2]

C =[10 35 60 55 20]
1b. D[0] =A[0]B[0]+A[1]B[-1 mod 3]+A[2]B[-2 mod 3]
D[1] =A[0]B[1]+A[1]B[0] +A[2]B[-1 mod 3]
=A[0]B[1]+A[1]B[0] +A[2]B[2]

D[2] =A[0]B[2]+A[1]B[1] +A[2]B[0]
D =[65 55 60 ....... ] <-- periodic

1c. C=conv(A,B)
1d. D=ifft(fft(A).*fft(B))
1e. low-pass: no zero-crossing with sum of elements=1, sinc/triangular shape in time domain <=> somewhat retangular in freq. domain
Problem 3
3a. A-1=AH
3b. Energy of U = tr(UHU) Energy of V = tr(VHV) =tr((AU) H (AU)) =tr(UH AH AU) =tr(UH I U) =tr(UH U)
3c. v*(N-k) = C u*(n)W(N-k)n* where C=1/N
= Cu(n) W-Nn+kn since u(n)=u*(n)
= Cu(n)Wkn since W-Nn=exp(-j2npi)=1
= v(k)