# Simcenter Testing Solutions Tell Me What Filter You Use, and I’ll Tell You Who You Are!

2022-08-21T22:50:40.000-0400

## Details

Consider the images processed with different filters in Figure 1:

Figure 1: Three images - Original (left) and processed with filters (middle, right).

Do you prefer the ringing-middle image or the smooth-right one? And why not the left one already?

Contents:
1.  Motivation
2.  Image Processing Analogy
3.  Time is Real; Frequency is Not
4.  Why You Need an Acquisition Filter
4.1 Nyquist-Shannon
4.2 Signal is Bandlimited; Input is Not
5.2 Type and Order
5.3 Phase as Linear as Possible
5.4 Magnitude: Ideal for Frequency Might not be for Time
5.4.1 Cause of Overshoot
5.4.2 Signal Overshoot is not Gibbs
5.4.3 Sharpness versus Smoothness
6. I Don't Measure Square Waves, What About my Actual Signal?
6.1 Overshoot in My Actual Signal
6.2 Reducing Overshoot
6.2.1 Using a Linear Phase Filter
6.2.2 Using a Smooth Filter
7. Conclusion

1.  Motivation

The middle and right images were filtered and contain less information than the original. Someone even told me Gibbs appears in the middle one. Who you gonna call? That’s my immediate answer to that. But things don’t spontaneously appear; they have physical causes, although the Universe doesn’t care if we understand them. I do care, and I’ll elaborate for you.

Figure 2: Ringing artifacts in images.

Do you also recognize those ringing artifacts (Figure 2), all over the place in your (old) screen devices, or in your time measurements?

We are not talking about time ghosts; we are talking about filters! If words like “Bessel” aren’t unknown to you; if you are aware of what filter type you are using, you probably care about the time domain.

2.  Image Processing Analogy

Translating our case to images, considering a black and white image, we would have a 3D “time” (or spatial) signal, instead of our typical 2D time plot. Anyway, our 2D understanding can practically be applied following similar reasoning: We would have 2x "time" or spatial axis (x,y axis) making a plane (image). The voltage or amplitude (z axis) would be the intensity of color (white), rendering our 0V to black, and the gray scale all the way up to our max range, up to the white color. A sudden color transition, like in the images, represents a transient in the amplitude, so high frequency components in the image's FFT.

If we want to edit the left image and take out high frequency components (sudden changes in color), an overshooting filter will ring the colors near the transitions (Figure 1 middle image), while a non-overshooting filter will just smooth them out (Figure 1 right image)

3.  Time is Real; Frequency is Not

In classic frequency domain analysis, you brought your reality (time data) to the world of ideas (frequency data), and you analyzed it there, without much of a worry. You knew your bandwidth of interest, you complied with Nyquist-Shannon, and the story ended, everybody happy.

However, in your shock and break testing, road load data and durability processing, and even electric vehicle battery pyro fuse short testing, the signal time shape also matters. Nobody warned you: how to get rid of those weird, annoying, and potentially clipping amplitude inaccuracies and overshoots (Figure 3) ? And why are they there in the first place?

Figure 3: Square wave signal exhibiting overshoots at the leading and trailing edges of the square wave.

You want to get your time measurements just right: Good enough isn’t an option! Statistics, peaks, times at level, level crossings, range pairs, rain flows, and your logical triggers all depend on the time data (Figure 4).

Figure 4: Durability data relies on correct amplitude in the time domain to calculate rainflows (left) and range pairs versus level (right).

Just small changes in the amplitude can change fatigue life estimates drastically.  See this knowledge article for more information: What is a SN-Curve?.

4.  Why You Need an Acquisition Filter

The information of an analog signal is contained in its bandwidth, aka its frequency content (both in magnitude and phase). Most of our (practical) analog signals have a bandwidth between 0 Hertz and some frequency (aka bandwidth of interest). This is important especially if we are going to sample our signal and convert it to digital data.

4.1 Nyquist-Shannon

Following Nyquist-Shannon sampling theorem and its hypotheses, if your -equidistant- digital data is acquired with a sample rate higher than the double of the signal bandwidth, all the information of your original analog signal will be correctly digitized/encoded, and even perfectly reconstructed if necessary.

4.2 Signal is Bandlimited; Input is Not

If the analog signal bandwidth is below of half of the sample rate (aka Nyquist frequency), then no artifacts are possible, end of story… But wait, do we always have means to set Nyquist as high as we want? Do we have the luxury to assume that the input signal we want to measure was bandlimited in the first place? And was it free of unexpected noise, that at same time may have had contents beyond its bandwidth? And even beyond Nyquist, folding then back as alias content (Figure 5)? How to prevent that?

Figure 5: If a signal (green) is not band limited to Nyquist or below, then if will foldback to appear with lower frequency (red signals) based on its frequency content relative to the Nyquist frequency.

Think about our input signal as a combination of actual expected signal and undesired noise. Acquisition low pass filters (from now on, just filters) are then needed, whether to mold your input signal into a smaller bandwidth, or more importantly, to get rid of noise and alias.

