Lowpass vs bandpass filtering
8 views (last 30 days)
Show older comments
Otto Randolph
on 20 Jun 2024
Answered: Star Strider
on 20 Jun 2024
I'm having troubles using the lowpass filter. Here is the code I use.
Yacc=lowpass(Yacc,high,fs);
I set the filter to 100 Hz and looking at the power spectrum graph the filter doesn't kick in until well over 2kHz.
I don't have this problem using a bandpass filter. I use this code.
Yacc = bandpass(Yacc,[low high],fs);
Filtering from 10 to 100 Hz gives me this power spectrum graph.
Can someone explain what I'm doing wrong
0 Comments
Accepted Answer
Star Strider
on 20 Jun 2024
The functions may by default design a FIR filter, and FIR filters have problems with some signals, since the FIR filter order may be dictated by the length of the signal. I generally force these functions to design an IIR filter by specifying the name-value pair 'ImpulseResponse','iir'.
Try this instead —
Yacc = lowpass(Yacc,high,fs,'ImpulseResponse','iir');
Yacc = bandpass(Yacc,[low high],fs,'ImpulseResponse','iir');
Those should design very efficient ellipic filters.
Both functions have a second output, that being the digital filter object itself that you can then use in other instances in your code, rather than designing the filter again each time you call the function. Use the digital filter objects with the filtfilt function for best results.
.
0 Comments
More Answers (0)
See Also
Categories
Find more on Digital Filter Design 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!