4
$\begingroup$

This question arose from a discussion in the comments to this question and its answer. The author of that question discussed a discrete-time second order filter described by the following difference equation:

$$y[n]=b_0x[n]+b_1x[n-1]+b_2x[n-2]-a_1y[n-1]-a_2y[n-2]\tag{1}$$

with $b_0=b_2=(1-r^2)/2$, $b_1=0$, $a_1=-2r\cos(2\pi f_0 T)$, and $a_2=r^2$.

The transfer function corresponding to the difference equation $(1)$ is

$$H(z)=\frac{1-r^2}{2}\frac{1-z^{-2}}{1-2r\cos(\omega_p)z^{-1}+r^2z^{-2}}\tag{2}$$

where I use the abbreviation $\omega_p=2\pi f_0 T$.

In the original question quoted above, $f_0$ was called "resonant frequency", and the discussion inspired by that question was about whether or not $f_0$ equals the peak frequency of the filter's frequency response.

So the questions I pose are:

  1. What is the meaning of $r$ and $f_0$ as used in the coefficients of Eqs. $(1)$ and $(2)$?

  2. Does $f_0$ equal the filter's peak frequency (i.e., the frequency where the magnitude of the filter's frequency response attains its maximum)?

$\endgroup$
  • $\begingroup$ i've up-arrowed both question and answer. i guess maybe i should ask you exactly what you mean by "pole frequency"? if you have complex conjugate poles, is it the angle of the pole location against the $\Re\{z\}$-axis? keep in mind that, if the $Q$ is low enough, there might be no complex conjugate poles. $\endgroup$ – robert bristow-johnson Nov 13 '15 at 8:29
  • $\begingroup$ okay, you answered my question. still reading. $\endgroup$ – robert bristow-johnson Nov 13 '15 at 8:31
3
$\begingroup$

According to the Audio EQ Cookbook the transfer function of a second-order band-pass filter with 0dB peak gain is given by

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

where $\omega_0$ is the angular frequency where the peak occurs ("peak frequency"), and $\alpha=\sin(\omega_0)/(2Q)$ is a parameter determined by $\omega_0$ and the desired quality factor $Q$.

If we express the same transfer function $H(z)$ in terms of its poles we get

$$H(z)=k\frac{1-z^{-2}}{\left(1-re^{j\omega_p}z^{-1}\right)\left(1-re^{-j\omega_p}z^{-1}\right)}= k\frac{1-z^{-2}}{1-2r\cos(\omega_p)z^{-1}+r^2z^{-2}}\tag{2}$$

where $k$ is some gain constant to be determined, $0<r<1$ is the pole radius, and $\omega_p=2\pi f_p$ is the pole angle, corresponding to the pole frequency $f_p$. Comparing the denominator of $(2)$ to the filter coefficients given in this question (and shown under Eq. $(1)$ in the question above), it is clear that the frequency $f_0$ in that question equals the pole frequency $f_p$ in our formulation. And $r$ in the question above is obviously the pole radius.

Comparing $(1)$ and $(2)$ we can express $\alpha$ and $\omega_0$ of Eq. $(1)$ in terms of the pole radius $r$ and the pole angle $\omega_p$ used in Eq. $(2)$:

$$\begin{align}&\frac{1-\alpha}{1+\alpha}=r^2 \Longrightarrow \alpha=\frac{1-r^2}{1+r^2},\qquad k=\frac{\alpha}{1+\alpha}=\frac{1-r^2}{2}\\ &\frac{2}{1+\alpha}\cos(\omega_0)=(1+r^2)\cos(\omega_0)=2r\cos(\omega_p)\end{align}\tag{3}$$

The second line of Eq. $(3)$ shows that the pole angle $\omega_p$ and the peak frequency $\omega_0$ are not equal, and that the following relationship holds:

$$\frac{1+r^2}{2r}\cos(\omega_0)=\cos(\omega_p)\tag{4}$$

The following Matlab/Octave example illustrates the above. We choose $\omega_0=0.2\pi$ and $Q=1$ and design the corresponding biquad band-pass filter according to Eq. $(1)$. The figure below shows the magnitude of the resulting frequency response, and the locations of the peak frequency $\omega_0$ (red line) and of the pole angle $\omega_p$ (green line), both normalized by $\pi$.

