3.12 Bilinear Transformation: Definition and Properties
The most popular approach to designing conventional lowpass, highpass, bandpass and bandstop IIR filters is the bilinear transformation because it is capable of preserving in , most of the good features of the original . In this method, the discrete-time system function is obtained by:
| (3.64) |
The bilinear is not a “transform” that relies on basis functions such as Fourier and Z. Instead, it is a simple tranformation from in continuous-time to in discrete-time.23 The following examples illustrate the bilinear transformation.
Example 3.21. Examples of bilinear transformations. Assuming Hz, the bilinear transformation of (used in Figure 3.8) is
| (3.65) |
This operation can be very tedious when the order of is high. But Python (scipy.signal.bilinear) and Matlab/Octave have the handy bilinear function. The result in Eq. (3.65) could be obtained with [HzNum,HzDen]=bilinear(1,[1 2],1000) in Matlab and [HzNum,HzDen]=bilinear(1,[1 2],1/1000) in Octave. In Python, the commands are:
1import scipy.signal 2Bs=1; # numerator B(s) in continuous-time 3As=[1, 2]; # denominator A(s) in continuous-time 4Fs=1000 # sampling rate in Hz 5[Bz, Az]=scipy.signal.bilinear(Bs, As, Fs) 6print("Numerator B(z) =", Bz, " and Denominator A(z) =", Az)
Note that while Python’s and Matlab’s bilinear functions assume the sampling frequency as an input parameter, Octave adopts the sampling interval . The first (Python’s and Matlab’s) syntax will be adopted here unless otherwise stated.
As an alternative to dealing with polynomials and , it is possible to use bilinear with the roots of these polynomials, by providing the poles and zeros of . In Matlab, the same in Eq. (3.65) could be obtained using the poles and zeros of , with: [HzZeros,HzPoles,gain]=bilinear([],-2,1,1000).
As a second example, consider the conversion of (the poles are and the zero is ) assuming Hz:
which can be obtained in Matlab with the command [HzNum,HzDen]=bilinear([1 -3],[1 4
5],10).
An alternative call would be [HzZeros,HzPoles,gain]=bilinear(3,transpose([-2+j -2-j]),1,10)
that leads to
| (3.66) |
But note that when using the function bilinear with poles and zeros in Matlab, one needs to use column instead of the row vectors used with transfer functions.
Example 3.22. Bilinear transformation of second order systems using symbolic math. Symbolic math can be used to conveniently perform algebraic manipulations, such as the bilinear transformation. In Matlab, the second order given by Eq. (3.28) can be converted to a discrete-time version using Listing 3.21.
1%define s, z, natural frequency, damping ratio and sampling interval 2syms s z wn zeta Ts %all as symbolic variables 3Hs=wn^2/(s^2+2*zeta*wn*s+wn^2) %H(s). Use pretty(Hs) to see it 4%Hs=(2*zeta*wn*s+wn^2)/(s^2+2*zeta*wn*s+wn^2) %Another H(s) 5Hz=subs(Hs,s,(2/Ts)*((z-1)/(z+1))) %bilinear: s <- 2/Ts*(z-1)/(z+1) 6Hz=simplify(Hz) %simplify the expression 7pretty(Hz) %show it using an alternative view
The bilinear transformation of Eq. (3.28) is obtained as
| (3.67) |
which can be simplified using Eq. (1.36), i. e., substituting to obtain
| (3.68) |
Similarly, Listing 3.21 can be used to find the bilinear transformation of Eq. (3.31) as
| (3.69) |
Listing 3.22 can be used to verify Eq. (3.67) and Eq. (3.69)
1wn=2; %natural frequency in rad/s 2zeta=0.5; %damping ratio 3Fs=10*wn/(2*pi); %Fs chosen as 10 times the natural freq. in Hz 4Wn=wn*(1/Fs); %convert angular freq. from continuous to discrete-time 5if 1 %Hs=wn^2/(s^2+2*zeta*wn*s+wn^2) 6 [Bz,Az]=bilinear(wn^2,[1 2*zeta*wn +wn^2],Fs) %to compare below 7 Bz2=Wn^2*[1 2 1]; %expression from this textbook 8 Az2=[4+4*zeta*Wn+Wn^2 2*Wn^2-8 4-4*zeta*Wn+Wn^2]; %from textbook 9else %Hs=(2*zeta*wn*s+wn^2)/(s^2+2*zeta*wn*s+wn^2) %Another H(s) 10 [Bz,Az]=bilinear([2*zeta*wn wn^2],[1 2*zeta*wn +wn^2],Fs)%compare 11 Bz2=[4*zeta*Wn+Wn^2 2*Wn^2 Wn*(Wn-4*zeta)]; %from textbook 12 Az2=[4+4*zeta*Wn+Wn^2 2*Wn^2-8 4-4*zeta*Wn+Wn^2]; %from textbook 13end 14Bz2=Bz2/Az2(1), Az2=Az2/Az2(1) %normalize as done by bilinear.m
Together, Listing 3.21 and Listing 3.22 indicate the power of combining symbolic math and numerical functions.
Derivation of the bilinear transformation
There are several ways to explain and/or motivate the bilinear method. One of them is by modifying the matched Z-transform of Eq. (2.59), which relates z and s by . Multiplying this relation by and using the Taylor expansion truncated to the first order , leads to24
| (3.70) |
Solving for , one obtains the bilinear transformation:
| (3.71) |
and, therefore, the conversion is performed with Eq. (3.64).
The approximation requires to be close to 0, which in the bilinear transformation corresponds to having , i. e., having small enough (a high sampling frequency) for the values of of interest.
3.12.1 Bilinear mapping between s and z planes and vice-versa
Eq. (3.64) imposes a mapping between the s and z planes that depends only on . The code ak_map_s_into_z.m and ak_map_z_into_s.m allows to explore the mapping from s into z and vice-versa, respectively. The first mapping (from Eq. (3.64)) is
| (3.72) |
and the mapping from s to z can be derived by isolating z:
| (3.73) |
Example 3.23. Interpreting the mapping imposed by the bilinear transformation. According to Eq. (3.64), the bilinear transformation obtains the value of for a given , from the value of . For instance, assuming and seconds, then . To avoid confusion and disambiguate and , it is useful to use a subindex and denote them and , respectively. The result of the previous example can now be conveniently written as .
Figure 3.33 shows some examples of the mapping imposed by the bilinear transformation. Figure 3.33(a) illustrates how 11 points uniformly spaced in the unit circle of the plane z are mapped to s when assuming Hz. Their corresponding positions in both planes are indicated by the numbers (point 1 in z plane is mapped into point 1 in s plane, and so on). For instance, the pair of points “1” show that (DC) is mapped into . The points in the range “2” to “6” correspond to positive frequencies, while points “7” to “11” represent negative frequencies. As a point gets closer to (that is ) in plane z, its corresponding mapping into the s plane converges to or , depending if the limit is approached from a positive or negative frequency, respectively.
Figure 3.33(b) uses the same choice of points in z as in Figure 3.33(a), but now with increased from to 150 Hz. Comparing these two figures, one can notice that the same point “6” in plane z leads to where is larger than 2000 rad/s in Figure 3.33(b) and less than 120 rad/s in Figure 3.33(a).
Figure 3.33(c) shows that the points in are mapped into the z unit circle. Figure 3.33(d) illustrates that points at the left half S-plane are mapped inside the unit circle in z, while the points at the right half s plane are outside this circle. This fact explains the mentioned property of the bilinear transformation: causal and stable filters are mapped to causal and stable filters .
Careful observation of Figure 3.33(c) allows to conclude that a linear spacing among the points in the s plane corresponds to a non-linear spacing in the z plane. This fact is further studied in the next subsection.
3.12.2 Non-linear frequency warping imposed by bilinear
Assume the bilinear transformation was used to map into (the subscripts will make easier to distinguish the two transfer functions). The current task is to observe the relation between frequencies and in the discrete and continuous-time, respectively, when the bilinear is used. This mapping between and was illustrated in Figure 3.33(a) to Figure 3.33(c).
By the definition of bilinear in Eq. (3.64), the mapping between the frequency responses can be found by substituting and into Eq. (3.72). This leads to
| (3.74) |
where the second equality follows from the tricks of Eq. (A.14) and Eq. (A.15) applied to numerator and denominator, respectively. Consequently, Eq. (3.74) can be written as
| (3.75) |
which indicates how the bilinear relates (rad/s) and (rad). When the bilinear transformation relates and , the system function behaves at frequency in the same way that behaves at frequency .
In spite of this nonlinear frequency warping imposed by the tangent in Eq. (3.75), the “shape” of is typically a good approximation of . For example, the ripples are maintained. In particular, “equal ripple” filters such as Chebyshev and elliptic have the ripples preserved.
As mentioned, an arbitrary such as a differentiator (see its mask in Figure 3.47) may get severely distorted when converted to using the bilinear transformation. Hence, the bilinear is the most used in practice to design the conventional lowpass, highpass, bandpass and bandstop IIR filters, which aim at a flat magnitude over the passband.
From Eq. (3.75), it can be shown that the sampling () and Nyquist () frequencies, are mapped approximately to the digital frequencies and 2 rad, respectively. This is illustrated in Figure 3.34. When , it is mapped by the bilinear into rad. In summary, the specific values of the continuous-time frequency are mapped, respectively into and .
Note that (Eq. (1.36)), represented in Figure 1.45, is used when mapping from continuous-time to discrete-time via periodic sampling. The mapping between and illustrated in Figure 3.34 is imposed by the bilinear transformation and happens in a very distinct situation: when using Eq. (3.64) to convert into . Some examples are provided in the next paragraphs to illustrate the bilinear frequency warping.
Example 3.24. Nonlinear relation among frequencies obtained with the bilinear transformation. Figure 3.35 illustrates the plot obtained with Listing 3.23, which assumes Hz. Note that the three passbands have the same bandwidth in ( rad/s), but the bilinear mapping generates three distinct corresponding bandwidths in . The “nonlinear warping” that led to different bandwidths, would also occur in the other way around: considering a situation with equal bandwidths in .
1%% Plot the bilinear frequency relation 2Fs=0.5; %sampling frequency. Use a convenient value. 3W=linspace(0,3*pi/4,100); %digital frequencies in rad 4w=2*Fs*tan(W/2); %analog (warped) frequencies in rad/s 5plot(W,w), xlabel('\Omega (rad)'), ylabel('\omega (rad/s)') 6%% Same bandwidths in w (rad/s) lead to decreasing bands in W (rad) 7deltaw=0.4; w=[0.2+(1:6)*deltaw]; %frequencies in w (rad/s) 8disp(['b1,b2,b3=' num2str(deltaw) ' rad/s (all have same value)']) 9W=2*atan(w/(2*Fs)); %find the corresponding frequencies in W (rad) 10disp(['B1,B2,B3=' num2str(W(2)-W(1)) ', ' num2str(W(4)-W(3)) ', ' ... 11 num2str(W(6)-W(5)) ' rad, respectively']);
More specifically, executing Listing 3.23 leads to:
b1,b2,b3=0.4 rad/s (all have same value) B1,B2,B3=0.48996, 0.2263, 0.11891 rad, respectively
which confirms the nonlinear frequency warping indicated in Figure 3.35.
Example 3.25. Example of how frequencies and are warped when related via the bilinear transformation. The warping of Eq. (3.75) is illustrated in Figure 3.36 for Hz.
For instance, with Hz, a given continuous-time angular frequency rad/s is mapped into rad (or equivalently the multiples ), i. e., . Figure 3.36 shows the discrete-time frequencies (angles) corresponding to .
Using the plot for , rad/s is mapped, as expected from Eq. (3.75), to rad. As discussed, the bilinear maps frequencies from Hz to rad, and to rad.
Example 3.26. Using 2-d and 3-d graphs to observe how the bilinear maps s and z planes. This is another example that indicates how is mapped into the z-plane by the bilinear transformation. Consider the system function
| (3.76) |
which can be obtained using
and has rad/s as the highest pole frequency. The poles at create a peak at rad/s, which has a frequency of Hz as shown in Figure 3.37. This was chosen because it is not a standard filter realization with a flat passband, as illustrated in Figure 3.37. It is not evident in Figure 3.37, but when due to the asymptotic decay with dB per decade imposed by the denominator order being 3 while the numerator’s is 2.
Figure 3.38 shows the magnitude (in dB) of four frequency responses from distinct obtained with the bilinear transformation of using the following sampling frequencies : 1, 3, 5 and 7 Hz. The plots illustrate aspects such as that the behavior of when (goes to in dB scale, in this case) is mapped to rad.
Comparing Figure 3.37 and Figure 3.38, one can observe that the bilinear transformation may impose severe modifications when converting the function from the s to the z plane. That should be expected because it is desired to map the infinitely long axis into the unit circle and, to accomplish that, the bilinear mapping corresponds to the nonlinear warping of imposed by Eq. (3.75).
Observing Figure 3.38 for the extreme case of Hz and recalling that is always mapped to approximately rad, the pole peak at in Figure 3.37 is then mapped to rad. In this case, the linear increase with frequency of the magnitude in dB scale observed in from to 1.6 Hz is severely distorted in .
The 3-d plots of for the whole Z plane can further illustrate the impact of in the bilinear transformation. The function ak_bilinearPlotZPlane.m was used to obtain Figure 3.39. Given , varying locates the three poles in different positions. While for Hz the pair of complex-conjugate poles have angles closer to rad, the angles move towards 0 when increases, such that they are approximately rad when Hz. This 3-d view complements the information in Figure 3.38.
3.12.3 Tracking the frequency warping provoked by bilinear
The next paragraphs discuss how the frequencies of a continuous-time filter are warped by Eq. (3.75) and mapped into frequencies of discrete-time , and then mapped back to continuous-time frequencies when using Eq. (1.36). Hence, one is dealing with two frequency normalizations: , which is imposed by the bilinear, and , which is due to the uniform sampling.25
Therefore, when an IIR filter is designed using as starting point and later implemented in a system with sampling frequency , there are three frequency categories of interest:
- : the analog angular frequencies associated to the analog filter ,
- : the digital frequencies of (or )
- : other analog frequencies, which are related to via as indicated in Eq. (3.26).
It is useful to adopt a more elaborated notation to relate these frequencies to their corresponding frequency responses. With this goal, the system functions and will be denoted as and , respectively.
As used before, the frequency response of the analog filter is , while is adopted for the digital filter. When is followed by a D/S step as in Eq. (3.26), the equivalent frequency response of this combined action will be denoted here as . The subscripts of and suggest: from “analog” and “digital” filters, respectively (they are both “analog” frequencies, in rad/s, such that is not a digital frequency).
When dealing with the bilinear transformation and knowing the value that will be used, it is then useful to rewrite Eq. (3.75) using (as it was done to obtain Eq. (3.24)), which leads to
| (3.77) |
Eq. (3.77) indicates that, when the bilinear transformation is adopted, behaves at frequency in the same way that the continuous-time equivalent version of behaves at frequency . In other words, the two systems have the same gain and phase at frequencies and , respectively. The goal of the next example is to expose this relation.
Example 3.27. Frequencies and in bilinear warping. As an example of analog system, Listing 3.24 obtains
| (3.78) |
and converts it to using bilinear. The filter is lowpass and its pole with highest frequency is at rad/s, which is Hz. The adopted sampling frequency was Hz.
1a=1; %zeros in the s-plane 2b=-2; c=-1+1j*4; d=-0.1+1j*20; %poles in the s-plane 3Hs_num=poly(a); %numerator of H_s(s) 4Hs_den=poly([b c conj(c) d conj(d)]) %H_s(s) denominator 5k=Hs_den(end)/Hs_num(end); %calculate factor 6Hs_num=k*Hs_num %force a gain=1 at DC (s=0) 7Fs=10; %sampling frequency (Hz) 8[Hz_num, Hz_den] = bilinear(Hs_num, Hs_den, Fs) %bilinear
Figure 3.40 shows26 the magnitude of frequency responses of (from top to bottom) , and .
Note that the frequency axis of has been warped27 according to Eq. (3.77).
The pole at rad/s was mapped to
which can be checked via the commands:
In some situations, it is desirable to avoid that a frequency of interest ( rad/s in this case) becomes mapped to another frequency . In such cases, a pre-warping procedure can be adopted, as will be discussed in Section 3.13.1.
3.12.4 Advanced: Properties of the bilinear transformation
The bilinear transformation has two important properties for digital filtering applications:
- it is capable of maintaining the order of equals to the order of the original proper , and
- if is causal and stable, then so it is .
It has also other interesting properties. The bilinear makes any point in the s-plane to be mapped onto a unique point in the z-plane and vice-versa. It establishes a correspondence between the “analog” DC and the “digital” DC . Similarly, it maps the highest digital frequency into the highest analog frequency .
The bilinear transformation generates with the same number of poles as in . In fact, a finite pole or zero at is mapped to a pole or zero at
| (3.79) |
From Example 3.21, one can check that s=-2+j;Ts=0.1;z=(2+Ts*s)/(2-Ts*s) outputs 0.81 + 0.082j, as indicated in Eq. (3.66).
If is too small (make in Eq. (3.79)), the bilinear maps the pole (or zero) into , which can significantly distort the original . On the other hand, if , it would be mapped to .
As depicted in Figure 3.41, when the bilinear is used for designing IIR filters, the value of is used twice and cancels out. In these cases, an arbitrary and reasonable (not too large or small) value such as can be used. In cases in which does not cancel out (e. g., in some designs of a digital controller), it is important to choose a value that preserves in the characteristics of interest in .
The bilinear can create extra zeros at . This behavior can be studied by applying the bilinear transformation to . For higher order , most of the extra zeros at are canceled.28
Another aspect is that, when mapping a given to using the bilinear, their values can be forced to match at a single frequency value. For filters having a single cutoff frequency such as lowpass and highpass filters, this frequency is often the chosen one.
When using the bilinear, the values of and can coincide in only one frequency value, but when designing IIR filters, one can obtain already taking in account that the bilinear will distort the frequencies. This can be done by “pre-warping” the frequencies of interest and is not limited to a single frequency. In other words, it is possible to use “pre-warping” in all frequencies of interest (e. g., passband and stopband frequencies for a lowpass) to obtain and, after this stage, face the bilinear restriction of matching and in a single frequency.