response method

Complex response(
  1. double normalizedFrequency
)
inherited

Implementation

Complex response(double normalizedFrequency) {
  double w = 2 * math.pi * normalizedFrequency;
  Complex czn1 = Complex.polar(1.0, -w);
  Complex czn2 = Complex.polar(1.0, -2 * w);
  Complex ch = new Complex(1);
  Complex cbot = new Complex(1);

  for (int i = 0; i < _numBiquads; i++) {
    Biquad stage = _biquads[i];
    Complex cb = new Complex(1);
    Complex ct = new Complex(stage.getB0() / stage.getA0());
    ct = MathSupplement.addmul(ct, stage.getB1() / stage.getA0(), czn1);
    ct = MathSupplement.addmul(ct, stage.getB2() / stage.getA0(), czn2);
    cb = MathSupplement.addmul(cb, stage.getA1() / stage.getA0(), czn1);
    cb = MathSupplement.addmul(cb, stage.getA2() / stage.getA0(), czn2);
    ch *= ct;
    cbot *= cb;
  }

  return ch / cbot;
}