Jerome, I saw the scripts so at least your convolve works for (1 + z^-1)^N and generates Pascal's triangle. Now try (1 + 0.5z^-1)^N for 1<=N<=6 and check by hand. If this works you can be pretty sure your convolve is working. ----------------------------------------------------------------------------- Subject: Project Question >Should we use the built-in sinc funtion in Matlab or sin(x)/x? >This also leads to another question: Is the sinc function defined as >sin(x)/x or sin(pi*x)/(pi*x)? According to Communication EE546's >book and Matlab, sinc(x) is defined as sin(pi*x)/(pi*x). At least one of my DSP books defines sinc(x) = sin(x)/x (call this definition #1). At least one of my DSP books defines sinc(x) = sin(pi*x)/(pi*x) (call this definition #2). All my communication books use definition #2. I was taught with definition #1 so that's why I presented it to you in this way. All my algorithms assume definition #1. The advantage of definition #2 is that with the right choice of x, the zero crossings are at integer values. On the other hand definition #1 seems more natural so we don't have to carry pi around. Also the ideal LPF can be written quicker and in slightly more compact form using definition #1. For example, on p. 54 of Ludeman, (1.25) gives the impulse response of the ideal LPF with cutoff omega_c as: h(n) = sin(omega_c n)/(pi n) Using definition #1 this is equivalent to: h(n) = (omega_c/pi) sinc(omega_c n). Using definition #2 this is equivalent to: h(n) = (omega_c/pi) sinc(omega_c n / pi). The former is slightly more compact and easier to attain. My final advice (after this thesis): stick to one definition (I don't care which) just be sure you use it consistantly and correctly. ----------------------------------------------------------------------------- Q: I have questions about last problem.First why do we need to use HPF? I think we only need to use LPF and BPF. Second what is the purpose for "MODULATE"? What is w0? Finally how can we get gain of a filter? Thank you for help. A: The hearing aid needs a HPF for high frequency compensation. If you can compensate without a HPF be my guest but you'll need to prove to me your idea is sound. Since all filters are bandpass (LPF = BPF with w1 = 0, w2 = wc; HPF = BPF with w1 = wc, w2 = pi) this might be what you really mean instead. In any event you need modulate to construct the BPF from LPFs. Remember, we can't use frequency_shift since the non-uniform frequency bands would mean complex output. Finally, I explicity show how to set the gain of the filter towards the end of the problem. -----------------------------------------------------------------------------