Professional Documents
Culture Documents
Work through each of the following questions, and satisfy yourself that you
understand the content. In some cases there is a final Hand in task — you are
expected to generate results for these tasks, and compile them into a single
electronic document (using Microsoft Word, for example).
Your hand-in solutions must be submitted by the due date, either in print form
or electronically.
(b) Calculate y[n] analytically for x[n] = δ[n], assuming that the system
is causal.
(c) Now create a unit impulse vector, imp, of length 128. Generate the
first 128 points of the impulse response of the filter satisfying the
above difference equation, again making the assumption of causality.
Use stem to plot these values as a discrete-time signal versus time
(see help stem). It may help to plot just the first 10 or 20 points.
(d) Hand in: Using the subplot command, show the impulse sequence
on one set of axes and the filter response on a set of axes below. Use
the same range for the x-variable in both cases.
1
h[n] of the following difference equation:
π 1
y[n] − 1.8 cos y[n − 1] + 0.81y[n − 2] = x[n] + x[n − 1].
16 2
Plot h[n] in the range of −10 ≤ n ≤ 100.
(b) Also determine the impulse response analytically and confirm your
results.
Consider the difference equation from the previous question — the system
function is rational:
1 + 12 z −1
H (z) = .
1 − 1.8 cos(π/16)z −1 + 0.81z −2
The freqz function can be used to find the frequency response, since
evaluating the z-transform on the unit circle is equivalent to finding points
on the DTFT.
(a) Write a function myfreqz that emulates the behaviour of the function
2
freqz. Use this to make plots of the magnitude and phase of the
system specified above, with 512 frequency samples around the entire
unit circle. Note that for a complex sequence x, abs(x) can be used
to find the magnitude, and angle(x) the phase.
(b) Is this a highpass, lowpass, allpass, bandpass, or bandstop filter?
(c) Hand in: A plot (two axes on the same figure, using subplot) of the
magnitude and phase of the frequency response (for ω from 0 to 2π ) of
3
for k = 0, 1, . . . , N − 1.
(a) Write a function [H,W] = DTFT(h, N) that computes the DTFT
of the finite-length signal contained in the vector h. The values in this
vector are h = [h[0]h[1] · · · h[L − 1]], and the signal is assumed to
have zero values for n < 0 and n ≥ L. The function must evaluate the
DTFT at N equally-spaced frequency points, which are returned in the
vector W. The values of the DTFT samples must be returned in H.
(b) Use the function just written to find the DTFT of the finite-length pulse
1 0≤n<L
r [n] =
0 elsewhere
4
20 log10 |H (e j ω )|. Comment on the difference in the resulting
mainlobe width (the first zero in the frequency response) and the
magnitude of the ripple at higher frequencies.