In the last blog, we discussed the basics of sampling theory and demonstrated that, if there is any energy at frequencies above the Nyquist Frequency (FN = Sample Rate/2), the data will be corrupted (aliased). There is always energy above FN so there will always be errors. Now, we need to figure out what to do about it.
Figure 1 shows the situation. The blue curve is the spectrum of the real data. If we sample at S samples/second, the spectral energy above the Nyquist frequency will fold around FN and superimpose itself on the data below FN as shown in the red curve. As we already know, there is aliasing error at all frequencies below FN but, if the spectrum rolls off at high frequency (as shown), there will be a frequency range where the error is relatively small. We now need to define a level of Acceptable Alias Error. At what frequency is the aliasing small enough to accept? We will call this frequency FA .. Our data is “Good” below that frequency and unacceptably corrupt above it.
As we can see in this example, only a small part of the frequency range between zero and the Nyquist frequency is acceptable. What can we do to improve the situation?
Figure 2 shows the effect of applying a low-pass filter that has a cutoff frequency of FC to the data. The filter reduces the energy above the Nyquist frequency so that, when it folds, there will be less corruption below FN. The frequency range with an acceptable level of aliasing is increased.
That’s the basic idea..
But we have asked the wrong question. We started with the sample rate and found out what part of the data range is “good”. It makes more sense to start with what we need and find the required sample rate.
The proper question is: What is the desired bandwidth? This is an engineering decision. Our objective is to acquire data that has aliasing error reduced to an acceptable level between zero frequency and the Desired Bandwidth (FD).
But, it’s not that simple. The problem is that we don’t have a clue what the input spectrum is. So we will make the assumption that the signal has a spectrum that is flat over all frequencies. Most of the time this will be conservative because the spectrum normally rolls off above FN (as it does in Figure 1) but this is not always the case. Let’s cross our fingers and press on.
The “geometry” of the filtered flat spectrum aliasing is shown in Figure 3. From the symmetry of the aliasing, you can see that:
..where FR is the frequency at which the filter has attenuated the input to the “Required Alias Rejection” level. (Note that we have changed from “Acceptable Alias Error” to “Required Alias Rejection” because now we are talking about rejection of aliasing error.. not the error itself.)
So, knowing our Desired Frequency Range (FD) we can determine the Sample Rate (S) that is required for a given alias rejection from EQ 1.
That is pretty useful but there is another approach that is more informative. It is based on determining the minimum number of points/cycle at our Desired Bandwidth (FD).
For this special case, we will set our Filter Cutoff Frequency to be the same as our Desired Frequency Range (FD = FC) as shown in Figure 4.
Now, we define the Sample Ratio:
SR = Sample Rate/Desired Bandwidth = S/ FD = Points/Cycle at FD.
Next, the required Sample Ratio can be shown to be:
So, let’s look at the example of an 8-Pole Butterworth filter set at 1 Hz (Figure 5).
The black curve is the filter shape that, since we have assumed a constant input spectrum, is also the shape of the response spectrum. We will put Fc (-3dB) at 1 Hz. Next, if we use 1000/1 as our Required Alias Rejection we find that the filter meets this requirement at 2.37 Hz so FR / FD ~ 2.37. From Eq. 2, the required (minimum) Sample Ratio is ~3.37.
Most of the time, we will set FD lower than FC because we don’t want the filter to attenuate the data significantly in the frequency range we care about. So, this approach will normally give us a conservative Sample Ratio.
So, that’s what an 8-pole Butterworth filter does for us. We know that we have a myriad of other filter options. Figure 6 shows the attenuation characteristics for several high-end, commercially available, filters:
(Note: Different filter types have different definitions of the filter cutoff. These curves are adjusted so that the frequencies of the -3dB (Gain=.707) point agree.)
This is the case for FC= FD where the maximum filter attenuation is -3dB (~30%) within our frequency range of interest (30% error).
If we require less attenuation at FD, we have to lower it to the point where the attenuation is acceptable. For instance, if we choose to allow only 10% attenuation at FD, then the filter characteristics look like Figure 7. The required Sample Ratio is significantly higher for the Bessel and somewhat higher for the Butterworth options. The results for the sharper filters are essentially unchanged.
Now we will apply Eq 3 to calculate the required Sample Ratio for each of these results.
Filter |
Sample Ratio for 3dB Attenuation at FD |
Sample Ratio for 10% Attenuation at FD |
Bessel (8 pole) |
5.64 |
9.05 |
Butterworth (8 pole) |
3.37 |
3.59 |
Elliptical (8P/8Z) |
2.38 |
2.39 |
Sigma Delta ∑Δ |
2.07 |
2.08 |
What we see is that, if we use a sharp filter (elliptical or Sigma Delta) we can acquire the data at significantly lower sample rates than for the “conventional” filters. In fact, the Sigma Delta filter gets very close to the ideal value of 2. With strong elliptical or ∑Δ filters, it is perfectly reasonable to use a Sample Ratio of 3 (I don’t recommend any less for reasons we will discuss in a later blog).
This process determines the minimum sample rate that you should use. Should you sample faster? It depends. A basic rule is that it never hurts to sample too fast. But, should you?
If you are restricted in sample rate or data volume by your hardware, you may not be able to sample as fast you need to get the desired time-history amplitude resolution. In that case, upsampling (the subject of a future blog) will solve the problem.
So, now I hope that you know that we need low-pass/anti-alias filters. Next, what kind should we use: Bessel, Butterworth, Elliptical, Sigma Delta, whatever. In our next blog, we will take a brief look at how analog and digital filters are “constructed” and then discuss my spin on which one(s?) you should, and shouldn’t, use.
One of the reasons I've been writing these blogs is to get a discussion going. Please reach out privately to me with any questions or comments you may have.
You can participate by:
This blog is meant to be a seminar... not a lecture. I need your help & feedback to make it good!
Strether has no official connection to Mide or enDAQ, a division of Mide, and does not endorse Mide’s, or any other vendor’s, product unless it is expressly discussed in his blog posts.
If you'd like to learn a little more about various aspects of shock and vibration testing and analysis, download our free Shock & Vibration Testing Overview eBook. In there are some examples, background, and a ton of links to where you can learn more. And as always, don't hesitate to reach out to us if you have any questions!