Tradeoff Sampling rate / bandpass filter design
1 view (last 30 days)
Show older comments
Dear all, I'm usually sampling my data with 20 kHz and want to filter the data with a butterworth filter. My question: if I filter the data from e.g. 30-90 Hz. If I use the simple b,a filter logic
nyquist=10000;
Wn=[30, 90]/nyquist;
[b,a]=butter(4,Wn,'bandpass');
filtered_signal=filtfilt(b,a,signal);
Is it still a good filter design, or is the order of 4 or even 3 to small to gain a valid filter result? Was I read in the threads, there is a tradeoff between the sampling rate, the filter order and the narrowness of the passband....
Thanks for your experience. Best, Peter
0 Comments
Answers (1)
Star Strider
on 18 Aug 2015
I suggest using the buttord function to calculate the filter order, and then use the second-order-section implementation in the actual filter operation. The full discussion is here.
1 Comment
Star Strider
on 19 Aug 2015
I’m not sure you need this line:
hd=dfilt.df2sos(sos,g);
I would just use the ‘sos,g’ results in the filter.
Filter design is heuristic. I don’t know what you want to do or what is not working, since you didn’t describe it.
Experiment with different passband and stopband values, since that is the most difficult part of bandpass (or bandstop) filter design. I usually begin specifying the stopband with [0.5, 1/0.5]*Wp (with ‘Wp’ the desired passband in a bandpass filter), and then increase the rolloff to [0.8, 1/0.8]*Wp or so until I get the behaviour I want.
Alternatively, consider a different filter design, for instance Chebyshev or something with a sharper rolloff, if that’s the problem.
See Also
Categories
Find more on Digital Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!