ELLF Digital Filter Calculator

This program calculates design coefficients for infinite impulse response (IIR) digital filters of the Butterworth, Chebyshev, or Cauer elliptic varieties. C compiler build scripts are provided for Borland C++ 4.5, Microsoft Visual C++ 6, Micrsoft C (old) version 6, gcc and Unix compilers. Latest update 6/4/00.

Usage

Inputs are entered by keyboard, or are redirected to come from a command file, as follows:

• Kind of filter (1: Butterworth, 2: Chebyshev, 3: Elliptic, 0: exit to monitor)
• Shape of filter (1: low pass, 2: band pass, 3: high pass, 4: band reject, 0: exit to monitor)
• Order of filter (an integer)
• Passband ripple (peak to peak decibels)
• Sampling frequency (Hz)
• Passband edge frequency (Hz)
• Second passband edge frequency (for band pass or reject filters)
• Stop band edge frequency (Hz) or stop band attenuation (entered as -decibels)

The "exit to monitor" type 0 may be used to terminate the program when input is redirected to come from a command file.

If your specification is illegal, e.g. the stop band edge is in the middle of the passband, the program will make you start over. However, it remembers and displays the last value of each parameter entered. To use the same value, just hit carriage return instead of typing it in again.

The program displays relevant pass band and stop band edge frequencies and stop band attenuation. The z-plane coefficients are printed in these forms:

• Numerator and denominator z polynomial coefficients
• Pole and zero locations
• Polynomial coefficients of quadratic factors

After giving all the coefficients, the program prints a table of the frequency response of the filter. You can get a picture by reading the table into gnuplot.

Filter design

The output coefficients of primary interest are shown as follows:

(z-plane pole location:)
pole 3.0050282041410E-001 9.3475816516366E-001
q. f.
z**2 9.6407477241696E-001
z**1 -6.0100564082819E-001
(center frequency, gain at f0, and gain at 0 Hz:)
f0 2.00496167E+003 gain 2.9238E+001 DC gain 7.3364E-001
zero 1.7886295237392E-001 9.8387399816648E-001
q. f.
z**2 1.0000000000000E+000
z**1 -3.5772590474783E-001
f0 2.21379064E+003 gain 0.0000E+000 DC gain 1.6423E+000

To make a biquad filter from this, the equation for the output y(i) at the i-th sample as a function of the input x(i) at the i-th sample is

y(i) + -6.0100564082819E-001 y(i-1) + 9.6407477241696E-001 y(i-2) = x(i) + -3.5772590474783E-001 x(i-1) + 1.0000000000000E+000 x(i-2).

Thus the two coefficients for the pole would normally be negated in a typical implementation of the filter.

Compilation

This program has been compiled successfully on many different computers. See the accompanying output listing file ellf.ans, for a set of correct answers. Use the batch file test.bat to check your executable program. If the low pass and high pass options work but the others don't, then examine your atan2() function carefully for reversed arguments or perhaps an offest of pi. On most systems, define ANSIC to be 1. This sets the expected atan2() arguments but does not otherwise imply anything about the ANSI-ness of the program.

Files

mconf.h
system configuration include file. Be sure to define type of computer here!
cmplx.c
complex arithmetic subroutine package
ellf.ans
right answer file for some elliptic filters
ellf.que
elliptic filter questions
ellf.c
main program
ellf.doc
this file
ellf.mak
Microsoft MSDOS makefile
ellfu.mak
Unix makefile
ellik.c
incomplete elliptic integral of the first kind
ellpe.c
complete elliptic integral of the second kind
ellpj.c
Jacobian Elliptic Functions
ellpk.c
complete elliptic integral of the first kind
makefile
Unix makefile
mtherr.c
common math function error handler
polevl.c
evaluates polynomials
test.bat
batch file to run a test
descrip.mms
VAX makefile
ellf.opt
VAX makefile
testvax.bat
VAX test

References

A. H. Gray, Jr., and J. D. Markel, "A Computer Program for Designing Digital Elliptic Filters", IEEE Transactions on Acoustics, Speech, and Signal Processing 6, 529-538 (December, 1976)

B. Gold and C. M. Rader, Digital Processing of Signals, McGraw-Hill, Inc. 1969, pp 61-90

M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards AMS 55, 1964, Chapters 16 and 17

- Steve Moshier, December 1986

Last rev: November, 1992