Monday, August 21, 2017

Discrete-time Biquad filter: Relation between peak frequency and pole frequency


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]=b0x[n]+b1x[n1]+b2x[n2]a1y[n1]a2y[n2]


with b0=b2=(1r2)/2, b1=0, a1=2rcos(2πf0T), and a2=r2.


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


H(z)=1r221z212rcos(ωp)z1+r2z2


where I use the abbreviation ωp=2πf0T.


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


So the questions I pose are:





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




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





Answer



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)=ααz2(1+α)2cos(ω0)z1+(1α)z2=α1+α1z2121+αcos(ω0)z1+1α1+αz2


where ω0 is the angular frequency where the peak occurs ("peak frequency"), and α=sin(ω0)/(2Q) is a parameter determined by ω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)=k1z2(1rejωpz1)(1rejωpz1)=k1z212rcos(ωp)z1+r2z2


where k is some gain constant to be determined, $0this question (and shown under Eq. (1) in the question above), it is clear that the frequency f0 in that question equals the pole frequency fp in our formulation. And r in the question above is obviously the pole radius.


Comparing (1) and (2) we can express α and ω0 of Eq. (1) in terms of the pole radius r and the pole angle ωp used in Eq. (2):


1α1+α=r2α=1r21+r2,k=α1+α=1r2221+αcos(ω0)=(1+r2)cos(ω0)=2rcos(ωp)


The second line of Eq. (3) shows that the pole angle ωp and the peak frequency ω0 are not equal, and that the following relationship holds:


1+r22rcos(ω0)=cos(ωp)


The following Matlab/Octave example illustrates the above. We choose ω0=0.2π 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 ω0 (red line) and of the pole angle ωp (green line), both normalized by π.




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=12. This case is still covered by Eq. (2) with ωp=0 (i.e., a positive real-valued pole) or ωp=π (a negative real-valued pole). For Q<12 we get two different real-valued poles, and Eq. (2) is not valid anymore. Instead, the transfer function becomes


H(z)=k1z2(1β1z1)(1β2z1)=k1z21(β1+β2)z1+β1β2z2


where β1 and β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 α, ω0, k and β1 and β2:


α=1β1β21+β1β2cos(ω0)=β1+β21+β1β2k=1β1β22


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


No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, MgX2+ is closest in radius to LiX+. Is this true, and if so, why would a whole larger shell ($\ce{...