I'm trying to HP-filter a signal by LP-filtering it and subtracting the output from the original filter. To obtain the LP-filtered signal, I backward-forward filtered using a third-order Butterworth filter for a 16,000-sample signal. The cutoff frequency was 0.5 Hz @ 250 Hz. No window was used.
In the first 85% or so of samples, the output of this method seems to overlap completely with the actually HP-filtered signal. However, at the end of the output, there is a supsiciously sinc-like phenomenon.
- What causes it?
- What could I change to make this method feasible?
Here are the two signals overlaid. The blue one is HP-filtered, and the red one obtained by subtraction.
Here is the absolute difference per sample. They are never exactly equal; the minimum difference is 8e-12. 87% of the values are below 0.01.
(If there's a better way to obtain an HP filter from an LP filter's $H(z)$, I'd be happy to learn it.)