Signal processing question (phase response of a digital filter)

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

Answers (1)

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.

8 Comments

For your example with a = [1 5] the denominator polynomial is 1 + 5z^-1 which only has a single pole at z = -5 (not two poles as you have suggested). That said, I think I now understand why it evaluates the denominator polynomial as [1 5 0]. It's as you suggested because of the descending order of exponents used by polyval. So for your example we would multiply both the numerator and denominator polynomials by z^2 so that we now have descending powers as needed. In doing so, the denominator becomes z^2 + 5z which indeed has an extra root at z=0. fvtool shows this as a pole at z=0, although I'm not convinced it should really show this as I think the pole is a figment of the computation and not an actual pole of the filter. Indeed fvtool also shows 20 poles at the origin for the FIR filter I mentioned with 20 zeros. Again I don't think the poles really deserve to be displayed by fvtool. I experimented with evaluating the polynomials at e^-jw instead of e^jw (so that we are evaluating at 1/z instead of z). Since this is just a complex conjugate, the time required for that is essentially nothing. Then I used fliplr() on the two polynomials so that the powers would be descending. Then I found that the results were identical to freqz. I assume freqz used the padding with zeros trick because they assumed this would be faster than using fliplr(). I'm not sure that is true, especially when there are no poles or far fewer poles than zeros. In any case, the processing time difference is probably not dramatic. Thanks for your help Paul! Nice first name by the way :)
~Paul
It sounds like that there is no longer a concern with the actual computation of the frequency response in freqz. For transfer function H(z)
H(z) = (1 + 2*z^1 + 3*z^-2) / (1 + 5*z^-1) = (z^2 + 2*z + 3) /(z^2 + 5*z)
the frequency response is
H(w) = H(z = exp(1j*w))
which can be computed by substituting exp(1j*w) for z in either expression on right hand side. freqz does it using the second expression, but for sure you can get the same answer (mathematically) using the first expression. I don't know why freqz does it they way it does, but I wouldn't be surprised if it's been done that way going back to the very first release of the Signal Processing Toolbox. Just a guess.
The remaining question then regards the definition of the zeros and poles of H(z). I did some searching, and sure enough I found one reputable source that says "It is customary" to not consider the poles at the origin "when discussing the number of poles" a filter has, but it goes on to be very clear that those non-discussed number of poles at the origin do affect the phase response.
Having said that, my recollection is that its more typical to say that z0 is a finite pole of H(z) if H(z0) is not defined, and z0 is a finite zero of H(z) if H(z0) = 0. Also, H(z) can have poles or zeros (not both) at infinity depending on the orders of the numerator and denominator polynomials in z. Clearly H(z) above is not defined at z = 0, hence z0 = 0 is pole of H(z).
Or consider the one-samples delay, which seemed to be not considered by my reputable source
H(z) = z^-1 = 1/z
What are the poles and zeros of H(z)? I would say H(z) has a pole at z = 0 and does not have any finite zeros (it has one zero at z = inf), which follows from writing H(z) as a rational function in z and then looking at the roots of the resulting numerator and denominator, as I did in the example in my original answer.
In a practical sense, Matlab uses the definitions of poles and zeros as I've described and as you've seen, at least in the Control Systems and Signal Processing Toolboxes.
We both now understand how and why the frequency response is computed as it is, so the rest is just semantics of perhaps less consequence. That said, I would still maintain that these extra poles are mere figments of a computational technique and aren't really part of the z-plane representation of the filter. After all, my current method is to evaluate the rational polynomial in z^-1 using polyval(fliplr()) and this method does not introduce any extra poles and it does compute the correct magnitude and phase response (with the advantage of evaluating a lower order polynomial). Likewise if the numerator polynomial is shorter than the denominator than fvtool will show phantum zeros at the origin, and I don't think fvtool should show them either. But were just talking semantics :)
~Paul
I'm afraid I disagree with the concept of "extra" poles (or extra zeros).
One has to define what a pole (or zero) is and then apply that definition to the transfer function H(z) in question.
The poles (and zeros) are not determined by the computational technique; rather the poles (and zeros) are an inherent property of the transfer function H(z), regardless of whether H(z) is written as a rational function in z or inv(z).
As you've seen, the pole(s) (and zero(s)) at the origin, as I've defined them, do have an impact on the frequency response, which is also an inherent property of H(z). If computing the frequency response via polynomial evaluation (whether in terms of exp(1j*w) as in freqz or in terms of exp(-1j*w) in your method), we don't need explicit knowledge of the pole and zero locations. But suppose we want to evaluate H(exp(1j*w)) based on just knowing the values (and multiplicity) of the poles and zeros and taking products of factors of the numerator and denominator. In this case, one must know about the poles (zeros) at the origin.
Another example is the inverse z-transform integral, which can be evaluated via the residue theorem, which in turn requires knowledge of the finite poles of H(z) as I've defined them, i.e., roots of the denominator when H(z) is written as a rational function of z.
If you have any references (preferably online) that discuss this idea of "extra" poles (or zeros), I'd love to read them to learn about other perspectives.
Don't be afraid to disagree. We learn a lot that way :)
I do agree with you that the poles and zeros are inherent characteristics of the filter.
Consider the FIR filter represented by H(z) = 1 - 5z^-1 + 6z^-2
If we plug in z=2 or z=3 we get H(z)=0, so clearly this filter has two zeros. Now it's true that H(z) blows up at z=0 so you could say that the filter also has two poles at z=0 ... but is this really useful? Once you know the filter's gain and its two zeros you could discover anything you could possibly know about this filter and most people don't consider FIR filters to have poles. This is where the extra poles are coming from. Consider the IIR filter resulting when we divide the H(z) above by 1 + 5z^-1. Plugging in z = -5 makes the denominator zero and that's the only place the denominator is zero, giving us a single pole at z = -5. Any additional poles would have to be attributed to the numerator (if you choose to do so). As I've said from the beginning we are simply arguing semantics ... i.e what is a pole really? ... if it's not a person from Poland that is ... or what a vaulter uses to get over the bar :)
~Paul
I think you meant that H(z) = 1 + 5z^-1 + 6*z^-2.
Yes, I would say that filter has two poles at the origin, for the exact reason you state: H(z=0) = inf (in a mathematically loose sense). The answers on this stackexchange post may be of interest, as might be this Wikipedia link. IMO, it is useful becasue it's always useful to know the inherent properties of the filter.
Let me again ask the question I asked above:
What are the poles and zeros of the unit delay D(z) = z^-1 ?
Here's a new question: Suppose we have a non-causal FIR filter Q(z) = z^2 + 5*z + 6. Do Q(z) and H(z) have the same zeros, and neither have any poles?
If so, would that imply that Q(z) and H(z) have the same responses (frequency, impulse, etc.), which they clearly don't? What other inherent property would be used to distinguish Q(z) from H(z)?
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
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.

Sign in to comment.

Products

Release

R2023a

Asked:

on 10 Aug 2023

Commented:

on 12 Aug 2023

Community Treasure Hunt

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

Start Hunting!