Practical implementation of IIR/biquad filters following non-textbook transfer function of real-wold analog filter

I am trying to program a DSP filter to study prototypes of loudspeaker filters, which will be implemented as passive analog circuits in the final speaker system. This process involves simulation of the electro-acoustics of the entire loudspeaker system, taking into account the real-world impedance curves of the loudspeaker drivers, their acoustic frequency response, and the acoustics of the loudspeaker enclosure. The resulting transfer curves of the (simulated) analog filters therefore do not follow any "textbook filter functions".

I tried fitting IIR/biquad filter coefficients to the target function defined by the analog filter. To this end I used the invfreqz function in GNU Octave. This method can achieve a very good fit of the IIR/biquad filter function to the target function of the analog filter. However, the IIR/biquad filters are usually not stable, so they are useless in my situation.

I think the Matlab implementation of the invfreqz function is a bit better at estimating stable filters, but I guess that might not be the definitive answer to the problem (I don't have access to Matlab, so I can't check). I would also like to implement the solution using free software, possibly by taking a somewhat different approach than "brute-fore application of invfreqz".

I am not very experienced with DSP filter methods, so I am a bit clueless as how to tackle this problem. What could be a practical approach to estimate IIR/biquad filter coefficients that give a transfer function that is "sufficiently similar" to an arbitrary target function defined by an analog filter?

• There are good tools for to design loudspeakers/electronics ... try this forum diyaudio.com/forums/index.php as for an example. – Juha P Jan 9 at 20:42
• That's where I come from... I have not found any tools that suit my needs. – mbrennwa Jan 9 at 21:21
• Have you tried FDLS method by Gregory Berchin? – Juha P Jan 10 at 8:00
• Would FIR filters be an option? Easier to design and always stable. – Matt L. Jan 10 at 11:27
• As far as I can tell, the transfer functions of FIR filters cannot be implemented with conventional passive circuits (using a network of capacitors, inductors and resistors). The length of an impulse response of an analog filter is infinite. FIR filters therefore don't seem to be suitable to me to mimic the transfer function of an analog filter. Or am I missing something? – mbrennwa Jan 10 at 19:38