Both for frequency and time domains, you can do two things:
• Set your measurement bandwidth right in the first place, or
• Choose your acquisition filter type wisely.
First option is impossible to predict because some information of your original input (signal + noise) may fall anyway out of your bandwidth, and so get filtered. We should then focus on the second choice, especially when talking about time domain: depending on the filter type used, overshoot might appear more, less, or not at all.

Your measurement bandwidth is already defined by the filter passband, or cut-off frequency (Fco), generally at -3dB (Figure 6). Further, implementable filters aren’t ideal:
• They won’t totally stop or totally let frequency components pass
• They will delay frequency components differently
• They need space between cut-off frequency (Fco) and stopband (i.e. transition band can’t be 0)
• Their behavior will further deviate from expectation depending on their implementation (analog, digital (FIR, IIR), etc.)

Figure 6: A filter is defined  by a pass-band, transition band, and stop band.  The cut-off frequency (Fco) delineates the pass-band and transition band, and is usually defined at the 3dB attenuation point of the pass-band.

A filter becomes then both a solution, and if you don’t choose and configure it correctly, a threat for undesired artifacts in your measurements.

5.2 Type and Order

The transfer function of a filter is basically characterized by filter type and order
• Type defines its shape and phase response in passband, transition band and stopband. There are some well-known classical filter types, most of them originating as analog versions like Butterworth, Bessel, Chebyshev, Elliptic, etc as shown in Figure 7. All of them optimize certain figures, at the price of compromising others.

Figure 7: Comparison of magnitude frequency response of different filter types.

• Order (or number of poles) sizes its buffer (i.e. energy storing devices contributing to the process delay, like capacitors for analog filters, or memory vectors for digital filters), and it will account for the roll-off (or steepness) and help to minimize the transition band (Figure 8), in compromise with filter complexity and process delay.

Figure 8: Filter roll-off performance versus order.

More about filters in the knowledge article: Introduction to Filters: FIR versus IIR

5.3 Phase as Linear as Possible

Classical analog and digital IIR filters have non-linear phase responses (Figure 9) because they are intrinsically causal. Each signal frequency component won’t propagate through the filter with the same delay.

Figure 9: Non-overshooting non-linear filter effect.

It’s always an undesirable artifact of a filter, although these filters exist since years (specially the analog ones of course), so their behavior is well known. Furthermore, IIR filters are easy to design, cheap, simple, and very performant, if we are ready to pay the price of non-linearity in their phase responses. In the time domain, this produces scattering (or asymmetries).

Phase linearity in passband, means group delay (proportional to the derivative of phase) as constant as possible, ensures minimal shape distortion and helps distributing overshoot, if any, before and after transients.

In general, increasing filter order reduces phase linearity (Figure 10).

Figure 10: Overshooting non-linear filter effect.

But there are exceptions where phase linearity improves with filter order, like Bessel and transitional filters like Gaussian.

Finally, only a subset of synthesized digital Finite Impulse Response (FIR) filters can have exactly linear phase transfer functions. So, if you can have the luxury to choose for those, go for it. I do already with my Simcenter SCADAS hardware, with both sharp and smooth linear filters choices.

5.4 Magnitude: Ideal for Frequency Might not be for Time

If we can’t accommodate our measurement bandwidth to our signal frequency content, we will lose information after filtering. You want the best filtered version for time analysis (smooth in time), which is not the best version for frequency analysis (overshooting in time). Differences between some filter types and their orders are shown in Figure 11.

Figure 11: Time domain step response of three different filters for various number of poles. Response is progressively smoother from left to right.

Good news is that if we can choose the acquisition filter like we do with Simcenter SCADAS hardware, we can tune how this impacts our measurement, especially in time domain when overshoot comes into play.

5.4.1 Cause of Overshoot

Overshoot is a product of a sharp filter transfer function magnitude, when there is frequency content falling into the stopband as shown in Figure 12:

Figure 12: As signal (green, left) is passed through a filter (middle) it can result in overshoot being added to the signal (right).

There is an actual need to store stopband energy in the filter itself, and it may be abruptly released and overlapped later into the passband. As a rule of thumb:
• The sharper the filter, the larger the overshoot amplitude
• The higher the order, the longer its duration

5.4.2 Signal Overshoot is not Gibbs

I’ve seen that The Gibbs Phenomenon is commonly confused with data acquisition artifacts, like overshoot. Although the result resembles in both cases a ringing artifact, while overshoot may (or not) be produced after filtering a signal, Gibbs phenomenon always appears after approximating a discontinuous function with a finite set of its Fourier Series (Figure 13).

Figure 13: The Gibbs Phenomenon is the result of trying to approximate a discontinuous function (black line right) with a Fourier Series (multi-colored sine waves, right).

Overshoot is a physical product of a filter, Gibbs is a mathematical consequence of a suboptimal approximation exercise.

5.4.3 Sharpness versus Smoothness

If we can’t guarantee that our signal frequency content doesn’t go beyond our measurement bandwidth, sharpness is desired for frequency domain transition band, allowing more efficient usage of our measurement bandwidth given a sample rate. On the other hand, smoothness is better for time domain, allowing smoother energy release; thus, overshoot is minimized and eventually avoided. Sharpness depends only on filter type. Smooth and sharp filters are shown in Figure 14.

