FIR Filters (Part 1)
FIR filters (Finite Impulse Response) Filters are one of two primary types of digital filters used in Digital Signal Processing (DSP) applications, the other type being IIR (Inifinite Impulse Response).
Many papers cover the theory from FIR and IIR filters, from which we will retain an important aspect: they are quite easy to implement! As long as you can design the filter itself… Apart from this, they have two other major advantages compared to other types of filters: they do not require feedback, and they are inherently stable. This stability is due to the non propagation of errors (e.g. roundings) along the recursive calculations.
Filters are signal conditioners. Whatever the filter type, it reads an input signal, blocks specified frequency components, and passes the original signal minus those components to the output.
Filtering is applied in a recursive manner: the centre point of the filter is superimposed over each consecutive input data point. Each coefficient from the filter is multiplied by the input data point value; the filtered value of the centre point is the sum of all the previously calculated products. Under these conditions, half the filter length leading and half the filter length trailing data cannot be processed, and a delay shall be induced between the incoming data and the output data. Thus the non-causal property. The following screen capture illustrates how FIR is implemented using a 6t order filter over a sequence of random values.
The most common filters are low-pass, high-pass, band-pass, and band-stop.
- Low-pass filter will only keep the frequencies below a transition frequency. E.g. Low-pass filter will keep the bass from a wave signal
- High-pass filter will only keep the frequencies above a transition frequency. E.g. High-pass filter will keep the treble from a wave signal
- Band-pass filter will only keep the frequencies between two transition frequencies. E.g. Band-pass filter will only the voice frequencies (say 1 to 8 kHz) from a wave signal
- Band-stop filter will remove the frequencies between two transition frequencies. E.g. Band-stop filter will remove the hum caused by the AC power supply at 50/60 Hz from a wave signal
There are multiple ways for designing a FIR filter. The simplest is probably the window method. This method requires the following parameters:
- Filter type (as explained above)
- Filter Length (number of taps)
- Sampling frequency
- Transition frequencies
- Windowing function
The longer the filter, the more finely the response can be tuned. The number of taps is equal to the filter order + 1. For code economy and simplicity, the number of taps shall always be an odd number; in the context of this project. The decision is based on the fact that high pass filters requires an odd number of taps, and I arbitrarily
extended this requirement to the other types of filters.
Exercise FIR filter with intuitive applets (Click on Digital Filters)