Signal processing question (phase response of a digital filter)

6 views (last 30 days)
Paul Mennen on 10 Aug 2023
Commented: Paul on 12 Aug 2023
Suppose I have a digital filter with length(b)=8 and length(a)=6 (i.e. 7th order numerator and 5th order denominator).
If I look at freqz (or fvtool), before computing the frequency response, the denominator will be padded with two extra zeros at the end so that the two polynomials are the same length. The two extra poles at the origin won't change the magnitude response but it will change the phase response. Why is this the phase response (displayed by fvtool) the one we want vs. what we would get if we simply evaluated the ratio of the numerator and denominator polynomials (unpadded) around the unit circle?
For a FIR filter with 20 zeros, fvtool shows 20 poles added at the origin again affecting the frequency response. I suppose this is the same as my first question, but why are the 20 poles added and why is this the desired phase response to display?
Thanks for any insights you may have on this question.
~Paul

Paul on 10 Aug 2023
Edited: Paul on 10 Aug 2023
Hi Paul,
Can you provide a simple concrete, example that illustrates your concern?
I suspect that you're seeing the difference between how the numerator and denominator are entered into freqz and how they are evaluated inside of freqz.
The b,a inputs to freqz are defined in ascending powers of z^-1. So, for a filter like
H(z) = (1 + 2*z^1 + 3*z^-2) / (1 + 5*z^-1)
we'd call freqz with
freqz([1 2 3],[1 5])
Inside of freqz, for an IIR filter, the numerator and denominator polynomials are evaluated as a function of frequency in one of two ways: using polyval or fft.
polyval evaluates polynomials in descending powers of z. So if we multiply the numerator and denominator of H(z) by z^2, we get
H(z) = (z^2 + 2*z + 3) /(z^2 + 5*z)
and the Matlab polynomial representation of the denominator requires padding with one zero: [1 5 0]. The zero padding is needed to get the correct result using polyval, and is not adding an extra pole (the poles of H(z) are at z = 0 and z = -5 regardless).
If using fft, padding the denominator with one zero doesn't affect its fft.
A 20th order FIR filter does have 20 repeated poles at the origin, which you'll see by converting the FIR filter H(z) written in terms of z^-1 to a rational function of z, from which the zero and poles of H(z) are defined. I don't think freqz does any zero padding of b in the FIR case because the numerator coefficients are the same when H(z) is written in terms of z^-1 or z, but it does have to account for the fact that the b is defined in ascending powers of z^-1 when computing the frequency response.
Paul Mennen on 12 Aug 2023
I'm not sure why you changed the -5 to +5. I was talking about a filter with zeros at 2 and 3. If you compute H(2) and H(3) with your equation you get 5 and 10/3 respectively, not zero. With regard to your other arguments, you make good points, so I concede to your point of view. We do need a way to distinguish the casual and non-casual filters from the set of poles and zeros.
In the early work in signal processing z was used to represent a unit delay instead of a unit advance as we generally do today. With that standard the FIR filter I alluded to before would be represented as H(z) = 1 - 5z + 6z^2 so the casual filter would have no poles and the non-casual filter would have poles. Perhaps this is the reason the poles are sometimes ignored, although I now admit they shouldn't be. BTW geologists and economists still use this older standard today, and frankly I think they made the better choice. Of course all the math still works no matter which standard you choose.
~Paul
Paul on 12 Aug 2023
Whatever I was thinking when I rewrote H(z) was clearly incorrect. Was probably thinking about poles at -2 and -3.
For the FIR case, I think the poles and zeros are sufficient to determine impulse response, to within a gain, be it causal or noncausal. But for the IIR case, we’d need to know the region of convergence of H(z) to determine causality.
I’ll be sure to steer clear of the geology and economics crowds :)
Thanks for the discussion.

Categories

Find more on Digital Filter Analysis in Help Center and File Exchange

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!