# $N$ point moving average filters in state space

I am new to this filter, I did read about them, but could find out a state space notation of these:

$$y(n)=\frac{1}{N}\sum_{m=0}^{N-1}x(n-m)$$

• Are moving average filters an LTI systems?
• And how do I represent them in state space representation? i.e with $A,B,C,D$ matrices.
• Could you add some more of your work and thoughts? Because right now it's very hard to understand what your problem is. The only option would be to directly present the solution, which is usually not done for homework-like exercises like this one. How would you normally go about finding a state-space representation of a system? Do you know how to check if a system is LTI? Sep 30 '16 at 7:22
• This is not a home work, i do know how to check LTI and try to convert it to state space(well not much, but yeah). if $y_1[n]$ is the response to input $y_1[n]$ and $x_1[n]$ is the response of $x_2[n]$. Then, $ax_1[n]+bx_2[n]$ should be equal to $ay_1[n]+by_2[n]$. I did find out the system is linear, but just wanted to confirm. And coming to state space, i am kinda stuck, not sure how to start. I have few systems in state space representation, i want to include this system to my library, but i want to it to be compatible with others. Sep 30 '16 at 7:49
• OK. The system is indeed LTI, it's simply an FIR filter with a constant impulse response (over $L$ samples). The state vector is the filter's memory, i.e., that past input values. Maybe I'll have some time later to write up an answer. Sep 30 '16 at 7:54
• Thank you. I will try to represent it in state space by then. The problem is, it has to be $n^{th}$ point average, this is where i am stuck. Sep 30 '16 at 7:56
• @Aashu10 Take a look at ccrma.stanford.edu/~jos/fp/…. You just need to write the transfer function ($H(z)$ of the moving average filter) and then it is easy to find the ss-representation from the canonical form.
– msm
Sep 30 '16 at 11:54

Yes sure they are LTI. Let $A$ be the $(L-1)\times (L-1)$ shift matrix $$A := \begin{pmatrix}0 & 1 & 0 && \dots & 0\\0 & 0 & 1 & 0 &\dots &0\\\vdots &&& \ddots && 0\\0&&\dots&&1&0\\0 &&\dots&&0&1\\0&0&\dots&0&0&0\end{pmatrix}$$ and $$B = \begin{pmatrix}0\\0\\\vdots\\0\\1\end{pmatrix},\qquad C=\begin{pmatrix}1/L&1/L&\dots&1/L\end{pmatrix},\quad D=1/L$$ Call $z$ the state variables, then a state space model is \begin{align*}z(k+1) &= Az(k) + Bx(k)\\y(k) &= Cz(k)+Dx(k)\end{align*} Infact one has \begin{align*} z_1(k) &= z_2(k-1) = z_3(k-2) = ... = z_{L-1}(k-L) = x(k-(L-1))\\ z_2(k) &= x(k-(L-2))\\ &\vdots\\ z_i(k) &= x(k-(L-i))\\ &\vdots\\ z_{L-1} &= x(k-1) \end{align*} thus \begin{align*} y(k) &= \dfrac{1}{L}\left(\sum_{i=1}^{L-1} x(k-L+i) + x(k)\right)= \dfrac{1}{L}\left(\sum_{m=1}^{L-1} x(k-m) + x(k)\right) \\&= \dfrac{1}{L}\sum_{m=0}^{L-1}x(k-m) \end{align*}