This post will show how a time delay can be approximated by a continouos-time (analog) transfer function. While the end result is well-known, the derivation here may provide some new insight.
The Laplace transform of function being delayed in time by T is seen below.
Hence, a delay can be added to a system by multiplying the system transfer function with the exponential as its own tranfer function.
We can immediately see that this does not fit with our usual way of writing transfer functions as rational functions; fractions with polynomials in the numerator and denominator as
However, it is too early to accept defeat. As engineers we have some go-to tools that can sometimes help us out. What if do a Taylor expansion of the Laplace transformed time delay?
Hmm, seemingly this does not help us much, as we are looking for polynomial fractions. But at least we now see some higher order terms, just as in the polynomials. We need to think some more. Now, the exponential terms may look familiar if you have some experience with digital signal processing, since the variable z (from z-transformation) relates to s as
The variable T here is not a time delay as such, but a sample time. However, the similarity to the time delay expression is worth noting. The mapping from the s-domain to z-domain, and vice versa, is non-linear, which poses a problem when designing for examples filters in one domain (typically the s-domain) with a wish to map to the other domain. Different techniques exist for this mapping, such as Matched z-Transformation, and Impulse Invariant z-Transformation, but the technique that can inspire us here is the so-called Bilinear z-transformation. With the Bilinear technique, the exponential is first put in exact fraction form by splitting the exponential into a two exponentials, and then approximated by essentially the Taylor expansion (but more on that later) to first order, giving us
And here we have something that starts looking like a standard transfer function. With this idea, we can now rewrite our time delay as
This is a first-order allpass filter with a characteristic angular frequency of
and K=-1, with the transfer function written as
So we have achieved a transfer function that approximates a time delay. Yay! But how close are we? What have we sacrified by approximating to a bilinear form (linear in numerator, and ditto in denominator)? Let us explore that question. First, we should decide on a time delay, and that will give us the characteristic frequency for the filter. Let's go with 10 us, which will gives us a characteristic angular frequency of 200 kHz. The amplitude response will be flat, since our approximation is an all-pass filter, and we get the following phase.
The phase of the 1st order all-pass filter tracks quite well with the pure delay, at least up to a certain frequency. We can also calculate the group delay of the all-pass filter as the derivative of the phase and get
This we can also plot the group delay associated with this phase for the 10 us delay case.
Note that while frequency was plotted linearly for the phase, it is logaritmic for the group delay plot. So, while our all-pass filter is an approximation, it is not way off compared to a pure delay. Let us now try to push the system by going to a time delay of 100 us; 10 times more than previously.
We can see that the phase deviates a lot from the ideal delay. The group delay is equivalently affected.
It is fairly trivial to show that while at low frequencies we get the correct time delay, at high frequencies we get zero time delay, and at the characteristic frequency we are down to half the intended time delay. So the more time delay we are looking for, the lower the characteristic frequency, and the more the first order all-pass will deviate from the ideal time delay.
It is often stated that to obtain a sufficient time delay, you should now cascade couple several of these first-order filters until you get the desired delay. What we are interested in is how well this will approximate a constant time delay, so we keep the desired delay of 100 us, and split the effort into two allpass filters each set to half that time delay, so that each their characteristic frequencies are doubled compared to a single filter. The resulting phase and group delay are shown below.
We see that we now have a better performing time delay via allpass filtering as we can go to double the frequency as before, before the delay is half of the design value.
So is that the best we can do for a second-order allpass filter? Well, we did not stick to our initial design method. First we found the optimum 1st order filter, but cascading two of them together was more of an ad hoc solution. What we should do is to expand our fraction to get the best approximation of the original time delay. Whereas we before did a bilinear expansion, we should instead do a biquadratic expansion. The way do to that is to find the (2,2) Padé approximant as shown below where, after some rearranging of terms, we get
If we compare this to the standard second-order allpass filter transfer function
we find that the best second-order approximation can be written as
The Q-value of 0.577 should ring a bell; this is the value found for any Bessel filter(!). So while it is well-known that the Bessel filter has the closest resembles to a time-delay, I have never seen it detailed like here. So let us try it out and see if it performs better than two first-order allpass filters. The phase and group delay for the second order filter are shown below.
For the group delay the red curve is the previous result for two first-order filters in sequence. It is seen that our second-order Bessel allpass filter performs better, as would be expected as we have explicitly calculated to second order (Padé) the best fit with a time delay. You can try out different Q-values near 0.577 (adjust the characteristic frequency accordingly to keep the correct time delay), and you will find that anything else than 0.577 is suboptimal. The two first-order filters together result in a Q-value of 0.5 for the resulting second-order function, and already there is a marked difference. For higher order filters this difference will only increase, and so the way to find the optimum is to expand to higher orders in the same way as described here, and you will end up with Bessel polynomials. As you realize that you can of course use tables for higher order Bessel polynomials, but as an exercise one should really do the expansion.
We have shown a very direct path to approximating a time delay with a transfer function using Padé expansion. For larger desired time delays, it will be necessary to go to larger order transfer functions, and the optimal route for doing so has been laid out.