Introduction Moving Average Filters FIR Filters Code and data IIR Filters Transfer Functions

Finite Impulse Response, or FIR Filters

Let's try a different filter, a Finite Impulse Response or FIR filter.

Creating an FIR Filter

We'll open MicroModeler DSP and click on the Designed Filters menu. We'll choose an Equi-ripple filter designer from the toolbar at the top and drag it to our application (Equi-ripple means that the ripple in the frequency response is spread out evenly across all frequencies, which is considered a good design strategy).

After you drop the filter, the displays will be automatically updated. (Click to launch MicroModeler DSP in a new window)

Editing the filter's frequency response

With this filter, we can design almost any frequency response that we want. Find the Magnitude/Frequency graph at the top-right and use the control points to edit the shape of the desired frequency response.

On the graph, you can:

On the Equiripple Designer dialog, you can:

On the Control Point dialog, you can:

This type of filter is known as an FIR, or Finite Impulse Response filter and they typically all have the same structure as this one. As you experiment with different frequency responses, you will see that the tap strengths change.

Filter length, ripple and transition band width

If we increase the number of taps then the filter will be able to more closely follow our desired response with less ripple but the computer time (on the target system) to process each sample will be greater. Decreasing the number of taps results in more ripple but a faster filter.

FIR filters are not very good at handling sharp changes in the frequency response. You will find that when designing FIR filters, you will have to trade off sharp transitions in frequency, ripple and filter length with each other.

Impulse Response

An impulse is a pulse applied for the shortest possible duration. This means that we feed in a 1 at the first time-step and 0 thereafter, so it tells us how the filter will response to a single pulse, or impulse.

The impulse response is useful because we can determine the response to any signal by scaling and adding delayed copies of the impulse response together. It is also easy to convert the between the impulse response and the frequency response which we will cover shortly.

We can see what happens as the impulse travels along the filter in the diagram below. Each of the taps are sequentially activated by the impulse one after the other. After processing an impulse, the output of the filter will simply be the values displayed to the right of the taps, because the impulse activates only one tap at a time.

Once the impulse reaches the end, the delay elements will all be 0 and since the input to the taps is 0, the output must be 0. The impulse response can only last for as many time-steps as there are taps. This is why they are called FINITE impulse response filters.

If you look at the graph at the bottom right, you will see the impulse response of the filter. For FIR filters, the tap strengths and impulse reponse are the same and are known as the filter's coefficients. Everything we need to know about how the filter will behave can be determined from the impulse response.

The impulse response is also related to the frequency response. The impulse response is the inverse fourier transform of the frequency response and the frequency response is the forward fourier transform of the impulse response.

The frequency response is a "view" of the filter in the frequency domain. The impulse response is a "view" of the filter in the time domain. The fourier transform can be used to convert between the time and frequency domain representations of the filter.

Designing filters using the Frequency Sampling Method

You can also design FIR filters using the "Frequency Sampling Designer". You use it in the same way as the Equiripple Designer. The two are almost the same, except that:

  1. There can be "ringing", especially where there are sharp edges in the desired frequency response. This is known as the "Gibbs" phenomenon
  2. You can specify a "Window Function" in the dialog to reduce the Gibbs phenomenon. The impulse response is multiplied by the window function which smoothes the edges of the impulse response
  3. There are a variety of window functions you can use. The best way is to experiment with them. Some of the "Window functions" also have a "Window Value" which controls the shape of the window function.
  4. It uses frequency sampling to calculate the impulse response, which is similar to the fourier transform.
  5. Using the Equi-ripple method, you can directly control how much ripple there is in the filters, but with the frequency-sampling method, you do not have this control.
  6. The ripple is not spread out evenly across the frequency response. Because the ripple is spread out evenly with the Equiripple method, the maximum ripple is minimized. The Equiripple method is more popular than the Frequency Sampling method.

Specifications

Instead of using control points to define the frequency response, you can also drag a "specification" to your filter which will automatically manage the frequency response and control points for you.

Let's try dragging a low-pass specification to your design. Click on the "Designed Filters" menu and drag a low pass filter specification to your design. If you're not already working with a frequency designer, an Equiripple designer will be created for you.

If you go to the frequency response view, you will see that there are handles that you can use to adjust the specification. See the diagram below to understand what they do:

The specification will estimate the filter length for you although you may want to fine-tune it afterwards.

Now that we can design filters, the next step is to use them. The next section will cover getting code and data out of MicroModeler DSP so that we can do something useful with it.

Introduction Moving Average Filters FIR Filters Code and data IIR Filters Transfer Functions