Mean delay for a M tap harmonically weighted filter

I am trying to derive the mean delay for $M$ filter taps harmonically weighted:

$$y[n] = \frac{M\,x[n] + (M-1)x[n−1]... + 1 \cdot x[n−M+1]}{\tfrac12 M (M + 1)}$$.

For a uniformly weighted filter, I used group delay formula and solved it but I am not able to solve this question in a similar way. If I find frequency response $H(e^{j\omega})$ for the above mentioned equation, I end with a arithmetic-geometric progression

$$H(e^{j\omega})=M+(M-1)e^{-j\omega}+...e^{-j\omega(M-1)}$$.

I don't know whether my approach is right or not.

Also, if this is a non-linear phase filter, how should I solve it?

• i'm not sure where the denominator in your FIR difference equation ends up. what happens to $\tfrac12 M(M+1)$ ? Aug 2 '18 at 5:14
• and, it seems to me an "arithmetic progression". Aug 2 '18 at 5:15

As already mentioned in Fat32's answer, this filter definitely has a non-linear phase, because its impulse response is neither symmetric nor anti-symmetric. Note that the mean or average (group) delay can be defined in several ways, but I will use the following definition:

$$\tau_{av}=\frac{1}{\pi}\int_{0}^{\pi}\tau(\omega)d\omega\tag{1}$$

where the group delay is defined as the negative derivative of the phase:

$$\tau(\omega)=-\phi'(\omega)\tag{2}$$

I will show below the mildly surprising fact that for any value of $M$, $\tau_{av}=0$, i.e., the group delay always averages to zero.

It is important to note that the phase $\phi(\omega)$ in $(2)$ is the unwrapped phase. Combining $(1)$ and $(2)$ we get

$$\tau_{av}=\frac{1}{\pi}\big[\phi(0)-\phi(\pi)\big]\tag{3}$$

So we do not need to compute the group delay $\tau(\omega)$ nor the phase $\phi(\omega)$ for all $\omega$ in order to compute the average group delay. We just need two values of the unwrapped phase at frequencies $\omega=0$ and $\omega=\pi$.

Let's first find an expression for the frequency response:

$$H(e^{j\omega})=\frac{2}{M(M+1)}\sum_{n=0}^{M-1}(M-n)e^{-jn\omega}=\frac{2}{M(M+1)}e^{-jM\omega}\sum_{n=1}^{M}ne^{jn\omega}\tag{4}$$

It is straightforward, yet a bit tedious, to find a closed-form expression of $(4)$:

$$H(e^{j\omega})=\frac{2}{M(M+1)}\frac{Me^{2j\omega}-(M+1)e^{j\omega}+e^{-j(M-1)\omega}}{(1-e^{j\omega})^2},\quad\omega\neq 2k\pi, k\in\mathbb{Z}\tag{5}$$

WolframAlpha can be helpful in such cases. For $\omega=2k\pi$ we have

$$H(e^{j2k\pi})=H(1)=\frac{2}{M(M+1)}\sum_{n=1}^{M}n=1$$

and, consequently, $\phi(0)=\phi(2k\pi)=0$. Since the impulse response is real-valued, $H(e^{j\pi})$ must be real-valued as well and we must have $\phi(\pi)=k\pi$, $k\in\mathbb{Z}$. However, since $\phi(\omega)$ is the unwrapped phase, it is important to know the exact value of $k$ in order to evaluate $(3)$ correctly.

The frequency response $(5)$ can be rewritten as

$$H(e^{j\omega})=\frac{2}{M(M+1)}\frac{M(1-e^{j\omega})+1-e^{-jM\omega}}{4\sin(\omega/2)},\quad\omega\neq 2k\pi\tag{6}$$

Since for $\omega\in (0,\pi]$ the denominator of $(6)$ is real-valued and positive, the phase $\phi(\omega)=\arg\{H(e^{j\omega})\}$ equals the argument of the numerator:

$$\phi(\omega)=\arg\left\{M(1-e^{j\omega})+1-e^{-jM\omega}\right\},\quad\omega\neq 2k\pi\tag{7}$$

The real part of the expression inside the argument of $(7)$ is

$$M(1-\cos(\omega))+(1-\cos(M\omega))=2M\sin^2(\omega/2)+2\sin^2(M\omega/2)>0,\\\omega\neq 2k\pi\tag{8}$$

Since the real-part is always positive for $\omega\in(0,\pi]$, the phase must satisfy $-\pi/2<\phi(\omega)<\pi/2$. This is also true for $\omega=0$, where we already know that $\phi(0)=0$. Consequently, no phase wrapping occurs, and the requirements $\phi(\pi)=k\pi$ and $-\pi/2<\phi(\omega)<\pi/2$ are only satisfied for $k=0$, i.e., for $\phi(\pi)=0$. From $(3)$, with $\phi(0)=\phi(\pi)=0$ we must have

$$\tau_{av}=0\tag{6}$$

i.e., the average group delay equals zero.

The figure below shows the phase and group delay for $M=5$ and for $M=100$. Clearly, there is no phase wrapping and the phase always remains inside the interval $[-\pi/2,\pi/2]$. (Actually, it is quite straightforward to show that the phase always satisfies $-\pi/2<\phi(\omega)\le 0$, as can be seen in the plots below, but that is irrelevant for the computation of $\tau_{av}$). The group delay oscillates around its average of zero.

Note that since the impulse response is non-negative, another meaningful definition of the average delay is the center of gravity of the impulse response:

$$\tilde{\tau}_{av}=\frac{\displaystyle\sum_{n=1}^{M-1}nh[n]}{\displaystyle\sum_{n=0}^{M-1}h[n]}\tag{7}$$

We have

$$h[n]=\begin{cases}\frac{M-n}{\frac12 M(M+1)},&n=0,1,\ldots,M-1\\0,&\text{otherwise}\end{cases}\tag{8}$$

Using Faulhaber's formula for powers $p=1$ and $p=2$, it is rather straightforward to show that the average delay as defined by $(7)$ is given by

$$\tilde{\tau}_{av}=\frac{M-1}{3}\tag{9}$$

Compare this to the delay of a linear phase FIR filter of length $M$: $(M-1)/2$.

If this is a homework/exam problem, I assume that $(7)$ is the intended definition of average delay, because in that case the solution can be derived in a very straightforward way using basic math.

• I plotted mean delay and observed that mean delay is almost zero for every M. If you can read any more information from this plot, please let me know. link Aug 3 '18 at 17:31
• @SrilakshmiAlla: I do not know how you produced that figure, but if you use definion (1) for the average delay, then according to (6) the average delay must be zero. Aug 4 '18 at 6:47

The coefficients of this FIR filter do not posses any type of symmetry, hence it cannot be a linear phase filter. However, you can still compute its phase response either analytically (or numerically) as:

$$\phi(\omega) = \tan^{-1}( \frac{ \mathcal{Im} \{ H(e^{j\omega}) \} }{\mathcal{Re} \{ H(e^{j\omega}) \} } )$$

Then you can compute its derivative (again either analytically or numerically) to obtain the group delay function

$$\tau(\omega) = -\frac{d\phi(\omega)}{d\omega}$$

from which you can compute the mean delay according to its definition.

• Your formula for the group delay is actually the phase delay (even though in the text above the formula you correctly state that it is the derivative of the phase). Note that an analytic approach shows that the average group delay is always zero, regardless of the value of $M$. Aug 3 '18 at 6:38
• Ha yes, I forgot the derivative sign there... thanks Aug 3 '18 at 11:51