Filter frequency response grapher

Here’s a tool that plots frequency response from filter coefficients.

a coefficients (zeros)
b coefficients (poles)

The coefficients fields are tolerant of input format. Most characters that don’t look like numbers are treated as separators. So, you can enter coefficients separated by spaces or commas, or on different lines, separated by returns. That makes it easier to copy and paste coefficients from online filter calculators. They also ignore numbers that are followed by “=” or “ =”, so that “a0 = 0.1234” is seen as “0.1234”. Click the chart to accept coefficient changes, or change one of the controls.

Important: This tool does not assume that the filter coefficients are normalized to y0. So, in most cases you’ll need to insert a “1” as the first pole coefficient, the b0 term.

If there are no pole coefficients, it’s an FIR filter—all zeros.

Again, the convention of this website is that coefficients corresponding to zeros (left side of a direct form I) are the a coefficients, and poles the b coefficients. It’s usually easy to see because most IIR filter calculators normalize the output. So, if you are missing a0, it probably means that a and b are swapped with respect to this site’s convention—just paste them in the opposite coefficients fields (and remember to use a 1 for the missing coefficient). Also, negative signs at the summation for the feedback terms (b) are not rolled into the coefficients.

This entry was posted in Biquads, Filters, FIR Filters, IIR Filters, Uncategorized, Widgets. Bookmark the permalink.

4 Responses to Filter frequency response grapher

  1. olliw says:

    Hey Nigel
    first, I really very much like your articles. They also inspired me using Flotr2 too.

    I just copy&pasted results generated with your Pole-Zero placement v2 app to here, thinking that I would see identical amplitude responses, which I don’t. Please try

    Pole-Zero placement v2:
    entries from top to bottom: 0.88, 0.08, 0.895, 0.185
    poles at 0.8523531817931953 ± 0.2188471007050722i
    zeros at 0.748047588424602 ± 0.49137542210832796i
    a0 = 0.2282997765604545
    a1 = -0.3415581945878469
    a2 = 0.07262795524876171
    b1 = -1.7047063635863906
    b2 = 0.6786118930259678

    copy&pasted into left field
    a0 = 0.2282997765604545
    a1 = -0.3415581945878469
    a2 = 0.07262795524876171
    and right field
    b1 = -1.7047063635863906
    b2 = 0.6786118930259678

    keep up the good work

    • Nigel Redmon says:

      Thanks, Olli! At a glance, it looks like a problem with the coefficients generation of the Pole-Zero placement widget. I’ll dig into it as soon at I get a chance, much appreciated…

      OK, try it now.

      • olliw says:

        great 🙂

        btw, since we are at it, I’ve seen that you’re generating the x points for the log plot using
        (Math.pow(base, value) – 1) / (base – 1) * (max – min) + min;
        where value goes from 0 to 1.
        if equidistant points in the log plot are the goal, the equation would be , e.g. for base 10,
        Math.pow(10, Math.log10(max/min)*xi ) * min
        you may compare for min,max = 0.1,10 and value = 0.5
        not that it would matter 🙂

        cheers again

        • Nigel Redmon says:

          Thanks, Olli. I did catch that I wasn’t doing it quite right, as I grabbed some things from other ancient bits on this site. I “fixed” it, which broke it altogether; short on time, I put it back together and posted for now. (I don’t think it mattered, though; I started off doing my own log scaling as in the past, but discovered flotr2 has log option, and switched to that.)

          Looking further, I see I was doing it as you suggested for my Pole-Zero Placement V2 widget all along…really need to rewrite some of these things with common code for the website…btw, I found that base 2 works out better, not surprising for binary computers, and avoids 1.0 turning into 0.999…

Leave a Reply

Your email address will not be published. Required fields are marked *