| General > General Technical Chat |
| Matlab Zero-Phase Digital Filtering Question |
| (1/1) |
| joeqsmith:
I am attempting to replicate MatLab's filtfilt function. I'm curious if we have any MatLab users that may be able to explain the details of how they handle the start-up and ending. --- Quote ---filtfilt minimizes start-up and ending transients by matching initial conditions. Do not use filtfilt with differentiator and Hilbert FIR filters, because the operation of these filters depends heavily on their phase response. --- End quote --- https://www.mathworks.com/help/signal/ref/filtfilt.html |
| ejeffrey:
I'm not sure exactly how filtfilt does it but I think you start with the filtic function: https://www.mathworks.com/help/signal/ref/filtic.html Calling filtic with x and y values corresponding to the first value in the data (assuming a low pass filter with DC gain 1) will eliminate the effective discontinuity at the start. Depending on the order of the base filter you could set an initial value that matches more of the derivatives of the signal. |
| radar_macgyver:
You can find an implementation in the octave-signal package. The comments to that implementation refer to "Hardware-efficient technique for minimizing startup transients in Direct Form II digital filters" by Likhterov and Kopeika. |
| joeqsmith:
--- Quote ---For example, the function filtfilt (in MATLAB 2001b) pads the input sequence with its mirrored part, which is three times longer than the filter order. --- End quote --- I don't believe that would be close. *** I think I miss understood the term mirrored. I was thinking just the along the vertical axis but I suspect they mean both. *** Coding the 2 axis mirror like shown using a window 3X the filter order, its slightly worse than my previous attempt. *** Bug in code. Very close now. Plot comparing MatLab filtfilt with using the above. Basically feeding a series of noise into each filter. Thanks for the help. |
| Navigation |
| Message Index |