How can I use the "filtfilt" function with a "dffir" filter object created using Filter Designer (fdatool)?
4 views (last 30 days)
Show older comments
MathWorks Support Team
on 21 Dec 2016
Answered: MathWorks Support Team
on 9 Jan 2017
How can I use the "filtfilt" function with a "dffir" filter object created using Filter Designer (fdatool)?
I have designed a FIR (finite impulse response) filter using the Filter Designer and I have generated MATLAB code for it. The output of my code, "Hd", is a filter object of type "dffir". How could I apply this filter on some data using the "filtfilt" function?
Accepted Answer
MathWorks Support Team
on 21 Dec 2016
The "filtfilt" function can be executed by inputting the numerator and denominator of a filter, followed by the signal to be filtered. So if you could extract the numerator and denominator of "Hd", you could simply pass these as input arguments to "filtfilt".
The numerator coefficients of "Hd" can be accessed as properties of the filter object with the syntax "Hb.Numerator". Notice that "Hd" is a finite impulse response filter, and hence its denominator coefficient is simply 1.
Based on this information, you could use "filtfilt" with your filter object "Hd" as follows:
y = filtfilt(Hd.Numerator,1,x);
Where "x" is the signal that you are filtering and "y" is the filtered output data.
0 Comments
More Answers (0)
See Also
Categories
Find more on 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!