I have created a filter using FDATOOL. When I export the filter to the workspace, it is stored as a DFILT object. When I extract the numerator and denominator of this object and pass them as arguments to FILTFILT, I receive unexpected results due to loss of numerical precision in converting the SOS matrix to a transfer function. How may I use FILTFILT with a DFILT object without losing precision?
Neeta Dsouza answered .
2025-11-20
1) Set the 'PersistentMemory' attribute to true for the DFILT object.
2) Depending on your need, you may want to define certain initial states for the filter. Additionally, you may choose to expand the input signal to flush out the transients in the end. For details, please consult the references listed in the following document:
3) Filter the input using FILTER:
filter(dfiltobj,filt_input)
4) Reverse the output sequence and pass it through the filter again.
You may find the 'flipud' command useful for this. For more information please consult the documentation by executing the following at the MATLAB prompt:
doc flipup
5) Reverse the output sequence
6) Remove the transient guard if you used one in step 2.