filtfilt() does not return expected results
2 views (last 30 days)
Show older comments
I am reading the recording 'sig' from a .csv file with the xlsread() command and then proceed to filter it with a bandpass filter designed with the designfilt() command. When I use the filter() command to filter the recording it works fine, but when I use filtfilt() it returns a completely different result and does not just compensate for the delay.
Below is the part of the code regarding the filter design and filtering of the signal. I have also attached both the .csv and .m files. Thanks
d = designfilt('bandpassiir', ... % Response type
'StopbandFrequency1',0.99*Fpass1, ... % Frequency constraints
'PassbandFrequency1',Fpass1, ...
'PassbandFrequency2',Fpass2, ...
'StopbandFrequency2',1.01*Fpass2, ...
'StopbandAttenuation1',80, ... % Magnitude constraints
'PassbandRipple',1, ...
'StopbandAttenuation2',80, ...
'DesignMethod','butter', ... % Design method
'MatchExactly','passband', ... % Design method options
'SampleRate',Fs); % Sample rate
filt_sig1 = filter(d, sig);
filt_sig2 = filtfilt(d, sig);
0 Comments
Answers (1)
Star Strider
on 18 Apr 2015
I don’t completely understand the problem you are having.
The two filtering algorithms differ in that filtfilt is phase-neutral, while filter is not. Therefore, the outputs of the two filtering functions will differ, and by the design of the filtering algorithms.
2 Comments
Star Strider
on 18 Apr 2015
Note that ‘phase neutral’ also implies ‘no phase distortion’. ‘Phase distortion’ is the rule rather than the exception for all filters except for the algorithm used in filtfilt, and in hardware the Gaussian filter design.
See Also
Categories
Find more on Digital Filtering in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!