What's the Q factor of a digital filter's pole?

For the analog S-plane, the Q factor depends on the angle of the complex pole $p$ from the horizontal axis, $\theta = \arg p$:

damping factor $\zeta = \frac{1}{2Q}$, and $\zeta = \cos(\theta)$, and $\theta = \arg(p)$ so $Q = \frac{1}{2 \cos(\theta)}= \frac{1}{2 \cos(\arg(p))}$ Right?

But in the Z plane, the curves of constant Q are more complicated:

So how do you get the Q of a complex pole? To transform an analog pole to the Z plane, you use $z = e^{sT}$? But when I try to apply this I must be doing something wrong.

Oh, maybe I got it. Maxima was making assumptions about the pole location being real?

$$Q=-\frac{\sqrt{{\log(|p|)}^2+{\arg(p)}^2}}{2\log(|p|) }$$

it depends on how you map the analog filter to the digital filter and how the s-plane poles get mapped to the z-plane poles (ya know, the "bilinear transform" vs. "impulse invariant" vs. whatever else is out there).

probably, if it were up to me, for the purpose of defining $Q$, i would map the poles as you would map $s$ to $z$ with

$$z = e^{sT}$$

where $T \triangleq \frac{1}{f_\text{s}}$ is the sampling period and $f_\text{s}$ is the sample rate. that would be assuming impulse invariant. the damping rate of the digital filter would be the same as the analog filter because both have the same exponential impulse responses (it's just that the digital filter's impulse response is the sampled analog impulse response).

for bilinear transform the $s$ to $z$ mapping is

$$z = \frac{1 + sT/2}{1 - sT/2}$$

if you're using $Q$ to define the degree of resonance (like the dB boost you get around the resonant frequency, whether the filter is LPF, BPF or HPF), then this mapping will preserve the height of that bump for a given $Q$.

i dunno if another mapping would be useful for this definition of digital Q. in the Audio EQ Cookbook, i worried a little about mapping BPF bandwidth from s-plane to z-plane and tossed in a fudge factor because bilinear transform sorta scrunches the bandwidth as the resonant frequency gets closer to Nyquist, $f_\text{s}/2$. if preservation of bandwidth, as you map from s-plane to z-plane, is important to you, then i would take a look at that.

so, given the s-plane pole location (which is a function of $Q$), map it to the z-plane and you'll get an expression for $Q$ based on the real and imaginary parts (or magnitude and angle) of the z-plane poles.

