Subject: DSP lab hints Several students came to my office this afternoon and asked how to use a filter and how to use a for loop. I think these are common questions that many of you may want to ask (some of you may already figure out, you may want to skip this message). I will summarize my answers to the above questions in this mail. NOTE: the explaination is long, please be patient and read it carefully. 1) How to use a "filter" in MATLAB? A fitler in matlab is a function has the following form y = filter(b,a,x) In order to use it, you have to specify b, a, and x, where b and a are the coefficients to define your filter system and x is your input signal. b and a are found by matching your difference equation into the following general difference equation form: a(1)y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb) - a(2)*y(n-1) - ... - a(na+1)*y(n-na) Take y(n) - 0.9*y(n-1) = x(n) for example. First, you have to rewrite your difference equation into the same form as the general form, i.e., y(n) = x(n) + 0.9*y(n-1) Second, match it to the general form there is only an x(n) term, hence nb = 0, you only have one term for b, i.e. b(1) = 1, notice b(1) is the coefficient in front x(n) na = 1 since we have a y(n-1) term, and a(1) = 1, notice a(1) is the coefficient in front y(n) a(2) = -0.9, since -a(2) = 0.9, The final b and a can be written in matlab as following b = 1; a = [1 -0.9]; Now once you defined x in MATLAB, you can type y = filter(b,a,x) to compute your output signal. 2) How to use a for-loop to generate a sinc function? For example, to generate signal x = sin(w)/w, where -10