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

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

*h**F IR,LP *[*n*] = *w**N *[*n*] *× * *ω*

*c **π *sinc *ω**c **π **n **− **N *2 *− *1 0 *≤ **n **≤ **N **− *1 (1)

where *N *is the number of fifilter coeffiffifficients and *w**N *[*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 *h**BP *[*n*] = 2 cos (*ω*0*n*) *h**LP *[*n*] (2) which was derived for an ideal lowpass fifilter *h**LP *[*n*], to include the delay for a delayed version *h**LP,delayed*[*n*] as follows *h**BP *[*n*] = 2 cos *ω*0 *n **− **N *2 *− *1 *h**LP,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 *ω/π*.

*S*1 :*H*(*z*) = 1 + *z **−*2

*S*2 :*y*[*n*] = *−*0*.*9*y*[*n **− *1] + *x*[*n*]

*S*3 :*y*[*n*] = 0*.*8*y*[*n **− *1] + *x*[*n*] *− **x*[*n **− *1]

*S*4 :*H*(*z*) =4X*k*=0*z **−**k *

*S*5 :*H*(*z*) =1 + 2*z **−*1 + *z **−*21 + 0*.*64*z**−*2

*S*6 :y=fifilter([1,1,1,1,1,1],[1],x)

*S*7 :*H*(*z*) =11*−*0*.*64*z**−*2

*S*8 :*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 *f**s *= 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 (*f**c*). *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 *h**LP *[*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 *h**HP *[*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 *f**s *that should be used for this DSP system?

(b) With a sampling rate equal to *f**s*, 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 *h**LP *[*n*] of this fifilter.

(c) Find the impulse response *h**BP *[*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 **h**BP *[*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).