I already have a low-pass filter and want to remove the DC offset of a signal with a high-pass one. I guess you can subtract a low-pass filtered signal from the original signal and the result is a high-pass filtered signal?

My low-pass filter:

x = input, raw signal
y = output, low-pass filtered signal
n = current sample
n - 1 = previous sample

y(n) = y(n - 1) + (x(n) - y(n - 1)) / alpha

High-pass filter:

x = input, raw signal
y = input, low-pass filtered signal
z = output, high-pass filtered signal
n = current sample

z(n) = x(n) - y(n)

Is this last equation correct?


2 Answers 2


The result will indeed be a high pass filter. From your difference equation, the transfer function of the low pass filter is


with $\beta=1/\alpha$. Note that this is actually a leaky integrator, not a classic low pass filter, because its frequency response does not have a zero at Nyquist.

The high pass filter has the transfer function


which has a zero at DC (i.e. at $z=1$), as it should. However, it is scaled, i.e. its value at Nyquist ($z=-1$) is not $1$, but $2(1-\beta)/(2-\beta)$. So in order to have a 0 dB gain at Nyquist, you need to scale your high pass filter with the inverse of that factor:



You can compute the 3dB cut-off frequencies of the low pass filter (1) and of the high pass filter (2) by solving

$$|H_l(e^{j\omega_c})|^2=\frac12\quad\text{and}\quad |H'_h(e^{j\omega_c})|^2=\frac12$$

After some algebra this gives for the low pass filter


and for the high pass filter


where $\omega$ is the normalized frequency in radians:


with the sampling frequency $f_s$.

  • $\begingroup$ Thank you @Matt L. Is there a way to quantify the cutoff frequencies of the low and high-pass filters as a function of alpha? I'm new to much of this, so please forgive me if it's not just the 1 - beta term. $\endgroup$
    – tarabyte
    Jan 25, 2015 at 5:23
  • 1
    $\begingroup$ @tarabyte: I've added the formulas for the cut-off frequencies to my answer. $\endgroup$
    – Matt L.
    Jan 25, 2015 at 9:39

For an LTI system another method to generate a highpass filter impulse response $h_{hp}[n]$, from an existing lowpass filter impulse reponse $h_{lp}[n]$ is the following: $$h_{high}[n]=(-1)^n h_{low}[n]$$

From the DTFT properties we can see that: $$h_{high}[n]=e^{j\pi n} h_{low}[n]$$ $$H_{high}(e^{j\omega})=H_{low}(e^{j(\omega - \pi)})$$

which would produce a highpass filter from a lowpass filter, as a result of the right shift by $\pi$ in its spectrum. Note that this highpass filter will have the exact spectral shape of the prototype lowpass filter, however it won't be a complementary highpass counterpart of the given lowpass filter. Which means their spectral sum $H_{lp}(e^{j\omega}) + H_{hp}(e^{j\omega})$ is not unity. In your example, you would get the complementary filter if you use the definition as: $H_{hp}(e^{j\omega})= 1 - H_{lp}(e^{j\omega})$ assuming both DTFTs to be real (zero phase), if they are not, you may define the highpass filter as $$H_{high}(e^{j\omega})= e^{j\omega d} - H_{low}(e^{j\omega})$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.