A single-pole IIR low-pass filter can be defined in discrete time as y += a * (x - y), where y is the output sample, x is the input sample and a is the decay coefficient.

However, the definition of a varies. On Wikipedia, it's defined as 2πfc/(2πfc+1) (where fc is the cutoff frequency).

But here, a is defined as follows: 1 - e^-2πfc.

Their graphs look similar, but which one is more accurate?

The blue graph is the Wikipedia formula, the green is the second one, fc is the x-axis. GeoGebra graph

  • 1
    $\begingroup$ Possible duplicate of Exponential weighted moving average time constant $\endgroup$
    – Matt L.
    Dec 12, 2018 at 9:04
  • $\begingroup$ I disagree. There are two conflicting formulas given, but the question you linked covers how one of them can be derived. Edit: However, there's a note that the formulas are only an approximation, which might imply that both of those are usable. $\endgroup$
    – Mark
    Dec 12, 2018 at 9:07
  • 2
    $\begingroup$ See my answer below, both are indeed approximations derived from the corresponding analog filter, and only one of them is useful, provided that the cut-off frequency is much smaller than Nyquist. $\endgroup$
    – Matt L.
    Dec 12, 2018 at 12:17

2 Answers 2


The given single-pole IIR filter is also called exponentially weighted moving average (EWMA) filter, and it is defined by the following difference equation:

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

Its transfer function is


The exact formula for the required value of $\alpha$ that results in a desired $3\;\textrm{dB}$ cut-off frequency $\omega_c$ was derived in this answer:

$$\alpha=-y+\sqrt{y^2+2y},\qquad y=1-\cos(\omega_c)\tag{3}$$

Even though it should be easy enough to compute $\alpha$ from $(3)$, there are several approximative formulas floating around the internet. One of them is

$$\alpha\approx 1-e^{-\omega_c}\tag{4}$$

In this answer I've explained how this formula is derived (namely, via the impulse invariant transformation of the corresponding continuous-time low pass filter). This answer compares the approximation $(4)$ with the exact formula, and it is shown that $(4)$ is only useful for relatively small cut-off frequencies (of course, small compared to the sampling frequency).

In the wikipedia link given in the question, there is yet another approximative formula:


[Note that in all formulas of this answer $\omega_c$ is normalized by the sampling frequency.] This approximation is also derived from discretizing the corresponding analog transfer function, this time not via the impulse invariant method, but by replacing the derivative by a backward difference:

$$\frac{dy(t)}{dt}{\huge |}_{t=nT}\approx\frac{y(nT)-y((n-1)T)}{T}\tag{6}$$

This is equivalent to replacing $s$ by $(1-z^{-1})/T$ in the continuous-time transfer function


which results in


Comparing $(8)$ to $(2)$ we see that


Since the (continuous-time) $3\;\textrm{dB}$ cut-off frequency is $\Omega_c=1/\tau$, we obtain from $(9)$


Equating the discrete-time cut-off frequency $\omega_c$ with $\Omega_cT$ in $(10)$ gives the approximation $(5)$.

The figure below shows the actually achieved cut-off frequency for a given desired cut-off frequency for the two approximations $(4)$ and $(5)$. Clearly, both approximations become useless for larger cut-off frequencies, and I would suggest that approximation $(5)$ is generally useless.

enter image description here

  • $\begingroup$ How about this approximation (sorry, just in coefficient format ): x = 1.0/(fs*T); % fs in Hz, T in μs a0 = 1.0; a1 = -(1 + x + 0.5 * x^2); % Taylor approx b0 = a0 + a1; % gain b1 = 0.0; $\endgroup$
    – Juha P
    Mar 26, 2019 at 21:18
  • $\begingroup$ @MattL. Do you know the source of these approximations which are "floating around the internet"? Is there a paper or textbook which covers these? I imagine they may be useful because they may be simpler to implement in hardware? $\endgroup$
    – Ralph
    Jul 14, 2020 at 4:21
  • 1
    $\begingroup$ @Ralph: I don't know the original source of those approximations. I also don't think that they are very useful. Eq. (4) is not very easy to implement, and Eq. (5) is such a bad approximation that it is useless in most situations. $\endgroup$
    – Matt L.
    Jul 17, 2020 at 21:52
  • 1
    $\begingroup$ it's not that the alpha-from-tau formula is an approximation, it's that the relationship between $\tau$ and $w_c$ is an approximation. If we define the time constant $\tau$ as the time it takes for the filter's step function to converge to within $\frac 1 e$, then the given formula $\alpha = 1 - e^{-\frac 1 \tau}$ is exact. This is often a useful definition of $\tau$ in a moving-average context, where you're more concerned with convergence time than frequency response. $\endgroup$
    – ssfrr
    Oct 1, 2020 at 14:51
  • 1
    $\begingroup$ In your final cutoff graph, does 1 correspond to 2pi (normalized frequency) or pi (Nyquist)? $\endgroup$
    – nyanpasu64
    Mar 18, 2021 at 0:51

Matt L.’s exact answer in equation (3) is correct. But here is a simpler “exact” solution:

𝛼 = 2𝑦 / ( 𝑦 + 1 ), 𝑦 = tan( 𝜔𝑐 / 2 ) (11)

This is computationally more robust. Eq (3) could lead to small errors depending on the resolution of your floating-point math.

  • 1
    $\begingroup$ This formula disagrees with (3). $\endgroup$
    – Kevin Yin
    Jun 19, 2022 at 18:47

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.