Signal processing question (phase response of a digital filter)
3 vues (au cours des 30 derniers jours)
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 le 10 Août 2023
Modifié(e) : Paul le 10 Août 2023
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.