Filters have a variety of applications in data acquisition and analysis. They are used to alter the frequency content of a time signal by either reducing or amplifying certain frequencies.
For example, as shown in Figure 1, a low pass filter affects frequency content in a signal in three different ways: Some frequency content remains unchanged, while other frequency content is either reduced in amplitude or removed entirely from the signal.
Filters can also amplify frequency content, not just reduce or remove it. The amount that a filter adjusts the amplitude of a signal can be expressed in either linear terms (i.e., amplification factor) or decibels of gain/attenuation as shown in Figure 2.
The linear scale has the following equivalents in decibel scale:
While useful to view filter characteristics in the frequency domain, filters perform their work in the time domain (Figure 3).
A filter takes a time domain signal as input, modifies the frequency content, and outputs a new time domain signal. This can be useful in a variety of applications.
Applications of Filters
Filters are used in different ways, from signal cleanup to analysis.
In some applications, filters are used to condition a time domain signal by attenuating unwanted frequency content. Examples include:
Sometimes filters are used to introduce specific characteristics into signal data for analysis:
Filters can be implemented in analog (for live signals) systems or digitally (for manipulation of an already recorded signal on a PC).
Filters can be designed for different tasks. For example, a filter could be classified as either a high pass, low pass, band stop, or band pass (see Figure 5):
These filter types can be implemented using either FIR or IIR filters. It is also possible to use a combination of these to produce an arbitrary shaped filter.
FIR versus IIR
Two classes of digital filters are Finite Impulse Response (FIR) and Infinite Impulse Response (IIR).
The term ‘Impulse Response’ refers to the appearance of the filter in the time domain. Filters typically have broad frequency responses, which correspond to short duration pulses in the time domain as shown in Figure 6.
The equations for both an IIR and FIR filter are shown in Equation 1. The input to the filter is time series x(n), and the output of the filter is a time series y(n). The first sample in the time history is at n=0.
The mathematical difference between the IIR and FIR implementation is that the IIR filter uses some of the filter output as input. This makes the IIR filter a ‘recursive’ function.
Each equation has three series of numbers: an input time history, a filter, and an output time history (Figure 7).
The series are:
In practice, FIR and IIR filters have important performance differences as summarized in Figure 8.
An IIR filter has an advantage that for a similar filter roll off as a FIR, a lower order or number of terms can be used. This means that less computations are needed to achieve the same result, making the IIR faster computationally. However, an IIR has nonlinear phase and stability issues. It is a bit like the fable of the tortoise and the hare. The FIR filter is like the tortoise in the race – slow and steady, and always finishes. The hare is like the IIR filter – very fast, but sometimes crashes and does not complete the race.
These differences are discussed in more detail in the next sections.
Filter Order and Computational Speed
From the FIR filter equation in Equation 1, the higher the number N, the higher the “order” of the filter. For example, if there were 5 terms in the filter versus 10, the filter computations would take twice as long. However, the filter roll off would be sharper, as shown in Figure 9.
A filter with more terms (i.e., a higher order) has a sharper transition between the frequencies being passed and the frequencies being stopped.
An example comparison of the same filter type, calculated with different orders, is shown below in Figure 10.
Making a filter sharper is done by increasing the order. This requires more calculations, and also has an impact on the time delay introduced by the filter.
The sharpness of FIR and IIR filters is very different for the same order as shown in Figure 11. Because of the recursive nature of an IIR filter (see Equation 1), where part of the filter output is used as input, it achieves a sharper roll off with the same order filter.
Conversely, fewer terms can be used in an IIR to achieve the same performance as an FIR as shown in Figure 12.
This makes IIR filters faster from a computational point of view than FIR filters. If a filter has to be implemented in real-time application (for example interactive filtering while listening), it is typically done with an IIR filter.
However, there are some potential drawbacks to using an IIR filter:
Time Delay and Filters
After applying a filter to time data, and comparing to the original time history, a slight shift, or time delay, can be seen in the data. In Figure 13, simultaneously acquired sound (red curve, top) and vibration data (blue curve, bottom) are shown. Filtering the sound data (green curve, top) causes events between the sound and vibration to not be aligned.
In some applications, this would not be a problem – the offset is known, and can be ignored.
In other applications, this delay might be important. For example:
What causes a filter to introduce a time delay in the output time history?
Take the equation for a FIR filter from Figure 14. Working through the equation, the cause for the time delay can be observed.
A number of time data samples from the input signal (x) must pass thru the filter that is proportional to the number of terms (N), before the filter will work. The filtered output data does not start until the number (n) data points passed through the filter is greater than N.
Because some data must pass through the filter to even create an output, a delay in the output time history (y) is created when compared to the input time history (x) as shown in Figure 13. By making the filter sharper, this delay is increases.
The delay characteristics of a FIR and IIR filter are very different as shown in Figure 15.
A FIR filter has equal time delay at all frequencies, while the IIR filter time delay varies with frequency. Usually the biggest time delay in the IIR filter is at the cut off frequency of the filter.
All filters create a delay of some sort – analog and digital. Depending on the filter characteristics, the delay can be shorter or longer. They can also be variable as a function of frequency.
Direct vs Zero Phase
The delay in the output time history can be eliminated by filtering the data ‘forward and backward’. After the time history x(n) is filtered, and the new output time history y(n) is created, it can be fed backward into the filter. The data points in y(n) are reversed in order in time to do this, and fed into the filter again. This is referred to as “zero phase filtering”. The result is shown in Figure 16.
Notice that the time delay is at the end of the zero-phase filtered trace (blue).
Not only is the output y(n) of the “zero phase” filter time aligned with x(n), the data is filtered twice, so the attenuation is doubled. There are trade-offs when using zero phase filters:
Filter Methods and Attributes
The coefficients, a(n), of a filter can be selected to control specific filter attributes. The coefficients, or methods, affect filter attributes shown in Figure 17.
There are four main filter attributes that methods affect:
FIR Filter Methods
Methods for Finite Impulse Response (FIR) filters are listed below, and shown in Figure 18:
The FIR methods use different spectral windows when transforming from the frequency to time domain. Some of the window methods include:
Methods for Infinite Impulse Response filters are shown in Figure 19:
Attributes of the different IIR filter methods:
A filter method can be selected to best suit a particular application.
Filtering in Simcenter Testlab
The filtering capabilities of Time Signal Calculator are in the Conditioning group. To add a lowpass filter, the function is called “FILTER_LP” as shown in Figure 20.
When adding the function, the type of filter (IIR versus FIR), order, method, etc can be specified as shown in Figure 21.
The "Sample Frequency" selection has no impact on the filter performance or properties. It is simply for defining the frequency range over which to visualize the filter shape.
The “Show” button can be used to visualize the filter shape, phase, and group delay.
For more instructions on using Time Signal Calculator to do filtering, see the Testing Knowledge base article: “Time Signal Calculator Tips!”.