Figure 14: Sharp versus smooth filter shapes.

To achieve better stopband attenuation figures using a smooth anti-aliasing filter, we should have an extra care to use higher sample rates so that Nyquist frequency gets pushed safely above cut-off frequency (Fco).

The time domain differences and frequency domain differences between sharp and smooth filters is shown in Figure 15.

Figure 15: A sharp filter (elliptic, upper left) in the frequency domain results in overshoots in the time domain (upper right).  A gradual, smooth filter (Bessel, lower left) has no overshoot (lower right).

A sharp filter (elliptic) has a narrow transition band in the frequency domain.  However, the sharp filter results in overshoots in the time domain.  A smooth filter (Bessel) has no overshoot in the time domain, but has a more gradual attenuation performance in the frequency domain relative to the sharp, elliptic filter.

6. I Don't Measure Square Waves, What About my Actual Signal?

Let’s look for a high frequency component measurement example, like this pyrotechnic events audio in CD quality (sample rate 44.1kHz) as shown in Figure 16.

Figure 16: Real world transient data (bottom) and associated frequency content (top).It’s original bandwidth extends up to around 17 kHz.

If we needed a reduced version of this original input signal because for example, amongst others:
• We are not interested in higher frequencies, that at same time may contain noise, or
• We don’t have possibility to sample high enough, or
• We needed to align our sample rate to a grid that doesn't allow a measurement bandwidth big enough for our original signal, or
• We didn’t expect signal frequency content to extend further than our predefined measurement BW

We will need to filter out some high frequency components of it. We will be then tempted to use the commonly expected ideal filter: a sharp one. For this example, we will be using a moderately sharp filter like Butterworth, and a 14th order version of it to enable an important roll-off.

6.1 Overshoot in My Actual Signal

Let’s suppose in this example we are interested in a target bandwidth of 11kHz. In time, our common sense might accept that the filtered version (green) reaches lower amplitude values, but if we look closely, this isn’t always the case: there’s overshoot in the filtered signal (Figure 17).

Figure 17: The filtered signal (green) has overshoot (positive and negative) reaching almost 30% compared to the original signal (red).

Furthermore, we can remark the delay of the filtered signal. It’s not possible to exactly correct for it, because the filter isn’t linear.

6.2 Reducing Overshoot

We may want to improve the result. We know already that if there’s overshoot at the output, filter sharpness is the only reason for it. So it wouldn’t be a surprise that trying both educing filter roll-off (by using a lower order), or increasing our bandwidth (seting cut-off frequency higher), would essentially not free our result from overshoot. Both roll-off and cut-off frequency do not play a practical role in filter sharpness: Only filter type does.

6.2.1 Using a Linear Phase Filter

We know that a sharp filter like Butterworth won’t free our signal from overshoot, but if it had a linear phase response, overshoot could at least spread before and after quick transitions as shown in Figure 18.

Figure 18: Although still using Butterworth, we improved our overshoot bringing it down to around 12% of our amplitude.

Thanks to the filter and processing offer of our Simcenter hardware and software solutions, we can try the linear phase version of our Butterworth (called “Zero phase” in Simcenter Testlab), and even correct for the delay on-the-fly.

6.2.2 Using a Smooth Filter

This is what we should go for: using a smooth filter. For example a Bessel at our target bandwidth of 11kHz as shown in Figure 19:

Figure 19: Optimal result – Independently of our 11kHz filter cut-off (measured bandwidth) and filter’s roll-off (14th order steepness), overshoot free signal is obtained when using a smooth filter like in the figure (Bessel).

Using a smooth Bessel filter, the filtered signal does not exceed the amplitude of the original signal.

7. Conclusion

The images (Figure 20), which were also presented at the beginning of the article, illustrate how filters affect data (just like time data from a transducer, picture pixels can be filtered).

Figure 20:Image on left is original picture, middle picture has a sharp filter applied, the image on the right has a smooth filter applied.

If you want to be safe of time ghosts, just join me:
• For frequency domain analysis, I always choose a sharp linear FIR filter, like the build-in decimation filter of Simcenter SCADAS Lab/Mobile/Recorder series, or the Steep FIR of the RS series. I can then set the Nyquist frequency quite close to my measurement bandwidth. Rule of thumb: 25% higher, for an excellent alias rejection at Nyquist already.
• When I’m interested in the time domain, I choose a smooth linear FIR filter, like the Gaussian filter in Simcenter SCADAS RS series, or a smooth near-linear phase filter like Bessel both in RS and Lab/Mobile/Recorder series. I set a Nyquist frequency far enough from my measurement bandwidth (rule of thumb: 1 to 5 times higher, depending on filter order), for a good alias rejection.
Simcenter SCADAS RS hardware offers wide and flexible measurement bandwidths selectable per channel, high sample rates, high throughput and storage space, wide range of acquisition filter choices for frequency and time domains, including optimized linear phase, and smooth filters enabling you to get exactly "0" overshoot in any of your measurement acquisitions.

Questions? Email aleix.riera@siemens.com.