# How do I initialize the state of a digital filter in Direct Form II?

Suppose I have a digital filter implemented in Direct Form II. How do I initialize the state of the filter as if the input $$x[n]$$ had a fixed value $$x_0$$ for all $$n<0$$?

• normally we initialize states to zero, which corresponds to your input signal, $x[n]$ being prepended with an infinite number of samples that have zero value. – robert bristow-johnson Apr 5 '19 at 22:42
• solve this equation $$w[-1] = (-a_1) w[-1] + (-a_2) w[-1] + x_0$$ for $w[-1]$. – robert bristow-johnson Apr 5 '19 at 22:47
• I had asked a similar question: dsp.stackexchange.com/questions/50992/… a while back. I had never thought much of filter initialization until I had to implement a 0.01Hz low-pass filter. – Izzo May 6 '19 at 0:16

y[n] = b0 w[n] + b1 w[n-1] + b2 w[n-2]

To achieve steady-state, w[n] == w[n-1] == w[n-2]. Call this value w. Solving the second difference equation, we find w = x/(1 + a1 + a2), where x is the steady-state input value.
• you should swap the order of the two difference equations. w[n] is calculated first. – robert bristow-johnson Apr 5 '19 at 22:40