## Digital Anti-Alias Filters | ||||||||||||

## All-digital anti-aliasingThe established doctrine is that to avoid aliasing you must apply analog hardware filtering prior to sampling. However, this is not really correct — you do not need filtering if the signal is already suitably ## Aliasing: A quick review
Aliasing is a potential hazard any time a continuous signal is digitized. Waves at multiple frequencies can produce exactly the same set of samples for a given set of equally-spaced sampling instants.
Aliasing is not necessarily bad thing, when you have additional information about the frequency band of your waveform, so that you can mathematically reconstruct the waveform shape by appropriately shuffling the sample values. However, for typical measurements of sound, vibration, pressure, displacement, and so forth, aliasing is You are guaranteed that there is no aliasing problem if you have no frequencies present in your original signal above 1/2 of your sampling frequency. Otherwise, you could be in serious trouble. ## Traditional hardware filteringThe traditional solution is to insert anti-alias lowpass filters into your input signal path prior to sampling, and then sample at the intended rate for your data set. To preserve the accuracy in the band of frequencies you care about, the cutoff frequency of the filter must be considerably higher than the preserved band. To sufficiently attenuate frequencies that could cause aliasing, the cutoff frequency of the filter must be considerably lower than the sampling rate. This is a good but imperfect solution. Most of the information returned in the data set is unusable, distorted by the rolloff characteristics of the filter. Two popular choices for the anti-alias filter are Butterworth filters, with good gain flatness in the band you care about, but with phase distortions that alter the shapes of your waveforms; or Bessel filters, much better at avoiding phase distortions but at the expense of poor gain flatness in your low frequency band. Configuring an anti-aliasing filter properly is surprisingly difficult. The following illustration shows the magnitude response characteristic of a 4th order Butterworth filter. It seems like this should work well.
Observe the very flat response at low frequencies, and the vigorous rejection of high frequencies. But careful analysis reveals that to preserve the desired low frequency band with 14-bit accuracy (a slight compromise), while also guaranteeing −60dB high-frequency rejection of any aliasing effects (sometimes a compromise), the sampling frequency must be higher than the preserved band by a factor of 50. This is why in practice the filter chosen is usually much higher order. However, higher-order filters are more complicated and expensive to build, sensitive to design parameters and component tolerances. Another article [2] on this site discusses the relationship between the sampling frequency you choose, and the anti-aliasing hardware you select. ## A digital solution to anti-aliasingInstead of removing extraneous frequencies prior to aliasing, the digital approach uses a much higher sampling rate and captures There are lots of applications where signals are driven by sensors with inherent band limits. Your microphone might respond through 20 KHz. But what about 250 KHz? Typically, the physical elements can't move that fast. High frequency rolloff of the built-in preamplifiers further attenuates the signal energy to a virtual zero at such high frequencies. The side effect of using elevated sampling rates is a massive and redundant data set. It would make sense to reduce this data back to a reasonable lower rate. However, doing this by a simple decimation process would result in the same aliasing that you would get digitizing the data at the low rate in the first place. This is where the AAMFILT processing comes into play. It allows you to reduce the high-rate sample stream to a more reasonable and desirable lower rate, without aliasing. The anti-aliasing filters are automatically customized to your application, to completely remove all frequencies above the Nyquist frequency of the reduced signal before rate reduction. There is As you can see in the upper part of the illustration, the red band has the frequencies that you care about, while the white band represents all of the frequencies with the potential to corrupt your data set through aliasing. The filtering removes that white band completely. After this, simple decimation is completely safe. ## Special AAMFILT featuresAnybody who has used a digital filter will know that its frequency response characteristic is tied to the sampling rate of its data stream. Clock the data through twice as fast, and the effective filter passband doubles in width. If you decide that you need to change the sampling rate for some reason, this probably means that your digital filters must be redesigned to keep your filter cutoff frequency more or less the same. The AAMFILT processing, however, does not have this problem. Your filtering is custom-configured to whatever rates you specify. In theory, only an infinite-length filter can preserve all of your signal band perfectly to the Nyquist limit at the reduced sampling rate. Most people do not have the patience to wait for this computation to complete. So, the AAMFILT processing compromises a little. It does not attempt to preserve flatness above 80% of the theoretical Nyquist limit. Instead, there is a transition band between the frequencies that are completely preserved and high frequencies that are completely rejected. The AAMFILT processing enforces the following rolloff envelope. Your spectrum will show this kind of shape regardless of the rate you select. Some people will apply excellent instrument-grade electronic filters in a classical anti-aliasing filter scheme, and think this gives them the best possible measurement accuracy. Actually, when you take into account the known damage that a theoretically perfect filter would cause, disregarding the practical hardware limitations, the results are not close to ## Footnotes and References:
Return to the DSP page. |