## pole/zero-plot --> coefficients?

DSP, Plug-in and Host development discussion.
mystran
KVRAF
5244 posts since 12 Feb, 2006 from Helsinki, Finland
earlevel wrote:
Mon Apr 15, 2019 8:37 am
matt42 wrote:
Mon Apr 15, 2019 2:03 am
you can find it as mystran explained. The only issue is, depending on the magnitude of the pole, DC gain may be higher than the centre frequency. In those cases normalising the centre frequency will boost frequencies below that point above unity gain
Yes, and you need to check at the other end too (DC and Nyquist frequency, 0 and pi on the unit circle).
Actually if you need the frequency where the gain takes the maximum, then things get a bit hairy. If it's a peaking EQ (ie. poles and zeroes at the same frequency) or a BLT band-pass/notch, then you will find the maximum either at pole frequency (boost) or DC/Nyquist (cut). For any other placement of zeroes, the actual maximum is typically NOT at the pole frequency, but rather somewhere "nearby" (and away from the zeroes) unless the Q is low enough that the maximum is found at DC or Nyquist.

For example, any biquad BLT low-pass (ie. both zeroes at -1) with Q>sqrt(.5) will have a maximum gain point higher than the DC gain somewhere in it's passband, yet the cutoff gain is Q, so it only reaches unity at Q=1. As Q increases, the maximum gain point gets closer to cutoff, but it only becomes exactly the same once you reach the self-oscillation limit at Q=inf.

As for the best method to actually compute the exact answer... I'm not sure, since this is rarely needed for audio (where you usually want to normalise by some other condition). You could probably figure out an expression for the magnitude response and take derivative with respect to w, then solve for the roots, but I'm not sure if this is workable this is in practice without numerical root finding. You could also do an inverse BLT first (which just warps frequencies, which is fine since the answer can always be warped back) to avoid some of the trigonometry hell, but again I'm not sure how much it would help.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

HammieTime
KVRer
13 posts since 19 Mar, 2019
mystran wrote:
Sun Apr 14, 2019 11:12 pm
HammieTime wrote:
Sun Apr 14, 2019 9:44 pm
Where does the "gain" come from? I mean if the pole radius is close to 1.0f, obviously it's trying to pull the response to infinity at that frequency, but how do you find out the amount of that peak?
You can compute the response at a particular frequency by substituting z=exp(i*w)=cos(w)+i*sin(w) where w=2*pi*f/fs into the transfer function. The complex magnitude gives the gain, the complex angle gives the phase. Note that for DC z=1 and everything stays real (as long as coefficients are real).
Thank you. I got the Lowpass filter working now, so the filter process function was not the problem. It still sounds a bit funny and the low frequency response is certainly not behaving as I'd like it to behave. The Bilinear transform filter works better in this regard.

I did manage to normalize the gain with these lines:
K=(a(1)*z*z+a(2)*z+a(3))/(b(1)*z*z+b(2)*z+b(3));
K=abs(K);
, where z=exp(i*pole_angle). However it's seems quite cumbersome and I would need to take complex_t into use in my c++ code. z=+-1 seems to work in c++ for Lowpass and Highpass types but the Hipass sounds way off now.

HammieTime
KVRer
13 posts since 19 Mar, 2019
earlevel wrote:
Mon Apr 15, 2019 8:37 am
matt42 wrote:
Mon Apr 15, 2019 2:03 am
you can find it as mystran explained. The only issue is, depending on the magnitude of the pole, DC gain may be higher than the centre frequency. In those cases normalising the centre frequency will boost frequencies below that point above unity gain
Yes, and you need to check at the other end too (DC and Nyquist frequency, 0 and pi on the unit circle).

I have a dsp.stackexchange answer here, with way too much detail including code:

https://dsp.stackexchange.com/questions ... 6229#36229
Hi. There's quite a lot of information here, but I'll check it out. I've enjoyed your blog and there's a lot of great info there.