/* * ---------------------------------------------------------- * Transform from s to z domain using bilinear transform * with prewarp. * * Arguments: * For argument description look at bilinear() * * coef - pointer to array of floating point coefficients, * corresponding to output of bilinear transofrm * (z domain). * * Note: frequencies are in Hz. * ---------------------------------------------------------- */ void szxform( double *a0, double *a1, double *a2, /* numerator coefficients */ double *b0, double *b1, double *b2, /* denominator coefficients */ double fc, /* Filter cutoff frequency */ double fs, /* sampling rate */ double *k, /* overall gain factor */ float *coef) /* pointer to 4 iir coefficients */ { /* Calculate a1 and a2 and overwrite the original values */ prewarp(a0, a1, a2, fc, fs); prewarp(b0, b1, b2, fc, fs); bilinear(*a0, *a1, *a2, *b0, *b1, *b2, k, fs, coef); }
// a0-a2: numerator coefficients // b0-b2: denominator coefficients // fc: Filter cutoff frequency // fs: sampling rate // k: overall gain factor // coef: pointer to 4 iir coefficients static void szxform(double *a0, double *a1, double *a2, double *b0, double *b1, double *b2, double fc, double fs, double *k, float *coef) { // Calculate a1 and a2 and overwrite the original values prewarp(a1, a2, fc, fs); prewarp(b1, b2, fc, fs); bilinear(*a0, *a1, *a2, *b0, *b1, *b2, k, fs, coef); }