# Plot Magnitude from RBJ Biquad

Currently I'm working out plotting biquads in a VST/AU plugin and have problems with the graphics part. I posted in several forums but haven't got a really useful answer for this case.

First, tell me if I'm right how to get the magnitude response. For this I use this equation http://rs-met.com/documents/dsp/BasicDigitalFilters.pdf

Am I right that I have to get an array of values, the "points" which are my Y-axis values in my filter plot?

So far, so good. Now, how should I move on to plot this magnitude on screen? I'm really on a point I don't know how to go on.

I'm using the WDL/IPlug framework in which I can use DrawPoints(x,y) and DrawLine (x,y,x1,y1) classes for drawing.

Any help would be appreciated, especially code examples/snippets (I'm learning easier when I can see it...)!

• as an alternative to Eq. (18) in the pdf referenced in the question, another formula for magnitude response is this answer. it doesn't need to evaluate the $\cos(.)$ twice (once for $\omega$ and again for $2\omega$). instead it's in terms of $\sin^2(\omega/2)$ and its square. – robert bristow-johnson Jan 26 '16 at 0:35

As you might know the magnitude response is plotted over the frequency. So you will need to define your points on your x-axis, which resembles the frequency $f$.
In digital systems your frequency will go up to $f_s/2$, where $f_s$ is the sample rate. The $\omega$ is just $2\pi f$. So you just have to subsitute $\omega=2\pi f$ in Eq.(18) and calculate the magnitude response $|H(e^{j 2\pi f})|$ (y-axis) for desired frequency points (x-axis).
You will end up with two vectors. One is the vector of frequencies $\mathbb{f}$ that you define. And the other vector is your calculated magnitude response $|H(e^{j 2\pi f})|$.