design_biquad (2)

Biquad filter design.


Prototype

FRat<float> design_biquad(cstring type, float f, float Q, float gain_dB=0)

Parameters

typeFilter type ("lp", "hp", "bp", "sb", ...).
fNormalized cut-off frequncy (or central frequency for band-pass and band-stop), between 0 and 0.5.
QQuality factor (note: for \(Q>1/\sqrt(2)\sim 0{,71}\), there will be some resonnance).
gain_dBGain, in dB, used only for the filter of type resonnance or plateau.

Description

These second order RII filter are adapted from analog prototype through the bilinear transform.

The analog prototypes are the following ones (defined for a cutoff pulsation of 1 radian/s, and \(Q\) being the quality factor):

  • Low-pass filter: \[ H(s) = \frac{1}{s^2+\frac{1}{Q}s+1} \]
  • High-pass filter: \[ H(s) = \frac{s^2}{s^2+\frac{1}{Q}s+1} \]
  • Band-pass filter: \[ H(s) = \frac{s/Q}{s^2+\frac{1}{Q}s+1} \]
  • Band-stop filter: \[ H(s) = \frac{s^2+1}{s^2+\frac{1}{Q}s+1} \]

Example: low-pass filters, with different values for the quality factor

    Figure f;
    pour(auto Q: {0.5f, 1.0f/std::sqrt(2.0f), 1.0f, 2.0f})
    {
      soit h = design_biquad("pb", 0.25, Q);
      f.plot(frmag(h), "", "Q={:.2f}", Q);
    }


Bibliography