# Cascaded one-pole sections and relationship to time constant

I have implemented a typical one-pole lowpass filter to smooth out some control signals.
The form of the filter is: $$y1 = x0 + b1\centerdot(y1 - x0)$$ x0 is the current input sample.
y1 is the past output sample.
b1 is a smoothing coefficient.

Now I specify the b1 coefficient in terms of how much time it will take for the filter to converge to a certain percentage of the final value.
For example, the following equation makes sure that it will take 300 ms for the signal level to converge to 1% (0.01) of the final value. SR is the sampling rate of the system. $$\large {b1 = e^{\frac{ln(0.01)}{300 * SR * 0.001}}}$$ …or in a more computationally expensive form: $$\large {b1 = 10^{\frac{log_{10}(0.01)}{300 * SR * 0.001}}}$$

Let's see an example: $$\large {b1 = e^{\frac{ln(0.01)}{5}}}$$

This causes the one pole filter to converge to 1% of the final value in 5 samples.
Let's initialize y1 with 1 and y0 with 0.
Now let's see the first 5 samples of the impulse response of the filter: $$[1]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.3981072\\ [2]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.1584893\\ [3]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.0630957\\ [4]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.0251189\\ [5]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.0100000\\$$ This is what we wanted, the signal is now 0.01 compared to the original 1.
The impulse response of the filter will be exactly x after n samples.

So far, so good…

Now I would like to make the transition even smoother so I started cascading more one-pole sections. $$y1_a = x0_a + b1\centerdot(y1_a - x0_a)\\ y1_b = y1_a + b1\centerdot(y1_b - y1_a)\\ y1_c = y1_b + b1\centerdot(y1_c - y1_b)\\ …$$ This certainly works well and gives the wanted effect, however it also messes up my time constant.
For the same b1 coefficient the more cascaded one-pole sections the longer the filter takes to converge.
So I would like to know what value the b1 coefficient has to take in order to make the filter converge in the same amount of time for more cascaded sections.

More specifically I would like to find an equation that takes:
- time in ms
- sample rate
- number of cascaded one-pole sections

and gives:
- value of the b1 coefficient.

Is anybody so kind to take my hand and lead me through the math?
Thank you so much.

Luigi

• Have a look at this answer to a related question. – Matt L. Nov 11 '15 at 16:34
• Thanks. I see it is related, but it doesn't really answer my question. – Luigi Castelli Nov 11 '15 at 17:32
• No-one mentioned step response. If your control signals are piecewise-constant, wouldn't you want to look at that rather than at the impulse response? – Olli Niemitalo Nov 12 '15 at 17:41

The difference equation of your single pole filter is

$$y[n]=x[n]+b(y[n-1]-x[n])\tag{1}$$

where $n$ is the time (sample) index, $x[n]$ is the input, and $y[n]$ is the output. Its transfer function is

$$H(z)=\frac{1-b}{1-bz^{-1}}\tag{2}$$

If you cascade $N$ identical single pole filters, the total transfer function is

$$G(z)=H^N(z)=\frac{(1-b)^N}{(1-bz^{-1})^N}\tag{3}$$

The inverse $\mathcal{Z}$-transform of $(3)$ is the impulse response of the total system:

$$g[n]=(1-b)^N\frac{(n+1)(n+2)\ldots (n+N-1)}{(N-1)!}b^n,\quad n\ge 0,\quad N>1\tag{4}$$

From $(4)$ it's straightforward to compute the desired value of $b$ for $g[n]$ to decay to $0.01$ of its initial value in a given time $T$. The number of sample values corresponding to time $T$ is $K=\text{round}(Tf_s)$, where $f_s$ is the sampling frequency. We now need to solve

$$g[K]=0.01\cdot g[0]$$

for $b$, which results in

$$b=\left(\frac{0.01\cdot (N-1)!}{(K+1)(K+2)\ldots (K+N-1)}\right)^{1/K}\tag{5}$$

For $K=5$, as in your example, and for $N=2$ cascaded filters you get from $(5)$ a value of $b=0.27821$. For $N=5$ you would need to decrease this value to $b=0.15133$.

• Thank you for your explanation. This seems what I want. However there might be a problem with your final equation. For N = 1 and K = 5 I get b = (0.01/5)^0.2 --> b = 0.28854. This is different than the result given by b = exp(ln(0.01)/5) --> b = 0.39811. In other words for the case of N = 1 your equation should reduce to something equivalent to exp(ln(0.01)/K) or 10^(log10(0.01)/K). Please let me know if my thinking is not correct. I appreciate your help. – Luigi Castelli Nov 12 '15 at 8:38
• @LuigiCastelli: If you check Eq. (4), you'll see that on the right-hand side I wrote $N>1$. So the equation is not valid for $N=1$. For $N=1$ you simply get $$b=(0.01)^{1/K}$$ which is what you had already figured out by yourself. – Matt L. Nov 12 '15 at 8:43