2
$\begingroup$

FIR filters are said to have linear phase when the filter coefficients are symmetric or antisymmetric with respect to time instant n=0. I am trying to design a fractional FIR filter of group delay=1.7 using inbuilt function in Matlab,then the impulse response obtained is as follows

[-0.0579 0.3401 0.7936 -0.0757]

Since coefficients are not symmetric or antisymmetric, I expect a non linear phase response but I am getting a phase response which is linear.

Why is the phase response linear if I am designing an FIR filter with non fractional group delay?

Also please explain how the phase response is calculated in this case.

$\endgroup$
4
  • $\begingroup$ Could you add a plot of the group delay? $\endgroup$
    – Matt L.
    Mar 10 at 13:39
  • $\begingroup$ It doesn't look linear around Nyquist. $\endgroup$ Mar 10 at 14:09
  • 2
    $\begingroup$ Please learn how to save images from matlab. Moire fringes are pretty, but have no place on this site. $\endgroup$
    – Peter K.
    Mar 10 at 15:05
  • 1
    $\begingroup$ It doesn't have to be symmetric about $h[0]$ (or "n-0") to be linear phase. It can be symmetric or anti-symmetric about $h[L/2]$ (where $L+1$ is the number of taps of the FIR) and still be linear phase. If it's symmetric about $h[0]$, it's zero-phase. $\endgroup$ Mar 10 at 17:43

1 Answer 1

5
$\begingroup$

The phase is indeed not linear as we would get when the impulse response is symmetrical or anti-symmetrical about its center coefficient. In the plot of magnitude and phase (which we can get using the freqz function), the overall delay of the filter is masking the smaller variation in delay that the non-linear phase would give us:

freqz(coeff)

freqz

The group delay is the negative derivative of the phase vs frequency, so by taking the derivative of the phase vs frequency (its slope), we can see the evidence of non-linearity directly:

grpdelay(coeff)

group delay

Here we see that out to 1 rad/sample in frequency, the group delay is relative flat with the target 1.7 sample delay, so is indeed "linear phase" for signals with spectral occupancy at or below this bandwidth. Beyond that we start to see the group delay variation which would lead to group delay distortion for wider bandwidth waveforms.

Note the other item we can do here for further intuition is to remove the larger phase slope by removing sample delays from the filter (resulting in a noncausal filter). A unit sample delay is $z^{-1}$ in the z domain, so if we multiply the OP's transfer function by $z^2$ we will have removed 2 samples of delay from the filter:

This is done with freqz as follows (adding a denominator polynomial of $z^{-2}$) where the non-linearity in phase is now much more obvious in the plot:

freqz(coeff, [0 0 1])

non-causal result

The animations below are to demonstrate intuitively why we get linear-phase when the filter coefficients are symmetric (or anti-symmetric). Starting with the non-causal "zero-phase" case using an example filter with coefficients given as [0.2, 0.5, 0.2], with the center coefficient occurring when time index $n=0$, observe how each coefficient in the time domain, as a scaled unit pulse delayed in time as sample number $n$, is a "spinning phasor" in the frequency domain as we sweep the frequency, given by $c_n e^{j \omega n}$ where $c_n$ is the filter coefficient as the magnitude and phase of the phasor when frequency $\omega=0$, and $n$ is the time index for that coefficient. As we sweep the frequency from $0$ to $2\pi$, the phasor will rotate in phase according to $\phi = \omega n$, which is what we see happening below. If the center coefficient is at $n=0$ as the OP introduces, this will be a "zero-phase" result as the phases all cancel resulting in a phase of zero for all frequencies.

zero phase

In the above animation we see for each of the coefficients [0.2, 0.5, 0.2] a phasor associated with the first coefficient at $n=--1$ with magnitude 0.2 and rotating counter-clockwise (phase increasing linearly vs frequency), then we see a phasor associated with the center coefficient at $n=0$ with magnitude 0.5 and not rotating at all, and the phasor with the third coefficient at $n=1$ with magnitude 0.2 rotating clock-wise (phase increasing linearly in the negative direction with frequency, as we would associate with a unit sample delay). The result is the addition of all three phasors which is plotted for both magnitude and phase on the right side of the graphic, and on a complex plane in the middle graphic.

If we make the filter causal (realizable) by delaying this result one sample to get the coefficients [0.2, 0.5, 0.2] with the first coefficient occurring at time index $n=0$, we get the same result as above with the additional linear phase given by the unit sample delay. The z-transform of a unit sample delay is $z^{-1}$, and its frequency response has a magnitude = 1 for all frequencies and a phase that goes linearly from $0$ to $-2\pi$ and the normalized radian frequency also goes from $0$ to $2\pi$ radians/samples. This is what we see for the case below:

linear phase

From this we see how if we didn’t have such symmetry in the coefficients, the summation in the non-causal case would deviate from the real axis with a non-linear phase. When unit samples are added to make the filter causal, the result will also be non-linear phase.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.