FIR Bandpass question about order and sampling rate

2 views (last 30 days)
Hello, I have Local Field Potential Data that I am looking to filter. I would like to filter it for the gamma oscillation frequency zone. I am looking to use Filt Filt as the zero phase delay with the designfilter funciton. I have a question about the filter order and sampling rate. My sampling frequency was a 1000. It is a continuous data set. I have tried looking for the best order and sampling rate for the filter, but I am still foggy on what it should be.
d = designfilt('bandpassfir','FilterOrder',Fi, ... 'CutoffFrequency1',4,'CutoffFrequency2',12, ... 'SampleRate',Fs); zerophasedelayfilter = filtfilt(d,data);

Accepted Answer

J. Webster
J. Webster on 14 Apr 2016
When designing your filter, the sampling rate should be set to the sampling rate that you took the data with, in your case 1000Hz.
As for the rest of your problem, there is no set "best order" for a filter. You can increase the order and give yourself a sharper roll-off if you want, (I believe the order just has to be less than the number of samples in your data set). However, the higher the order of the filter, the longer the calculation takes.
What I typically do is use designfilt (without any arguments) or the Filter Design and Analysis Toolkit, with order set to 'Minimum'. I pick the upper and lower stop/pass bands to be suitable for my application, then let the program determine the order.
  2 Comments
Krispy Scripts
Krispy Scripts on 14 Apr 2016
Benefits of higher order filters for sharper roll off?
Nyquist frequency rules are important for recording data, but not data analysis then?
J. Webster
J. Webster on 14 Apr 2016
the rate of roll off depends on your application, if you need 3 db/octave, or 6 db/octave, or whatever. That is application specific and you need to determine that.
Not sure what you are asking about Nyquist frequency rules. The Nyquist frequency simply states that in order to resolve a frequency in the fourier spectrum, then you need to sample at at least twice that frequency.
One specific thing regarding Nyquist and filters is that you will usually want a low-pass filter set at the Nyquist frequency to eliminate any aliasing. But this needs to be done BEFORE the digitization. So if you are recording/analyzing audio up to 20 kHz, you would need to sample at at least 40 kHz, and you would want an anti-aliasing filter set at 20 kHz in line just before the recorder.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!