# Difference between order and length of a filter

Let, the channel be modeled as a FIR model with order L. Mathematically, $y_n = \sum_{k=1}^L h_k u_{n-k} \tag{1}$ where $u$ is the data input to the channel and h is the channel coefficient. In statistics, the model y is known as the Moving Average process with order L. In signal processing, L is known as the length. Consider an example where there are 3 coefficients viz. $h_1,h_2,h_3$

Confusion 1: My confusion is, what is the order for this example? There are 3 coefficients so the order should be 3. I am confused between these terms - order, length and delays.

Confusion 2: Can somebody please clarify what is the order for this example? Please correct me where I have made any mistakes.

In Matlab I have implemented the equation(1) as follows:

N = 1000;
u = rand(1,N);
for n = 3 : N
y(n) = h(1)*u(n) + h(2)*u(n-1) + h(3)*u(n-2);
end


In your example order is $2$ and length is $3$.

Its has more to do with convention. Consider a polynomial in $x$: $$a_n x^n + a_{n-1} x^{n-1} + ... a_0 x^0$$ The order of this polynomial is $n$, whereas, number of coefficients is $n+1$. In your case an FIR filter of order $L$, is a polynomial you write as: $$h_L \delta(n-L) + h_{L-1} \delta(n-L+1) + ... h_0 \delta(n)$$ The $z$-transform of which is: $$h_L z^{-L} + h_{L-1} z^{-L+1} + ...+ h_1 z^{-1} + h_0 z^{0}$$ Note this transform, which you might not have studied yet, just places the shift in $\delta(n)$ on power of $z$, e.g., $z^{0}$ and $\delta(n)$ correspond to no-delay, just scaling the input signal. $z^{-1}$ and $\delta(n-1)$ correspond to order $1$ and one delay.

I think real confusion comes from MATLAB, as it does not allow $0$ as first index value. You cannot write x(0) in MATLAB. The first index is $1$. Therefore, we have to start from x(1).

• Thank you for this answer. Can you please suggest an article or tutorial for understanding about the z transform and their relation with filters, without going into much depth. I am learning estimation theory and system identification. When reading research articles, I am coming across z-transform and unable to understand them as I don't know what is their connection to these filters. These are not there in time series models, of which MA and AR models are popularly studied.
– SKM
Commented Aug 21, 2017 at 6:07
• Only in signal processing I have come across z transform assiciated with these time series models. As a result of which I cannot understand why AR filter is a truncated FIR filter.
– SKM
Commented Aug 21, 2017 at 6:07
• If you are familiar with Laplace transform, you can start with this book, here is link to chapter 33: dspguide.com/CH33.PDF Commented Aug 21, 2017 at 6:13