# 3 dB cut-off frequency of first-order IIR high-pass filter

As descipbed in this great answer (thank you Matt L.), the suggested exact formula was very precise. I need a first order high-pass with similar precision.

EDIT: (clarification) The low-pass filter discussed in the link above was this one, derived from the simple RC filter. What I'm looking for is the discrete version of the simple high-pass RC filter with a formula for getting the exact alpha term (that's what Matt L. did) for an amplitude response of -3dB at a given cutoff frequency.

I've tried and measured the low pass version and it worked as expected.

• could you put numbers to what you mean with "similar precision"? What kind of high-pass filter, i.e. cutting of where exactly? You don't really have a lot of degrees of freedom in a first-order system. To be exact, you have exactly two parameters you can adjust, at all. Now, I trust you have looked up the formulas describing the frequency response resulting from the choice of these two numbers, so could you try to specify what the question is? Jun 28 '20 at 0:21
• Thank you Mr Müller, I've edited my question. Jun 28 '20 at 5:02

A discrete-time first-order high pass filter with unity gain at Nyquist and a zero at DC is described by the following difference equation:

$$y[n]=\frac{1+\alpha}{2}\big(x[n]-x[n-1]\big)+\alpha y[n-1],\qquad -1<\alpha<1\tag{1}$$

Its transfer function is given by

$$H(z)=\frac{1+\alpha}{2}\frac{1-z^{-1}}{1-\alpha z^{-1}}\tag{2}$$

Evaluating the squared magnitude of $$(2)$$ on the unit circle $$z=e^{j\omega}$$ and equating it to $$\frac12$$ ($$-3$$ dB) results in the following relation between $$\alpha$$ and the $$3$$ dB cut-off frequency $$\omega_c$$:

\begin{align}\big|H(e^{j\omega_c})\big|^2&=\frac{(1+\alpha)^2}{4}\frac{\left|1-e^{-j\omega_c}\right|^2}{\left|1-\alpha e^{-j\omega_c}\right|^2}\\&=\frac{(1+\alpha)^2}{4}\frac{2\big(1-\cos(\omega_c)\big)}{1-2\alpha\cos(\omega_c)+\alpha^2}\stackrel{!}{=}\frac12\tag{3}\end{align}

Eq. $$(3)$$ results in a quadratic equation for $$\alpha$$ with the solution

$$\alpha=\begin{cases}\displaystyle\frac{1-\sin(\omega_c)}{\cos(\omega_c)},&\omega_c\in(0,\pi)\setminus \frac{\pi}{2}\\0,&\omega_c=\frac{\pi}{2}\end{cases}\tag{4}$$

(where the requirement $$|\alpha|<1$$) has been taken into account).

For $$\omega_c=\pi/2$$ we obtain $$\alpha=0$$ and the corresponding filter is a simple $$2$$-tap FIR filter. All other cut-off frequencies $$\omega_c\in(0,\pi)$$ result in IIR filters.

The figure below shows the magnitude responses of $$9$$ high-pass filters with specified cut-off frequencies $$0.1\pi,0.2\pi, \ldots,0.9\pi$$. The corresponding values for $$\alpha$$ were computed according to Eq. $$(4)$$. Here are couple examples:

% R is the resistance value (in ohms)
% C is the capacitance value (in farrads)
% fs is the digital sample rate (in Hz)

% Constants
RC = R * C;
T  = 1 / fs;

% Analog Cutoff Fc
w = 1 / (RC);

% Prewarped coefficient for Bilinear transform
A = 1 / (tan((w*T) / 2));

% using Bilinear transform of
%
%             1          ( 1 - z^-1 )
% s -->  -----------  *  ------------
%         tan(w*T/2)     ( 1 + z^-1 )
%

b(1) = (A)/(1+A);
b(2) = -b(1);
a(2) = (1-A)/(1+A);


and an alternative implementation could be:

w = 2.0 * pi * fc/fs;
cx = cos(w);
sx = sin(w);
b0 =   cx + 1;
b1 = -(cx + 1);
a0 =   cx + sx + 1;
a1 =   sx - cx - 1;

• Great answer! It was really hard to decide the accepted one between yours and Matt's but I had to choose one. Matt's answer was complemented with clear explanations and well presented. BTW I evaluated and plotted all three propositions and they were correct and identical. Jun 28 '20 at 10:48