Electronic Pages  Die Homepage der Familie Beis 
In my article Converting Analog into Digital Filters I described a method or a "recipe" how to convert analog filters into digital ones. The method there is based on the bilinear transformation. This transformation provides "better" results but requires more processing power than the more simple impulse invariant transformation which will be by far good enough for many or most applications. This is particularly true for simple single pole / single zero (1^{st} order) filters like lowpass filters that don't need to do more than just average incoming signals for display or so.
I started this article because I wanted to find out what happens when I realize a digital version of the analog RIAA equalizer, a phonographic record equalization filter network, defined by the RIAA. This kind of equalizer consists of 1^{st} order stages only. In the previously written article Converting Analog into Digital Filters I postulated that it wouldn't make much sense to realize such an equalizer digitally. You can read here why that is the case with both kinds of transformation.
By the way, I recommend to read the first chapters of the mentioned article Converting Analog into Digital Filters where I ask for some prerequisites from the reader and explain some useful basic knowledge.
For example, when you want to convert a simple lowpass filter like this one:
With the bilinear transformation you would get a complex algorithm like this:
This requires 5 multiplications, 4 additions and 2 registers.
The algorithm for a simple transformation is quite obvious:
This requires 2 multiplications, 1 addition and 1 register.
For example, with k = 0.01 and a_{1} = 0.99 the algorithm is: For each sample: For the new output value take e.g. 99% of the previous output value and add 1% of the actual input value to it.
That's it. This represents a low pass filter with a time constant of 100 samples (corresponding to a corner frequency of 0.16% of the sampling frequency). For the results of this lowpass filter's bilinear and simple impulse invariant transformation see the example below.
The transfer function of a single pole / single zero analog filter is:

The transfer function of a single pole / single zero digital filter is:

Usually a_{0} is normalized to 1 so that the digital process looks like this:
A program for this process would look like this:
Do 
or, with the additional variable Temp:
Do 
Often single pole filter are specified by their time constant τ instead of their corner frequency F_{c}. This time constant τ is calculated as follows:
τ = 1 / (2 · π · F_{c}) or, vice versa: F_{c} = 1 / (2 · π · τ)
The coefficients for some 1^{st} order filters are calculated as shown in the following table.
τ is the time constant in seconds and can be derived from the corner frequency F_{c}, see above
G is the optional gain factor. Set G = 1 when the gain at the horizontal section of the frequency response is to be 1.
F_{S} is the sampling frequency in Hz



3  



















































This sample outlines a digital lowpass filter with a time constant τ = 100 samples and no gain (i.e., G = 1). For a sample rate of 48 kHz this means τ = 100/48000 kHz = 2.08333 ms and a corner frequency F_{c} = 76.394 Hz. The corresponding analog circuit could e.g. be composed of R = 2.08 kΩ and C = 1 µF.
In the formula for the digital transfer function H(z) and in the table above I use a form where the factor k does not appear. But in this case (where b_{1} = 0) that's easy to convert because b_{0} = k:
b_{0} = 0.01
b_{1} = 0
a_{0} = 1
a_{1} = 0.99
The resulting frequency responses are
It is obvious that in practice the difference between the ideal (analog) and the digital frequency responses can often be neglected. Also the advantages of the bilinear transformed filter, i.e., a more correct corner frequency (which is invisible here) and less susceptibility to alias frequencies will rarely matter in practice.
The filter parameters are given in time constants:
(Note: The 20 Hz highpass is not specified by the RIAA. It was later recommended for playback only by the EIA.)
There is no gain applied to any stage.
The analog transfer function of the RIAA equalization filter consists of three poles and two zeros and is:

Remark: By multiplying out this four stage transfer function it can be reduced to e.g. a two stage transfer function, one dual pole stage and one single pole / single zero stage:

The digital transfer function of the RIAA equalization filter is:
a) For a sample rate F_{s} of 48 kHz:

b) For a sample rate F_{s} of 192 kHz:

Remark: These transfer functions can also be multiplied out to form less, but more complex stages.
Note: Do not believe that because 0.99934544 is so close to 1 you could use a_{1} = 1 instead. a_{1} = 1 would form a perfect integrator (with a succeeding differentiator due to b_{0} = 1 and b_{1} = 1). Actually, for the result's precision the number of decimal places of the difference a_{0} a_{1} (= the difference between a_{1} and 1) matters. In this case it is 0.00065456, so that the precision here is 5 decimal places. The higher the ratio F_{s}/F_{c} is, more extreme this situation becomes.
The step response for the transformation for F_{s} = 192 kHz has been simulated with a Visual Basic program and thus prooven to be correct.
Now let's have a look on the resulting frequency responses of these equations and discuss them:
Actually 5 different frequency responses are shown. All of them are different from each other in the upper frequency range. Those marked as Simple are the ones of the transfer functions above. Those marked as Bilinear are derived from the analog prototype using bilinear transformation. All frequency responses are simulated by using my AnalogtoDigital filter conversion program AnaDigFilt.
The significant deviations from the ideal analog frequency response clearly point out why I wrote that simple analog to digital conversion is not always possible or useful. In this example the results with 48 kHz sampling frequency are unacceptable. This is true for the bilinear transformation but even more for the simplified impulseinvariant transformation. For 192 kHz it is significantly better, but still not better than what can easily be achieved with a nonideal analog circuitry using available components.
In practice, the digital results could be improved by several means:
Though for technical reasons it may make little sense to use a digital RIAA equalizer there may be other, possibly important reasons like e.g. that its implementation is an interesting challenge or that it is a unique selling point (USP) for marketing.
The analog transfer function forms a 6^{th} order filter with 4 zeros and 6 poles which can be written as 6 1^{st} order filter stages.

Transformed to the digital transfer function using the impulse invariant transformation results:

Both these equations cannot directly be simulated with AnaDigFilt because AnaDigFilt is prepared for a maximum of 5 filter stages only. But AnaDigFilt's filter stages are able to handle 2^{nd} order filters so that it is possible to combine two 1^{st} order filter stages each to one 2^{nd} order filter stage and thus to simulate the equations. In this example I combine only the first and the last pair of stages to one stage each by multiplying them out.
Analog:

Digital for F_{S} = 48 kHz:

As it could be expected, both frequency responses are not acceptable as weighting filters, at least not with F_{S} = 48 kHz. But the results are in so far interesting as both frequency responses cross each other and the "simple" frequency responses ends at F_{S}/2 almost exactly where it ought to. This is because the individual frequency responses of the second and the third stage (both are 1^{st} order lowpass filters) are slightly higher towards F_{S}/2 while the frequency response of the last stage (a 2^{nd} order highpass filter with a corner frequency close to F_{S}/2) is not only significantly lower towards F_{S}/2, but also starts significantly earlier, visible from about 3 kHz on in the diagram.
Last update: October 13^{th}, 2015  Questions? Suggestions? Email Me!  Uwe Beis 