Closed rlaboiss closed 1 year ago
The reflection on both sides of the signal prior to filtering can be improved by negating the signal reversed in time. This ensures the continuity of the first derivative of the resulting expanded signal, reducing the border effects.
This technique is currently used in the filtfilt function of Octave.
The improvement can be shown in the following image, for a ramp signal:
This figure was obtained with the following code:
library (gsignal) x <- seq (0, 50) f <- butter (3, 0.1) plot (x, pch = 19, col = "gray") cols = c ("#ff000080", "#0000ff80") lines (filtfilt(f,x), col = cols [1], lwd = 3) source ("R/filtfilt.R") lines (filtfilt(f,x), col = cols [2], lwd = 3) legend ("topleft", inset = 0.05, col = cols, lwd = 3, legend = c ("original", "improved"))
The reflection on both sides of the signal prior to filtering can be improved by negating the signal reversed in time. This ensures the continuity of the first derivative of the resulting expanded signal, reducing the border effects.
This technique is currently used in the filtfilt function of Octave.
The improvement can be shown in the following image, for a ramp signal:
This figure was obtained with the following code: