# What is effect of fractional sample delay effect on FIR Filters?

In the DSP lecture slides we have this slide:

And

So why this part of FIR Type 2 and Type 4 filter impulse response equation bolded in this slide?

To answer your primary question, what is the effect of fractional delay- in this case the fractional delay when it would exist (for Type 2 and Type 4 filters only) would be M.5 samples where M is an integer. (So would always be on a half sample increment).

In the picture below the blue line represents the sampled waveform that would pass through the filter, with the blue dots representing the input of the filter, while the output would have samples on the red dots (with the additional M sample delay). This is the effect of a fractional delay.

The presentations are simply showing you the delay of a linear phase filter; in all cases the delay is $$N/2$$ where N is the order of the filter, which is 1 less than the length L. If the filter has an odd length it will have an even order as in the case of Type 1 and Type 3 filters and the delay will be an integer number of samples. If the filter has an even length it will have an odd order as in the case of Type 2 and Type 3, and therefore the delay will be a half sample more than an integer number of samples.

Consider how this works which also illuminates why these four filter types are linear phase.

The frequency response for a FIR filter is determined by replacing evaluating $$H(z)$$ as z is swept over the unit circle. ($$z=1$$ corresponds to "DC" while $$z=1$$ corresponds to $$\pm F_s/2$$ where $$F_s$$ is the sampling rate.) To keep z on the unit circle, $$z=e^{j\omega}$$ as $$\omega$$ is swept from $$-\pi$$ to $$\pi$$ corresponding to $$=F_s/2$$ to $$F_s/2$$.

Therefore, we are evaluating $$H(z) = H(e^{j\omega})$$

Also note Euler's identities:

$$e^{j\phi} + e^{-j\phi} = 2\cos(\phi)$$

$$e^{j\phi} - e^{-j\phi} = 2j\sin(\phi)$$

Note that a real waveform such as $$\cos(\omega n)$$ has a phase that can only be $$0$$ or $$\pi$$ radians (mod $$2\pi$$).

Similarly the imaginary waveform such as $$2j\sin(\omega n)$$ has a phase that can only be $$\pm pi/2$$ (mod $$2\pi$$).

It is only complex waveforms such as $$e^{j\omega n}$$ with both real and imaginary components that can have arbitrary phases. And note that the magnitude of $$e^{j\omega n}$$ is always one, so this expression describes phase only.

From this, the approach is to factor the linear phase frequency response into the form $$A(\omega)e^{j\phi(\omega)}$$, where $$A(\omega)$$ is real and only describes the magnitude while $$e^{j\phi(\omega)}$$ describes the phase:

Given the general form of the z-transform for an FIR filter as

$$H(z) = \Sigma_{n=0}^{N-1}h[n]z^{-n}$$

And the frequency response as evaluated on the unit circle as:

$$H(e^{j\omega}) = \Sigma_{n=0}^{N-1}h[n]e^{-j\omega n}$$

If we factor out of this $$e^{-j\omega N/2}$$ the result is symmetric terms of $$e^{-j\omega n}$$, resulting in sine and cosine terms.

Here is a simple example of a 5 tap unity gain filter (coefficients = [1 1 1 1 1]). The is a length = 5 filter that is 4th order (even).

The frequency response of this is given as

$$H(e^{j\omega}) = 1 + e^{-j\omega}+e^{-j2\omega}+e^{-j3\omega}++e^{-j4\omega}$$

as $$\omega$$ is swept from $$0$$ to $$2\pi$$ or alternatively $$-\pi$$ to $$\pi$$ depending on how you want to present the frequency axis (corresponding to DC to $$F_s$$ or $$-F_s/2$$ to +$$F_s/2$$.)

If we factor out the linear phase component, we easily get the desired $$A(\omega)e^{j\phi(\omega)}$$ form since we can replace the remaining symmetric exponential terms with sines or cosines using Euler's identities. In this case, in order for the exponential exponents to be symmetric resulting in real sinusoidal terms, we need to factor out what will result in an integer delay of samples:

$$H(e^{j\omega}) = e^{-2\omega}(e^{-2\omega} + e^{-j\omega}+e^{j\omega}+e^{j2\omega})$$

Notice the symmetric exponential components such that we can now convert them easily using Euler's identities to cosine terms in this case:

$$H(e^{j\omega}) = e^{-2\omega}[(e^{-2\omega}+e^{j2\omega}) + (e^{-j\omega}+e^{j\omega})]$$

$$= e^{-2\omega}(2\cos(2\omega)+ 2\cos(\omega))$$

So here we see that the term $$(2\cos(2\omega)+ 2\cos(\omega))$$ contributes nothing to the phase except for $$0$$ and $$\pi$$ radian phase changes, so only changes the magnitude in the frequency response. Similarly the term $$e^{-2\omega}$$ only contributes to phase as the magnitude is always 1. Notice as the frequency term $$\omega$$ is changed, the phase is changing in direct proportion, in this case at a negative rate of twice the frequency-- this is consistent with the delay of two samples, and is "linear phase", as the phase is changing linearly with frequency.

We can only extract a single linear phase term and get real sinusoids when the filter coefficients are symmetric or anti-symmetric as in the four linear phase types. Further we see how when we have an odd number of taps with asymmetric coefficients how the center tap must be zero as well as other interesting properties that are revealed. Such as Type 2 filters must always have a zero at z=-1 (low pass) and similarly Type 4 filters must always have a zero at z = 1 (high pass).

It may be helpful to know that time delay is the negative slope (derivative) of phase with respect to frequency--- so if the phase versus frequency response is decreasing linearly versus frequency- this would correspond to all frequency components experiencing the same delay and thus there would be no distortion introduced.

So the reason for showing the fractional delay in those slides (and specifically it will be a 1/2 sample fraction) for the type 2 and type 4 filters is to simply show that this will always be the case for those filter types, and why. So the waveform at the output of a filter that has a half-sample fractional delay will have sample locations that are at the midpoints of the input samples for the underlying waveform that could also be represented in continuous time.

Linear phase FIR filters are either symmetric or anti-symmetric. When the length of the filter is odd then the point of symmetry falls on an integer sample. These are the Type-1 and Type-3 linear phase filters.

For example, the odd length filter $$h[n] = [1,-2,3,-4,7,-4,3,-2,1]$$

is of $$9$$ samples long (from $$n=0$$ to $$n=8$$) and the point of symmetry is at the position $$n = 8/2 = 4$$ which is the sample $$h[4] = 7$$.

On the other hand, if the filter has an even number of samples then the symmetry point does not coincide with an integer sample position but a fraction. These are the Type-2 and Type-4 filters.

For example, the even length filter $$g[n] =[ 1,2,3,3,2,1]$$ is of length $$6$$ (from $$n=0$$ to $$n=5$$) and the point of symmetry falls at the index $$n = 5/2 = 2.5$$.

This is not a valid sequence index, which should be an integer. Hence the point of symmetry is a virtual line between the indices $$n=2$$ and $$n=3$$.

• @modern Hi! Will you accept an answer ? or leave the question floating ? Don't forget to upvote as well :-)) Dec 25, 2019 at 13:50