w0 = .2*pi;
Q = 1;
al = sin(w0)/(2*Q);
b = [al,0,-al]/(1+al);                % numerator coeffs
a = [1+al,-2*cos(w0),1-al]/(1+al);    % denominator coeffs
p = roots(a);                         % poles
r = abs(p(1));                        % pole radius
r2 = sqrt((1-al)/(1+al));             % pole radius according to formula
abs(r-r2)                             % ans = 0
wp = abs(angle(p(1)));                % pole angle: wp = 0.17877*pi
wp2 = acos((1+r^2)/(2*r)*cos(w0));    % pole angle according to formula
abs(wp-wp2)                           % ans = 0
[H,w]=freqz(b,a,1024);
plot(w/pi,abs(H))
hold on, plot([w0,w0]/pi,[0,1],'r',[wp,wp]/pi,[0,1],'g'), hold off

enter image description here


EDIT:

In Eq. $(2)$ I assumed that there are two complex conjugate poles, because in the original question, which triggered this question and answer, the filter coefficients were chosen in such a way that only complex conjugate poles were possible (cf. the coefficients under Eq. $(1)$ of the question above).

However, the general transfer function in Eq. $(1)$ can also have a double real-valued pole or two different real-valued poles. It can be shown that a double real-valued pole occurs when the quality factor $Q$ is chosen as $Q=\frac12$. This case is still covered by Eq. $(2)$ with $\omega_p=0$ (i.e., a positive real-valued pole) or $\omega_p=\pi$ (a negative real-valued pole). For $Q<\frac12$ we get two different real-valued poles, and Eq. $(2)$ is not valid anymore. Instead, the transfer function becomes

$$H(z)=k\frac{1-z^{-2}}{(1-\beta_1z^{-1})(1-\beta_2z^{-1})}= k\frac{1-z^{-2}}{1-(\beta_1+\beta_2)z^{-1}+\beta_1\beta_2z^{-2}}\tag{a}$$

where $\beta_1$ and $\beta_2$ are the two real-valued poles. Comparing this transfer function to the transfer function given in Eq. $(1)$, we get the following relationships between $\alpha$, $\omega_0$, $k$ and $\beta_1$ and $\beta_2$:

$$\begin{align}\alpha&=\frac{1-\beta_1\beta_2}{1+\beta_1\beta_2}\\ \cos(\omega_0)&=\frac{\beta_1+\beta_2}{1+\beta_1\beta_2}\\ k&=\frac{1-\beta_1\beta_2}{2}\end{align}\tag{b}$$

Of course, the pole angles are now either zero or $\pi$, because both poles are real-valued. Note that the peak frequency $\omega_0$ is not necessarily $0$ or $\pi$. The peak frequency $\omega_0$ can in fact take any value, and the two pole angles will always be either $0$ or $\pi$ as long as the quality factor $Q$ satisfies $Q<\frac12$.

$\endgroup$
  • 1
    $\begingroup$ this appears to be completely correct. i withdraw my previous dispute with you, Matt. you are correct and i was mistaken. what do you do about $f_p$ when the $Q < \frac12$? and, BTW, that $Q$ (from the cookbook) still is applicable only for the Bilinear Transform mapping of $s$ to $z$. the mapping of $Q$ to $r$ will be different for Impulse Invariant. $\endgroup$ – robert bristow-johnson Nov 13 '15 at 8:35
  • $\begingroup$ @robertbristow-johnson: I'm glad we finally agree. It would be great if you could also mention that fact in the comments to the original question. Not for me, but for the OP and future users. Then we can also clean up the mess over there ... $\endgroup$ – Matt L. Nov 13 '15 at 8:39
  • $\begingroup$ @robertbristow-johnson: Good question about low Q, I'll add that case to my answer as soon as I have the time to do so. $\endgroup$ – Matt L. Nov 13 '15 at 9:55
  • $\begingroup$ @robertbristow-johnson: I added some information about $Q<\frac12$. Since we get real-valued poles, the pole angles are of course either $0$ or $\pi$, and $\omega_0$ can still take any value. $\endgroup$ – Matt L. Nov 13 '15 at 12:33
  • 1
    $\begingroup$ I can confirm your formula for the relationship. I got the same by solving for the zero of the derivative of the magnitude frequency response. $\endgroup$ – Olli Niemitalo Sep 29 '16 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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