• Well a pole in a certain position has a certain Q, regardless of how it got there, right? Bilinear vs impulse invariant might put digital poles in different locations (because they're different methods of approximating the frequency response of an analog filter), but the mapping from S plane to Z plane doesn't change? – endolith Nov 14 '14 at 19:12
• well, no, the mapping from $s$ to $z$ does change, based on the mapping definition. normally we just think $$z = e^{sT}$$ and using that, the damping or decay rate of the decaying exponentials (or damped sinusoids) in the impulse response will be preserved, because the Impulse Invariant method of mapping $s$ to $z$ will map the poles according to the above. is that what you want to do, endo? but if the characteristic of $Q$ is about how peaky your LPF or BPF is, then it's the bilinear transform that preserves that characteristic. and the poles map from $s$ to $z$ differently. – robert bristow-johnson Nov 14 '14 at 20:08
• Is $Q=\frac{1}{2\zeta}$ not valid for digital filters then? Wikipedia says that $Q\approx\frac{f_c}{BW}$ is only accurate at high Q, but doesn't provide references. – endolith Nov 14 '14 at 21:33
• again, end, it depends on what you mean by "$Q$". it sorta originally gets defined by the ol' RLC circuit. then it gets generalized for an s-plane transfer function. that zeta $\zeta$ number is a decay rate. if your $s$ to $z$ mapping is impulse invariant, then (if you toss in some scaling) the $Q=\frac{1}{2\zeta}$ relationship is valid. i believe that, if you define $BW$ as the -3 dB bandwidth for a bandpass filter, then $Q=\frac{f_\text{c}}{BW}$ is precisely correct for analog filters and is approximate for digital filters because of mapping issues. – robert bristow-johnson Nov 14 '14 at 21:54

Installment #2: Digital filter mapped from analog using the Impulse Invariant mapping:

define $f_\text{s} = \frac{1}{T}$ as the sample rate and $T$ as the sampling period. Impulse Invariant says to do this:

$$h[n] \triangleq T \cdot h(nT) = \frac{\omega_0 T}{\sqrt{1-\frac{1}{4Q^2}}} e^{-\frac{\omega_0 T}{2Q} n} \sin\left(\sqrt{1-\frac{1}{4Q^2}} \omega_0 T n \right) u[n]$$

where

$$u[n] \triangleq \begin{cases} 0, & \text{if }n<0 \\ 1, & \text{if }n\ge0 \end{cases}$$

again, i am not particularly worried about $u[0]$.

the z-plane transfer function is:

$$H(z) = \frac{e^{-\frac{\omega_0 T}{2Q}} \sin\left(\sqrt{1-\frac{1}{4Q^2}} \omega_0 T \right) \ z}{z^2 - 2e^{-\frac{\omega_0 T}{2Q}} \cos\left(\sqrt{1-\frac{1}{4Q^2}} \omega_0 T \right) z + e^{-\frac{\omega_0 T}{Q}}}$$

so here, you can see that there is a zero at the origin (big deel) and show that the poles are at:

$$z_\text{p} = e^{-\frac{\omega_0 T}{2Q} \pm j \sqrt{1-\frac{1}{4Q^2}} \omega_0 T}$$

$$|z_\text{p}| = e^{-\frac{\omega_0 T}{2Q}}$$

$$\arg \{z_\text{p} \} = \pm \sqrt{1-\frac{1}{4Q^2}} \omega_0 T$$

you might note that the z-plane poles are related to the s-plane poles as

$$z_\text{p} = e^{s_\text{p}T}$$

you can see that the $Q$ is related to the distance that the poles are from the origin, but that distance is not constant. with $Q$ constant, it changes with $\omega_0$ changing.

Installment #3: Bilinear Transform.

recall the analog LPF transfer function is

$$H_\text{A}(s) = \frac{\omega_0^2}{s^2 + \frac{\omega_0}{Q}s + \omega_0^2}$$

(note the $_\text{A}$ subscript to keep confusion at a minimum.) initially, the bilinear transform says to do this:

$$z = e^{sT} = \frac{e^{sT/2}}{e^{-sT/2}} \approx \frac{1+sT/2}{1-sT/2}$$

solving for $s$

$$s = \frac{1}{T} \log(z) \approx \frac{2}{T}\frac{z-1}{z+1}$$

$$H(z) \triangleq H_\text{A}(s) \Bigg|_{s=\frac{2}{T}\frac{z-1}{z+1}} = H_\text{A}\left(\frac{2}{T}\frac{z-1}{z+1} \right)$$

but, upon examination, we have learned of this consequence called "frequency warping" and so we fudge this a little so that the resonant frequency $\omega_0$ is "pre-warped" and compensated to put it exactly where we were expecting. the resulting fudge factor is:

$$\omega_0 \leftarrow \frac{2}{T} \tan\left(\frac{\omega_0 T}{2} \right)$$

this results in the following net substitution:

$$H(z) \triangleq H_\text{A}(s) \Bigg|_{s=\frac{\omega_0}{\tan(\omega_0 T/2 )}\frac{z-1}{z+1}} = H_\text{A}\left( \frac{\omega_0}{\tan(\omega_0 T/2 )}\frac{z-1}{z+1} \right)$$

this is essentially what is done in the Audio EQ Cookbook. for the LPF, this results in the following z-plane transfer function

$$H(z) = \frac{1-\cos(\omega_0 T)}{2(1+\alpha)} \frac{z^2 + 2z + 1}{z^2 - 2 \frac{\cos(\omega_0 T)}{1+\alpha} z + \frac{1-\alpha}{1+\alpha}}$$

where $\alpha \triangleq \frac{\sin(\omega_0 T)}{2Q}$.

this also just comes from the Cookbook.

so here, there are two z-plane zeros at $z=-1$ (we expect this with bilinear transform of a LPF) and the z-plane poles (assuming that they're complex conjugate) are at:

\begin{align} z_\text{p} & = \frac{\cos(\omega_0 T)}{1+\alpha} \pm j \sqrt{\frac{1-\alpha}{1+\alpha} - \left( \frac{\cos(\omega_0 T)}{1+\alpha} \right)^2} \\ & = \frac{2Q}{2Q + \sin(\omega_0 T)}\left(\cos(\omega_0 T) \pm j \sin(\omega_0 T) \sqrt{1-\frac{1}{4 Q^2}} \right) \\ \end{align}

and

$$|z_\text{p}| = \sqrt{\frac{1-\alpha}{1+\alpha}} = \sqrt{\frac{2Q - \sin(\omega_0 T)}{2Q + \sin(\omega_0 T)}}$$

$$\arg\{z_\text{p} \} = \pm \arctan\left(\sqrt{1-\frac{1}{4 Q^2}} \tan(\omega_0 T) \right)$$

this is different from the Impulse Invariant case, but if $\omega_0 \ll \frac{1}{T}$, then i think they get to be about the same.

• if someone can show this is true: \begin{align} z_\text{p} & = \frac{2Q}{2Q + \sin(\omega_0 T)}\left(\cos(\omega_0 T) \pm j \sqrt{1-\frac{1}{4 Q^2}}\sin(\omega_0 T) \right) \\ & = \frac{1+\cos(\omega_0 T) + \sin(\omega_0 T)\left(-\frac{1}{2Q} \pm j \sqrt{1-\frac{1}{4Q^2}} \right)}{1+\cos(\omega_0 T) - \sin(\omega_0 T)\left(-\frac{1}{2Q} \pm j \sqrt{1-\frac{1}{4Q^2}} \right)} \\ \end{align} then we know that $$z_\text{p} = \frac{1 + \tan(\omega_0 T/2)s_\text{p}/\omega_0}{1 - \tan(\omega_0 T/2)s_\text{p}/\omega_0}$$ which is the pre-warped bilinear mapping. i'm just sorta peetered out. – robert bristow-johnson Nov 15 '14 at 22:52

okay, endolith, i will try to answer your question more specifically. i will do this for a simple LPF analog prototype and first for the Impulse Invariant mapping of the s-plane LPF to the z-plane LPF.

2nd-order Analog prototype:

Normalized resonant frequency: $\quad H(s) = \frac{1}{s^2 + \frac{1}{Q}s + 1}$

General resonant frequency of $\omega_0$:

\begin{align} H(s) & = \frac{1}{\left(\frac{s}{\omega_0}\right)^{\ 2} + \frac{1}{Q}\left(\frac{s}{\omega_0}\right) + 1} \\ & = \frac{\omega_0^2}{s^2 + \frac{\omega_0}{Q}s + \omega_0^2} \\ & = \frac{\omega_0^2}{\left(s + \frac{\omega_0}{2Q} \right)^{2} + \omega_0^2\left(1 - \frac{1}{4Q^2} \right)} \\ \end{align}

assuming that $Q > \frac{1}{2}$, we have complex conjugate poles

$$s_\text{p} = \omega_0 \left(-\frac{1}{2Q} \pm j\sqrt{1-\frac{1}{4Q^2}} \right)$$

we see that

$$|s_\text{p}| = \omega_0$$ $$\operatorname{Re}\{ s_\text{p} \} = -\frac{\omega_0}{2Q} < 0$$ and $$Q = -\frac{|s_\text{p}|}{2 \operatorname{Re}\{ s_\text{p} \} } > \frac{1}{2}$$

that is how the analog poles are related to $Q$, at least for the case that they are complex conjugate and $Q>\frac{1}{2}$.

the impulse response for this continuous-time filter is

$$h(t) = \frac{\omega_0}{\sqrt{1-\frac{1}{4Q^2}}} e^{-\frac{\omega_0}{2Q}t} \sin\left(\sqrt{1-\frac{1}{4Q^2}} \omega_0 t \right) u(t)$$

where $u(t)$ is the unit step function

$$u(t) = \begin{cases} 1, & \text{if }t>0 \\ 0, & \text{if }t<0 \end{cases}$$

(i am not worried about $u(0)$.) so, even though we're calling the "resonant frequency" to be $\omega_0$, the impulse response "rings" at a frequency that is $\sqrt{1-\frac{1}{4Q^2}} \omega_0$. as $Q \gg 1$, there is not much difference between the "resonant frequency" and the "ringing frequency".

this is "Installment #1". more to come. please don't down arrow until i'm done.

Actually I would take the standard definition 2*pi *(Energy stored/Energy dissipated)_per-cycle The relationship between standard signals x_j and "power" $x_j\cdot x_j^*$ is pretty much the same in the z and the s domain.