Filter Design ResultsFilter Design Results Generated by: http://www-users.cs.york.ac.uk/~fisher/mkfilter Summary You specified the following parameters: filtertype = Butterworth passtype = Lowpass ripple = order = 4 samplerate = 51065 corner1 = 1250 corner2 = adzero = logmin = Results Command line: /www/usr/fisher/helpers/mkfilter -Bu -Lp -o 4 -a 2.4478605699e-02 0.0000000000e+00 raw alpha1 = 0.0244786057 raw alpha2 = 0.0244786057 warped alpha1 = 0.0245269747 warped alpha2 = 0.0245269747 gain at dc : mag = 3.468956503e+04 phase = 0.0000000000 pi gain at centre: mag = 2.452922667e+04 phase = -1.0000000000 pi gain at hf : mag = 0.000000000e+00 S-plane zeros: S-plane poles: -0.0589743974 + j 0.1423767901 -0.1423767901 + j 0.0589743974 -0.1423767901 + j -0.0589743974 -0.0589743974 + j -0.1423767901 Z-plane zeros: -1.0000000000 + j 0.0000000000 4 times Z-plane poles: 0.9334696354 + j 0.1336982144 0.8656714581 + j 0.0513573758 0.8656714581 + j -0.0513573758 0.9334696354 + j -0.1336982144 Recurrence relation: y[n] = ( 1 * x[n- 4]) + ( 4 * x[n- 3]) + ( 6 * x[n- 2]) + ( 4 * x[n- 1]) + ( 1 * x[n- 0]) + ( -0.6687309839 * y[n- 4]) + ( 2.9435650706 * y[n- 3]) + ( -4.8735775075 * y[n- 2]) + ( 3.5982821869 * y[n- 1]) Ansi ``C'' Code /* Digital filter designed by mkfilter/mkshape/gencode A.J. Fisher Command line: /www/usr/fisher/helpers/mkfilter -Bu -Lp -o 4 -a 2.4478605699e-02 0.0000000000e+00 -l */ #define NZEROS 4 #define NPOLES 4 #define GAIN 3.468956503e+04 static float xv[NZEROS+1], yv[NPOLES+1]; static void filterloop() { for (;;) { xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; xv[3] = xv[4]; xv[4] = next input value / GAIN; yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3]; yv[3] = yv[4]; yv[4] = (xv[0] + xv[4]) + 4 * (xv[1] + xv[3]) + 6 * xv[2] + ( -0.6687309839 * yv[0]) + ( 2.9435650706 * yv[1]) + ( -4.8735775075 * yv[2]) + ( 3.5982821869 * yv[3]); next output value = yv[4]; } } Download code and/or coefficients: Magnitude (red) and phase (blue) vs. frequency x axis: frequency, as a fraction of the sampling rate (i.e. 0.5 represents the Nyquist frequency, which is 25532.5 Hz) y axis (red): magnitude (linear, normalized) y axis (blue): phase For an expanded view, enter frequency limits (as a fraction of the sampling rate) here: Lower limit: Upper limit: Impulse response x axis: time, in samples (i.e. 51065 represents 1 second) y axis (red): filter response (linear, normalized) Step response x axis: time, in samples (i.e. 51065 represents 1 second) y axis (red): filter response (linear, normalized) For a view on a different scale, enter upper time limit (integer number of samples) here: Upper limit: Tony Fisher fisher@minster.york.ac.uk