# What is this sinc doing in my LP-turned-HP filter output?

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.)

• Can you include the MATLAB code that you're using to generate the plots? The data isn't important; you could just simulate it with random samples instead if needed. Nov 11 '11 at 22:21

• Sorry if I wasn't clear enough. The signal that I'm comparing to (blue) is also forward-backward filtered (filtfilt and butter(3,0.5/250,high)). The signal is from an ECG that I can't expect to be exactly periodic. Nov 8 '11 at 17:25