I am designing some Downsampling filters using the remez exchange algorithm (Matlab FDAtool). I see that some times i get a spike at the first and last coefficients. does anybody knows why is that? my intuition seems to be that this can introduce some artifacts to the signal.. What will be the consequance of multiplying the filter by a window (hamming and so on) to reduce this edge effects?
The "spikes" (they are quite small in magnitude, but large compared to the nearby filter taps) at the beginning and end are part of how the equiripple property is achieved. In his book "Multirate Signal Processing for Communication Systems" (a book that I recommend quite highly), fredric harris indicates that it is sometimes advantageous to eliminate the spikes because it causes the frequency response to continue to decrease after the cut-off frequency instead of staying constant. The price you pay is that the filter is no longer equiripple which appears to cause (see example below and comments by JasonR) the transition band to be not as sharp.
EDIT: I created a low-pass filter in Octave using remez. I intentionally made the transition-band very small to get it to create a decent spike. The filter taps are plotted below.
Here is the frequency response of the filter.
As you can see, the frequency response is pretty poor due to the short transition-band, but the point is that it is an equiripple filter. Below I plot the exact same filter, only I have zeroed out the two spike taps.
Below is the frequency response of the "no spikes" version of the filter.
The frequency response shows the continued drop beyond the cutoff frequency. It also clearly shows the non-equiripple response in the pass-band. This is entirely expected. The one thing that is unexpected is that the "no spike" filter appears to be better than the "spike" filter at every point. I assume that this is because of some flaw in Octave's remez algorithm.
This was an interesting thread.
It's interesting to note that if you use an FIR filter, having the spikes at the beginning and end of its impulse response, to filter an audio signal, there will be a faint (low-level) 'click' at the beginning and end of your filtered audio signal. Some people can hear, and are bothered by, those clicks.