How do you determine the arguments to the `buttord` function?

2 views (last 30 days)
This is more of a conceptual question -- there are examples on the page for this function, but how do you select what the passband and stopband, etc. should be? I am trying to use this to build an antialiasing filter. I have a signal (time domain) that isn't bandlimited, and I'm trying to filter it before sampling, etc.

Accepted Answer

Star Strider
Star Strider on 2 Jun 2022
I use the fft function to determine the signal spectrum, and then I use that information to select the frequencies for the filter. This is useful for band-limited frequencies (although I usually use an elliptic filter because it is computationally more efficient).
For broadband noise, I use the sgolayfilt function with an order 3 polynomial and then choose a framelen value that gives the results I want.
  2 Comments
L'O.G.
L'O.G. on 2 Jun 2022
@Star Strider Thank you. Is there a way of filtering the time domain signal in an automatic way without having to, as you mention, select the frequencies for the filter? Like a general criterion for selecting the passband and stopband to input into buttord to create a robust anti-aliasing filter? Any tips / examples?
Star Strider
Star Strider on 2 Jun 2022
That in general depends on what the signal is. For example, to filter an electrocardiogram (EKG) signal, I know that designing a bandpass filter with a lower passband of 1 Hz and an upper passband of 45 to 100 Hz will produce the result I want, unless it is contaminated with broadband noise (requiring sgolayfilt) or has line frequency noise (requiring an additional notch filter). Beyond that, unless you have some intrinsic knowledge of what the signal is, there are no specific requirements.
For an anti-aliasing filter, the stopband of the lowpass filter has to be at the Nyquist frequency (one-half the sampling frequency) of the ADC. If you are resampling a signal, then the resample function already has its own built-in FIR anti-aliasing filter, so I would simply use those (or refer to that documentation for the correct procedure if you want to do it yourself).
Otherwise, if you want to remove an aliased signal from a signal that was sampled without having a hardware anti-aliasing filter at the time it was digitised, that is simply impossible. Aliased signals are already part of the sampled signal and cannot be removed.

Sign in to comment.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!