#ifndef BIQUAD__H #define BIQUAD__H #include #include // typical usage: // biquad butterworth({1., 2., 1.}, // {1., -1.99911142347079540116, 0.99911181807963833634}); typedef std::complex C; class biquad{ public: // d0 must always be 1 std::vector c, d; std::vector zeros, poles; double ws1, ws2; // remembered weighted sums C static constexpr C0 = C(0, 0); C static constexpr C1 = C(1, 0); // gory-detail constructor biquad(std::vector const _c, std::vector const _d, std::vector _zeros, std::vector _poles); // constructor in terms of coefficients: biquad(std::vector const _c, std::vector const _d); // constructor in terms of zero and pole position, // assuming conjugate pairs: biquad(C const zero, C const pole); // time-domain evaluation: double step(double const Vin); // z-plane transfer function C xfunc(const C z) const; void normalize(C const z = 1); void please_normalize(C const z = 1); }; #endif