# Signal filtering and moving averages

Background

Given a signal $x_n$ for $n=1,2,\dots$ we can consider its filtered values:

$$y_n = \frac{b(L)}{a(L)}x_n$$

where $a(L)=a_0 + a_1L + a_2L^2 + \cdots + a_nL^n$ (similarly for $b$) and $L$ is the lag operator,

$$L^k x_n = x_{n-k}$$

and the denominator term $a(L)$ is interpreted via its formal power series in $L$, for example

$$\frac{1}{1-L} = 1 + L + L^2 + L^3 + \cdots$$

Question

The above expression assumes that we have infinitely many past values of $x$. In reality we only have a finite sample, and so when we are implementing the filter we follow an algorithm which is 'asymptotically correct' as $n\to\infty$ (I'm playing pretty loose with terminology here). In particular we introduce delay filters $z_1,\dots,z_{n-1}$ and repeat the following steps for each $m$:

\begin{align} y_m & = b_1x_m + z_{1,m-1} \\ z_{1,m} & = b_2x_m + z_{2,m-1} - a_2 y_m \\ \vdots & \\ z_{n-2,m} & = b_{n-1} x_m + z_{n-1,m-1} - a_{n-1}y_m \\ z_{n-1,m} & = b_n x_m - a_n y_m \end{align}

This requires that we choose the initial values $z_{1,0}, \cdots z_{n-1,0}$ to kick-start the algorithm. My question is this: let's say that I want my $y_1,\dots,y_{n-1}$ to take on particular values, say $Y_1,\dots,Y_{n-1}$. I should be able to choose the $z$s to achieve this. How exactly do I choose them?

-
Maybe this is more suited to dsp.stackexchange.com ? – tdc Jan 11 '12 at 12:46
Chris, I received a moderator flag recently asking if this question should be migrated to dsp.SE, as was suggested above. Are you interested in doing so? – Zev Chonoles Jul 13 '12 at 4:22
Sure. Although I can't even remember the reason for asking this question now! – Chris Taylor Jul 13 '12 at 5:40