Hacker News new | past | comments | ask | show | jobs | submit login

There are a few procedures that convert an impulse response to an approximating IIR filter:

1. Hartmut Brandenstein and Rolf Unbehauen, "Weighted Least-Squares Approximation of FIR by IIR Digital Filters", IEEE TRANSACTIONS ON SIGNAL PROCESSING, VOL. 49, NO. 3, MARCH 2001

2. Hon Keung Kwan and Aimin Jiang, "Recent Advances in FIR Approximation by IIR Digital Filters", 2006 International Conference on Communications, Circuits and Systems

3. Ngai Wong and Chi-Un Lei, "FIR Filter Approximation by IIR Filters Based on Discrete-Time Vector Fitting", 2007 IEEE International Symposium on Circuits and Systems (ISCAS)

The third one is approachable by anyone who has studied linear algebra at the level usually taught for physics students and knows NumPy. No special DSP course is required. My implementation takes approximately 200 lines of Python code.

The article contains a deterministic algorithm that takes a guess on the pole positions in the complex plane and returns a better guess. The idea is to start with a random guess with the correct symmetry and apply the algorithm iteratively.

The only two tricks to be aware of are: 1) their reformulation of everything in section III.B in terms of real numbers (instead of complex numbers) is not making anything simpler and should be ignored, and 2) explicitly symmetrize matrices that are supposed to be symmetrical, it order to avoid accumulation of numerical errors.

Still, it is not something that I would be willing to fully automate: for good results, one has to add a small delay or chop off a few initial near-zero samples, and guessing the delay correctly is what separates an easy-to-approximate filter from a bad one.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: