2
\$\begingroup\$

I have a measured digital/discrete finite impulse response from a system. As known from signal theory, this is in essence the sequence of filter coefficients of the corresponding FIR filter.

I think in practice it should be possible to approximate the impulse response with resistors, capacitors and inductors alone. Gain can be made up after the filter chain. Noise can be neglected. Realization with ideal components in e.g. SPICE would be enough for my purposes.

I'm wondering what the best strategy would be to design such an analog filter "backwards" from digital into analog again with respect to accuracy. What I mean with the last point is that I'm aware that a more accurate filter would need more components, but assuming I want n stages at most in my filter (I'm thinking of a ladder-type filter when I say "stages", but any kind of filter structure would be acceptable as long as it's only RLC), how do I find the optimal one (approximations within reason are acceptable)?

Impulse response as requested. Sample Impulse Response

\$\endgroup\$
3
  • \$\begingroup\$ Show us the impulse response. Most (for most meanings of most) FIR filters tend to be acausal symmetrical linear phase, which is impossible to achieve with passive components, which can only generate causal filters. \$\endgroup\$
    – Neil_UK
    May 27 at 21:11
  • \$\begingroup\$ I would be mighty surprised if the impulse response were acausal or even linear phase. It's a physical measurement. \$\endgroup\$
    – Sky V
    May 27 at 21:30
  • \$\begingroup\$ Most FIR filters are linear phase, as that's what they're designed to be good at. A measurement of a physical system will of course be causal. How much of the impulse do you want to fit? A 'proper' fit fits the signal, and rejects the noise. Underfitting fails to follow the signal. Overfitting faithfully tracks the noise. I see a short high frequency part (not well, you might crop your impulse to 2000 samples and post something that can be enlarged), a long low frequency part, and some stuff that may be noise or signal. Thinking IIR filter will give you a direct path to RLC implementation. \$\endgroup\$
    – Neil_UK
    May 27 at 22:51
1
\$\begingroup\$

how do I find the optimal one (approximations within reason are acceptable)?

Not only this sounds very vague, but what you want is a bit of a mission impossible: it's not that you can't build an analog version of an FIR, it's just that it would require the equivalent of the \$z^{-1}\$, which is some sort of a delay line. There are delay lines, but not for low sample rates, and they tend to be a bit expensive (last I remember). And Padé approximations are bandwidth limited, but you could use them if their bandwidth is above your equialent Nyquist frequency. However, that would require more than a measily 2nd order.

As a quick example, a Padé approximation is really a Bessel allpass, and its group delay is τ=2/ω. For a 1 Hz sampling rate you'll need a 1 ms delay. For that to happen you need ω=2/τ=2 rad, or ≈0.318 Hz. But a Padé is only an approximation of an infinite series, therefore the group delay will have a falloff at around ω (actually just short of it), so you need more than a 2nd order. In fact, a 5th order will not be enough to keep a constant group delay at 1 Hz, because it will have a droop of ≈30 ms. A 6th order only ≈3 ms.

But you could, in theory, make your FIR with a 4th order, since only the frequencies above Nyquist will be seriously degraded. Even a 2nd order will do if what you want is to build a generic FIR that has terrible frequency response but could, if you squint enough, match that of a true FIR until Nyquist -- but you need to match an impulse response here. Here's a comparison of a length 5 digital moving average (V(d)) compared to an analog version built with 4th order allpass delays (V(a)):

comp

Not bad, eh? But one "delay" is, at the very minimum, a double opamp, and this considering Delyiannis, or Friend, or similar one opamp biquads, which have 8 or 10 RC elements, and which are not exactly tolerant to component variations. For better matching and sensitivity you'll need at least a double opamp stage, and this modified to allow a 2nd order allpass, because that is what you need.

If you think you'll be able to cheat with a lowpass for lower component count, think again. You might say that you only need the bandwidth until Nyquist and you'd be right, but the group delay is halvened now, so you'll need almost twice the order to compensate. You may get away with 6th or 7th order, but with very poor response. So you won't save anything.

But now, the analog world is not like the digital: you will have to deal with component tolerances, with mismatches between opamps, parasitics, temperature drifts, etc. What you see above is the ideal approach; in reality, you may get something like this:

might

And this is a very quick hack for a 10% error in frequency per "delay", i.e. each ideal stage has all its capacitors vary by the same amount to give this 10%. You will not see this in real-life. Expect an even more smeared response. How do you think this will sit with your goal of recreating the impulse response even remotely close? Because if you don't match it with a sufficiently good approximation then the effort will be pointless.

But this is a small order. Given your picture, what you need there is quite a high order. Those spikes are very rich in high frequencies, which means you will need bandwidth which, in turn means a long FIR. I'm not talking about a length 20, or 30, or so, I'm talking in the range of 100 or even more (I'm thinking plural).

But, that impulse is nowhere near a symmetrical response, and if that is a room response (as I imagine), then that impulse comes from a nonlinear phase system (walls at different angles, varying degrees of attenuation due to carpets/brick walls/sofa/etc, mix of stiff/elastic surfaces, etc). So you may be able to represent that with an IIR. And those can have very steep transition widths for very low orders -- if you can manage the sensitivity. In theory, you can build a Cauer with (say) 1 dB ripple, fp=1 (unitless, it's the ratio that matters here), fs=1.1, and 40 dB @fs with a 6th order, but I dare you to make it with one-opamp biquad stages while remaining true (or close enough) to the response.

By now, if you managed to read this far, you'd probably feel like I'm deliberately trying to convince you not to do it. I'm not. The message that I would always try to convey is not "don't do it!", but "if you do it then this is what you'll get.".

\$\endgroup\$
1
  • \$\begingroup\$ I planned to say a few things about how to do it, in case it can be done, but after this it seems a bit redundant. \$\endgroup\$ May 28 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.