
A new polezero calculator
An JavaScript remake of the old Javabased polezero placement applet—visit that page for tips on polezero locations for standard biquads. The main additions are input fields for precision polezero placement, and an option to display the response with a log frequency scale.
The basic idea is that poles blow, zeros suck. Think of poles as controlling a frequencydependent feedback or resonance—the impulse response of a pole inside the unit circle decays, while one outside is like runaway feedback (think of a mic feeding back into a loudspeaker). A pole on the unit circle gives a sustained oscillation (but watch out for numerical errors—keep your poles inside the unit circle, typically). Zeros absorb a particular frequency; when on the unit circle, they absorb the corresponding frequency completely.
So, poles push the frequency response up around their corresponding frequency, and zeros pull down around theirs. Keep in mind that the frequency response graph is normalized, just as the filter coefficients are. So, while a pole pushes up the response, it appears as though all other frequencies are being pushed down instead. Of course, normalization is important in practical application, but be aware of it when visualizing how poles and zeros interact.
I found a very nice web app showing interactive filter design with direct visualization in frequency domain and zdomain ( poles and zeros ) :
http://www.micromodeler.com/dsp/
This is intended for embedded dsp applications, but it’s still a incredibly useful pedagogical material.
Nice! Thanks
Hi there,
Very nice applet.
Any chance you could add the phase graph too? i.e.: atan(Im(H)/Re(H)). I’d like to get a better intuitive idea of how that works.
(And then, for a future version, could we manually select the number of poles & zeros? Add support for allpass filters… :o)
Many thanks,
Richard.
Hi Richard. I’ve thought many times about some of these features, and as you noted, one leads to another, and the only sound solution would be to go into the business of a making a commercial filter design software package, and I’d be heading far off track from what I’m trying to do…
The phase plot is the most obvious, but in the end we’ve got a second order filter, for which you can look up the unexciting phase characteristics elsewhere, and they are simply an accepted byproduct of this type of filter. (That is, the parametric EQs in your analog mixing console and their digital equivalents in your DAW do the same thing—do you demand to see their phase response before purchasing? No, because you accept what that type of filter gives you.) Now, it would be very helpful as you add some of the other things you mentioned—more poles and zeros, all pass filter…then you’re back in the business of making a filter design package. 😉
Nigel
This tool seems to be getting the signs for b1 and b2 the wrong way round, although that depends on how you write your equation;
In your other material you write y[n] = …. – b1 * y[n1] – b2 * y[n2]
In that case the signs are wrong, or rather, inconsistent with how you write the direct forms.
Thank you for catching that, Anthony. While I was at it, I improved the log tick value scaling. I also took the opportunity to restore continuous update on slider movement (broken when Safari and Chrome fixed their errors in HTML5 interpretation).
Clearest description I’ve ever read of poles and zeroes in the real world. Excellent!
To get a more complete example it would be great is the cut off frequency would be part of the parameters. It would also be very nice if the frequency on the 3dB point of the graph would be readable in some way.
Nevertheless, thanks for the great explaination!
Good idea, Matthijs. I’ll keep that in mind for the next time I have a chance to improve things.
Here “a” coefficients represents numerator, right? In most sources b is a numerator.
Hi Eugene—asked and answered a few times in comments on the site, but since you bring it up, I’ll put together a short article explaining the choice. Short version: In the internet age, I don’t doubt that binthenumerator has become most common. But I’m not going to edit articles going back to 2003, so yes, a in the numerator here 😉
How do you calculate the coefficients from the poles to get the frequency response? I know to use the quadratic formula to get the opposite so I naively attempted making a quadratic using the poles but couldn’t get the same result as the calculator. I’m guessing it’s something obvious I’m missing but I couldn’t find anywhere that shows it being done other than an uncommented line of code…
On this one, I’m calculating the frequency response directly from the locations of the poles and zeros. But since I also calculated and display the coefficients, of course it could have been derived from the coefficients (as in Evaluating filter frequency response).
You can look at the Javascript source with your browsers developer tools, or directly here. The function getBiquadCoefs_polezero2 converts from polezero to coefficients (OK, I see I multiply and add a term I’ve already determined to be zero, but I do these things quickly.)
I was busy with class D to put lpf in feedback, therefore use a lowpass filter on cutoff 60 Khz and use a lead filter to put poles in left plane.
But I stil not understand how to do that, I have now with ltspice simulated, I did have to use small capcitor and 3,9k resistor to get 500 Khz, but making capacitor bigger it jumps to 1.5 Mhz oscillation.
Th amp did work with 3.9 K and 47 Pf cap, ascilate on 4.5 Khz, and had a quite good control over the 60 Khz butterworth with a square test.
Need some ease stuf to learn about poles and zero,s I bow that a pole is the 3dB point and a zero where it cross 0 dB.
regards
I guess you’re talking about a first order filter. the frequency is related to RC, so yes, change C will change frequency. Yes, the pole would determine the 3 dB point for a lowpass, assuming the zero wasn’t close. But the zero pulls down—to infinity when it’s on the unit circle. For a lowpass, you’d normally put it at an angle of pi and magnitude 1, to pull down at half the sample rate.