5
\$\begingroup\$

I appreciate that different applications have different criteria, but could someone give a ball park figure of how much attenuation is needed for an anti aliasing filter at the Nyquist frequency to prevent aliasing?

For example I'm building a filter for the input of my PIC which samples at 10KHz and therefore the Nyquist frequency is 5KHz. I'm only interested at parts of the signal below 3KHz, so I have some leeway in my design as to whether I choose a second order/third order low pass filter, but I don't know which to design because I don't know how much attenuation at 5KHz would be sufficient?

\$\endgroup\$

2 Answers 2

12
\$\begingroup\$

If you are interested only in signals in the range DC to 3kHz, then only signals above 7kHz will alias onto those.

This means that you need a filter with ...

a passband to 3kHz
a transition band from 3kHz to 7kHz
a stopband from 7kHz upwards

Note this doesn't define the 5kHz attenuation, and doesn't need to.

The stopband must have enough attenuation to protect your signals. If you want 0.1% fidelity for your lowpass signals, you need 60dB attenuation in your stopband. You will usually find it more practical to design an elliptic filter than a classical Butterworth or Cheby to get adequate stopband attenuation.

Now comes some subtlety, follow me carefully.

What does 'if you are only interested in signals in the DC to 3kHz' really mean?

If you are bandpass analysing signals up to 3kHz, for instance estimating the power in the bandwidth 2.5kHz to 2.7kHz, using a good digital filter to isolate the band, or an FFT which is equivalent, then having a transition band from 3kHz to 7kHz is just fine.

Although it allows signals in the 5k to 7k band to alias down to below 5kHz, they are still above 3kHz, and you're going to ignore/reject those signals anyway.

If however you are plotting the samples on a scope trace, then you may have inadvertent energy above 3kHz that is still valid. For instance if you have a 1.1kHz square wave, you will have harmonics at 3.3kHz, 5.5kHz, 7.7kHz.

Now, the crucial point is that the 3.3kHz harmonic will be coherent with the fundamental, and if you plot it, it will look OK, even if its amplitude has been suppressed a little by the filter. However, the 5.5kHz harmonic will be aliased to 4.5kHz, and will be incoherent with the fundamental because its frequency has been reflected through Nyquist, and will breathe in and out as its phase changes, and will generally look wrong.

What this means is, if you are going to end up making use of energy in the 3kHz to 5kHz band anyway (even though you've said in the OP that you're not), then your transition band should only go to 5kHz, not 7kHz, so that no aliasing at all is permitted into the DC to 5kHz band.

Whether your filter has a stopband from 7kHz, or from 5kHz, depends crucially on what you intend to do with your signals. Needless to say, it's much harder to make a filter with a 3k-5k transition band, than a 3k-7k transition band.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ @Andyaka well I like to think I was answering the question he actually asked, and some of the ones he didn't. \$\endgroup\$
    – Neil_UK
    Dec 13, 2016 at 10:46
  • \$\begingroup\$ The way you consider the transition width implies inviting the already aliased 5k-7k signals, and the signals from 3k to Nyquist poorly attenuated. Unless your transition width has a strange "skirt", Nyquist should be really considered the stopband. But, for this case, the order, even for a Butterworth, would be low enough. \$\endgroup\$ Dec 13, 2016 at 16:11
  • \$\begingroup\$ What @Andyaka said. \$\endgroup\$ Dec 13, 2016 at 16:40
  • 2
    \$\begingroup\$ Regarding how much attenuation is needed, although the OP was trying to avoid it, it's "application-specific." But one good rule of thumb can be derived by considering the expected dynamic range of the signal that you expect. If it only has, say, 20 dB of dynamic range, then you might be able to get away with pushing your stopband down by 30-40 dB while still ensuring that any aliased components are notably smaller than your signal of interest. That's what you really want to ensure, but the attenuation you need is really only knowable given some characteristics of the end application. \$\endgroup\$
    – Jason R
    Dec 13, 2016 at 19:03
  • 2
    \$\begingroup\$ If there's significant headroom between Nyquist and the highest frequency of interest, content which gets captured or aliased in that range can often be filtered digitally. One of the reasons oversampling is popular is that it if one captures at 20kHz for purposes of capturing signals below 3khz, one will likely be able to use some simple digital processing to take out everything between 5kHz and 15khz, allowing use of a relatively shallow analog filter. \$\endgroup\$
    – supercat
    Dec 13, 2016 at 19:54
4
\$\begingroup\$

Could someone give a ball park figure of how much attenuation is needed for an anti aliasing filter at the Nyquist frequency to prevent aliasing?

Aliasing: -

enter image description here

You will NEVER prevent it, you have to live with the consequences and do the best you can to ensure that aliased artifacts remain below an acceptable level. What is an acceptable level - you have to define this, not me.

If the Nyquist frequency is 5 kHz and there is a frequency present of 5.1 kHz, after conversion this becomes 4.9 kHz (thank you @neil_UK for spotting my mistake) so, if you have a 10 bit ADC and want this signal to be at the 0.1% level (compared to full-scale) then you need a filter that has 1000:1 attenuation at 5.1 kHz.

A third order filter has 60 dB/decade roll off and 60 dB attenuation is 1000:1 therefore, the pass band of the filter needs to be set at 510 Hz.

Higher order filters: -

enter image description here

If you choose a 6th order filter then the 10:1 range in frequencies needed to get 60 dB attenuation becomes more like a 3:1 range for a 6th order low pass filter so, your pass band would be approximately 1700 Hz.

\$\endgroup\$
8
  • \$\begingroup\$ no Andy, Nyquist of 5k, signal of 5.1k becomes 4.9k! 9900Hz becomes 100Hz. \$\endgroup\$
    – Neil_UK
    Dec 13, 2016 at 10:32
  • \$\begingroup\$ @Neil_UK - oops - fix on the way and thanks for that! \$\endgroup\$
    – Andy aka
    Dec 13, 2016 at 10:40
  • \$\begingroup\$ So if you had a frequency component at 4.9KHz with an amplitude of 2 lets say, and one at 5.1KHz with an amplitude of 3. Without any filtering would that appear that the 4.9KHz peak has an amplitude of 5? \$\endgroup\$ Dec 13, 2016 at 14:49
  • \$\begingroup\$ @genericpurpleturtle if they match in phase yes but, more likely they will swish in and out of phase producing an array of amplitudes between 0 and 5. \$\endgroup\$
    – Andy aka
    Dec 13, 2016 at 14:51
  • \$\begingroup\$ Okay so just to clarify if they are out of phase the amplitude measured would vary each time the same signal was sampled and analysed? \$\endgroup\$ Dec 13, 2016 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.