# 这是一篇来自加拿大的关于数字信号处理介绍的作业代写

An expansion of what is presented in the lecture notes is required for this assignment. Note that an FIR approximation of an ideal IIR lowpass fifilter can be found using

hF IR,LP [n] = wN [n] ×  ω

c π sinc  ωc π n N 2 1  0 n N 1 (1)

where N is the number of fifilter coeffiffifficients and wN [n] is an appropriate windowing function of length N. A careful reader will notice a difffference with the lecture notes. Here L = N 2 1 is used which will correctly allow for N to be odd or even and still maintain symmetry of the fifilter coeffiffifficients. The presentation in the lecture notes should normally be limited to when N is odd.

Also, note that when delaying the fifilter coeffiffifficients to form a bandpass fifilter, you should adjust the equation hBP [n] = 2 cos (ω0n) hLP [n] (2) which was derived for an ideal lowpass fifilter hLP [n], to include the delay for a delayed version hLP,delayed[n] as follows hBP [n] = 2 cos  ω0  n N 2 1  hLP,delayed[n] (3)

PROBLEM 4.1:

Design a discrete-time FIR lowpass fifilters using the windowing method with N = 25 fifilter coeffiffiffi-cients such that when used with an analog-to-digital converter sampling at a rate of 8000 Hz, that the cut-offff frequency will correspond to 2000 Hz. Use the rectangular window, Hamming window,and Kaiser window (with β = 3), respectively.

(a) For each designed fifilter, write an expression for h[n].

Hint: Appropriately combine the expressions for the truncated and delayed ideal impulse re

sponse with the corresponding window.

(b) Using Matlab, plot the magnitude of the frequency response for each fifilter (preferably in one plot using the hold on command in Matlab). Comment on difffferences within the passband, within the stop band, and within the transition region.

For each of the frequency response plots (A, B, C, D, E, F), determine which one of the following systems (specifified by either an H(z), a difffference equation, or a Matlab statement) matches the frequency response (magnitude only). You should be able to do this by hand in a reasonable amount of time (i.e.; like on a fifinal exam). NOTE: frequency axis is normalized; it is ω/π.

S1 :H(z) = 1 + z 2

S2 :y[n] = 0.9y[n 1] + x[n]

S3 :y[n] = 0.8y[n 1] + x[n] x[n 1]

S4 :H(z) =4Xk=0z k

S5 :H(z) =1 + 2z 1 + z 21 + 0.64z2

S6 :y=fifilter([1,1,1,1,1,1],[1],x)

S7 :H(z) =110.64z2

S8 :H(z) = 1 z 3

PROBLEM 4.3:

Consider the following signal which is the summation of a desired signal at 150 Hz that is contam inated with a 50 Hz common mode interference generated by the power grid:

x(t) = 0.3 cos(100πt) + cos(300πt)

We would like to design a FIR highpass fifilter using a rectangular window that removes the inter fering signal. We also choose a sampling rate of fs = 500 Hz.

(a) Write an expression for the sequence x[n] in the discrete-time domain after sampling x(t).

(b) To minimize the required fifilter length, what is the best choice of cut-offff frequency in this scenario for the fifilter? Give your answer in terms of both normalized radial frequency (ωc) and analog frequency (fc). Hint: A wider transition band generally means fewer coeffiffifficients.

(c) For the highpass FIR fifilter, start by designing a lowpass fifilter using N = 16 fifilter coeffiffifficients (that you will later transform). Give the impulse response hLP [n] for this lowpass fifilter.

Note: Be sure to choose ωc carefully to result in the correct cutoffff frequency after transforming  the lowpass fifilter to a highpass fifilter.

(d) Now, take your lowpass fifilter and transform it into the appropriate highpass fifilter. Give an expression for the impulse response hHP [n] of the highpass fifilter and plot the magnitude of the frequency response of this highpass fifilter.

(e) Using Matlab, pass the discrete-time sequence x[n] through the fifilter and verify that it removes the lower frequency component. Use a length of x[n] that is suffiffifficiently long.

(f) In the fifiltered output from part (e), you should have noticed artifacts at the beginning of the output. Explain the source of these artifacts and how long they would last for this fifilter?

PROBLEM 4.4:

We would like to design a bandpass fifilter in a DSP system which attenuates a signal outside the range of frequencies from 1000 Hz to 2000 Hz with near unity gain within the passband. The maximum bandwidth for any input signal is below 5000 Hz.

(a) What is the minimum sampling rate fs that should be used for this DSP system?

(b) With a sampling rate equal to fs, start by designing a corresponding lowpass fifilter, using a rectangular window of length 60. Note that you will afterwards transform this lowpass fifilter into the required bandpass fifilter, so choose the parameters accordingly. Write the expression for the impulse response hLP [n] of this fifilter.

(c) Find the impulse response hBP [n] of the bandpass fifilter by transforming the appropriate lowpass fifilter from part (b).

Note: Be careful when applying equations from Slide 20.11. The derivation on Slide 20.11  assumed no ”delay” to make the fifilter causal. If your resulting hBP [n] is not symmetric, then you have not applied the delay appropriately.

(d) Using Matlab, plot the magnitude of the frequency response of the resulting bandpass fifilter.

(e) Now design the same fifilter, but use a von Hann window instead of a rectangular window.

Using Matlab, plot the magnitude of the frequency response of this bandpass fifilter and compare it to part (d).