Bilinear (Tustin) Transformation Calculator

Convert a continuous-time G(s) into its discrete-time Tustin equivalent H(z), see the exact frequency-warping formula in action, and compare against the naive unwarped response.

🔁 Bilinear (Tustin) Transformation Calculator
b₂
b₁
b₀
a₂
a₁
a₀
Sample period (T)0.05 s
s
0.0050.5
Test frequency (ωd)3 rad/s
rad/s
0.160
Warped analog frequency
Discrete numerator N(z)
Discrete denominator D(z)
Continuous = Discrete magnitude
Naive (unwarped) error
Step-by-step working

🔁 What is the Bilinear (Tustin) Transformation?

The bilinear transform, also called the Tustin transformation, is the standard method for converting a continuous-time transfer function G(s) into an equivalent discrete-time transfer function H(z) so it can run as a difference equation on digital hardware. It works by substituting s = (2/T)(z−1)/(z+1) into G(s), where T is the sample period, then clearing the resulting fraction by multiplying through by (z+1) squared. The result is a ratio of polynomials in z with real coefficients, exactly analogous to how a continuous transfer function is a ratio of polynomials in s.

Control and DSP engineers reach for the bilinear transform constantly. A control engineer who designs a PID controller as a continuous G(s) uses Tustin to get the discrete difference equation that actually runs on the embedded microcontroller. An audio or biomedical signal-processing engineer converts an analog filter prototype (a Butterworth or Chebyshev lowpass, for example) into its digital equivalent using the same substitution. Anyone verifying that a digitally implemented controller still behaves like its analog design at a specific operating frequency needs the frequency-warping relationship this transform introduces.

A common misconception is that the bilinear transform is only an approximation and therefore introduces error. The substitution itself is algebraically exact, not an approximation, it maps the entire continuous stability region to the entire discrete stability region one-to-one. What is not exact is the frequency axis itself: without correction, a straight substitution of a target discrete frequency into the original continuous formula gives the wrong magnitude, because the true relationship between continuous and discrete frequency bends through a tangent function. This bending, called frequency warping, is a real and predictable phenomenon, not a flaw in the method.

This calculator applies the exact bilinear substitution to a general 2nd-order G(s), reports the resulting discrete H(z) coefficients, computes the exact warped analog frequency for any chosen discrete test frequency, and shows both the true discrete magnitude and the naive (unwarped) continuous magnitude side by side on a chart, so the size of the warping distortion is visible directly rather than left as an abstract formula.

📐 Formula

s  =  (2/T) × (z − 1) / (z + 1)
T = sample period in seconds
Substituting into G(s) = N(s)/D(s) and clearing (z+1)² gives H(z) = N(z)/D(z) with real coefficients in z², z, and 1
Frequency warping identity: ωanalog = (2/T) × tan(ωdT/2), where ωd is the discrete test frequency in rad/s
|H(e^{jωdT})| ≡ |G(jωanalog)| exactly, for every ωd strictly between 0 and the Nyquist frequency π/T
Example: T = 0.05 s, ωd = 3 rad/s → ωanalog = 40 × tan(0.075) = 3.0056 rad/s (nearly equal to ωd since 3 rad/s is well below the Nyquist frequency of 62.83 rad/s)

📖 How to Use This Calculator

Steps

1
Enter the continuous G(s) coefficients. Type the numerator coefficients b2, b1, b0 and denominator coefficients a2, a1, a0 of the continuous transfer function G(s).
2
Set the sample period and test frequency. Type the sample period T in seconds and a test frequency ωd in rad/s below the Nyquist frequency π/T.
3
Read the discrete coefficients and warping result. See the discrete H(z) coefficients, the warped analog frequency, the matching magnitudes, and the naive-versus-actual error on the chart.

💡 Example Calculations

Example 1 — 2nd-Order Lowpass, Low Frequency (Mild Warping)

G(s) = 1 / (s² + 1.4s + 1), sampled at T = 0.05 s, tested at ωd = 3 rad/s

1
Nyquist frequency = π/T = π/0.05 = 62.83 rad/s, and 3 rad/s is only 4.8% of that, so warping should be small
2
Discrete coefficients: N(z) = z² + 2z + 1, D(z) = 1657z² − 3198z + 1545
3
Warped analog frequency: ωanalog = 40 × tan(0.075) = 3.0056 rad/s, and |G(j3.0056)| = |H(e^{j0.15})| = 0.11026 exactly
4
Naive (unwarped) magnitude at ωd = 3 directly: |G(j3)| = 0.11067, a 0.37% error versus the true 0.11026
ωanalog = 3.0056 rad/s, matching magnitude = 0.11026, naive error = 0.37%
Try this example →

Example 2 — 1st-Order Lag Near the Nyquist Frequency (Moderate Warping)

G(s) = 1 / (s + 1) (set a2 = 0 for 1st order), sampled at T = 0.1 s, tested at ωd = 25 rad/s

1
Nyquist frequency = π/0.1 = 31.42 rad/s, and 25 rad/s is 79.6% of that, so warping should now be significant
2
Discrete coefficients: N(z) = z² + 2z + 1, D(z) = 21z² + 2z − 19
3
Warped analog frequency: ωanalog = 20 × tan(1.25) = 60.19 rad/s, far above ωd itself, and |G(j60.19)| = |H(e^{j2.5})| = 0.01661 exactly
4
Naive magnitude at ωd = 25 directly: |G(j25)| = 0.03997, a large 140.61% error versus the true 0.01661
ωanalog = 60.19 rad/s, matching magnitude = 0.01661, naive error = 140.61%
Try this example →

Example 3 — Lead-Lag Near Nyquist (Dramatic Warping)

G(s) = (1 + 0.6s) / (0.05s² + 0.6s + 1), sampled at T = 0.1 s, tested at ωd = 29 rad/s (92.3% of Nyquist)

1
Nyquist frequency = π/0.1 = 31.42 rad/s; 29 rad/s is dangerously close, at 92.3% of the limit
2
Discrete coefficients: N(z) = 13z² + 2z − 11, D(z) = 33z² − 38z + 9
3
Warped analog frequency: ωanalog = 20 × tan(1.45) = 164.76 rad/s, and |G(j164.76)| = |H(e^{j2.9})| = 0.0727 exactly
4
Naive magnitude at ωd = 29 directly: |G(j29)| = 0.39091, a severe 437.72% error versus the true 0.0727, illustrating why pre-warping matters near the Nyquist frequency
ωanalog = 164.76 rad/s, matching magnitude = 0.0727, naive error = 437.72%
Try this example →

❓ Frequently Asked Questions

What is the bilinear (Tustin) transform used for?+
The bilinear transform converts a continuous-time transfer function G(s) into an equivalent discrete-time transfer function H(z) so a controller or filter designed in continuous time can run as a difference equation on a microcontroller or DSP. It substitutes s = (2/T)*(z-1)/(z+1), where T is the sample period, and is the most common method for this conversion because it always maps a stable G(s) to a stable H(z).
What is frequency warping in the bilinear transform?+
Frequency warping is the nonlinear relationship between a continuous analog frequency and its discrete equivalent under the Tustin substitution: omega_analog = (2/T)*tan(omega_d*T/2). Because tan() is nonlinear, equally spaced discrete frequencies do not map to equally spaced analog frequencies, and the distortion grows large as the discrete frequency approaches the Nyquist frequency pi/T.
How do you calculate the Tustin transform of a transfer function?+
Substitute s = (2/T)*(z-1)/(z+1) into G(s) = N(s)/D(s), then multiply both the numerator and denominator by (z+1) squared to clear the fractions. For a 2nd-order G(s) with coefficients b2, b1, b0 (numerator) and a2, a1, a0 (denominator), this calculator applies that substitution and algebra automatically to give the discrete coefficients directly.
Why use the bilinear transform instead of forward or backward Euler?+
The bilinear transform maps the entire continuous stability region (the left half of the s-plane) onto the entire discrete stability region (the interior of the unit circle) exactly, so a stable continuous design always produces a stable discrete design. Forward Euler can turn a stable G(s) unstable after discretization, and backward Euler, while always stable, distorts the frequency response more severely than Tustin for a given sample rate.
What is the Nyquist frequency and why does it matter here?+
The Nyquist frequency is pi/T, half the sampling frequency in radians per second, and it is the theoretical upper limit of frequencies a discrete-time system with sample period T can represent. The Tustin frequency-warping formula maps the entire continuous frequency axis (0 to infinity) into the finite range (0, pi/T), which is exactly why warping becomes severe as the discrete test frequency approaches pi/T.
How much error does skipping frequency pre-warping cause?+
The error depends entirely on how close the test frequency is to the Nyquist frequency pi/T. Below about 10% of the Nyquist frequency the naive (unwarped) approximation is usually within a few percent, but the error grows sharply and without bound as the frequency approaches pi/T, since tan(omega_d*T/2) diverges to infinity there while the true discrete magnitude stays finite.
Can the bilinear transform be applied to a first-order transfer function?+
Yes. Set the 2nd-order leading coefficients (b2 for the numerator, a2 for the denominator) to zero, and the same six-coefficient formula reduces to the 1st-order case automatically, since the s squared terms vanish from both the numerator and denominator before the substitution is applied.
Does the sample period T affect the discrete coefficients even for the same G(s)?+
Yes, significantly. The substitution constant c = 2/T appears squared in every coefficient, so halving T (doubling the sample rate) changes every discrete coefficient, even though the underlying continuous G(s) is unchanged. A faster sample rate also pushes the Nyquist frequency higher, reducing warping distortion at any fixed test frequency.
What does it mean if the discrete and continuous magnitudes match exactly at the warped frequency?+
It confirms the bilinear substitution algebra is exact: the true discrete magnitude response |H(e^{j*omega_d*T})| always equals the continuous magnitude |G(j*omega_analog)| evaluated at the warped frequency, to floating-point precision. This is not a coincidence or approximation, it is the defining identity of the Tustin transform, and this calculator displays both values so you can see the match directly.
Why does the naive (unwarped) curve diverge from the actual discrete response on the chart?+
The naive curve evaluates the original continuous G(s) directly at the discrete test frequency omega_d, skipping the tan() pre-warping step entirely. Since the true relationship bends through tan(omega_d*T/2) rather than a straight line, the naive curve tracks the actual discrete response closely at low frequencies but separates increasingly as omega_d approaches the Nyquist frequency pi/T.

What is the bilinear (Tustin) transform used for?

The bilinear transform converts a continuous-time transfer function G(s) into an equivalent discrete-time transfer function H(z) so a controller or filter designed in continuous time can run as a difference equation on a microcontroller or DSP. It substitutes s = (2/T)*(z-1)/(z+1), where T is the sample period, and is the most common method for this conversion because it always maps a stable G(s) to a stable H(z).

What is frequency warping in the bilinear transform?

Frequency warping is the nonlinear relationship between a continuous analog frequency and its discrete equivalent under the Tustin substitution: omega_analog = (2/T)*tan(omega_d*T/2). Because tan() is nonlinear, equally spaced discrete frequencies do not map to equally spaced analog frequencies, and the distortion grows large as the discrete frequency approaches the Nyquist frequency pi/T.

How do you calculate the Tustin transform of a transfer function?

Substitute s = (2/T)*(z-1)/(z+1) into G(s) = N(s)/D(s), then multiply both the numerator and denominator by (z+1) squared to clear the fractions. For a 2nd-order G(s) with coefficients b2, b1, b0 (numerator) and a2, a1, a0 (denominator), this calculator applies that substitution and algebra automatically to give the discrete coefficients directly.

Why use the bilinear transform instead of forward or backward Euler?

The bilinear transform maps the entire continuous stability region (the left half of the s-plane) onto the entire discrete stability region (the interior of the unit circle) exactly, so a stable continuous design always produces a stable discrete design. Forward Euler can turn a stable G(s) unstable after discretization, and backward Euler, while always stable, distorts the frequency response more severely than Tustin for a given sample rate.

What is the Nyquist frequency and why does it matter here?

The Nyquist frequency is pi/T, half the sampling frequency in radians per second, and it is the theoretical upper limit of frequencies a discrete-time system with sample period T can represent. The Tustin frequency-warping formula maps the entire continuous frequency axis (0 to infinity) into the finite range (0, pi/T), which is exactly why warping becomes severe as the discrete test frequency approaches pi/T.

How much error does skipping frequency pre-warping cause?

The error depends entirely on how close the test frequency is to the Nyquist frequency pi/T. Below about 10% of the Nyquist frequency the naive (unwarped) approximation is usually within a few percent, but the error grows sharply and without bound as the frequency approaches pi/T, since tan(omega_d*T/2) diverges to infinity there while the true discrete magnitude stays finite.

Can the bilinear transform be applied to a first-order transfer function?

Yes. Set the 2nd-order leading coefficients (b2 for the numerator, a2 for the denominator) to zero, and the same six-coefficient formula reduces to the 1st-order case automatically, since the s squared terms vanish from both the numerator and denominator before the substitution is applied.

Does the sample period T affect the discrete coefficients even for the same G(s)?

Yes, significantly. The substitution constant c = 2/T appears squared in every coefficient, so halving T (doubling the sample rate) changes every discrete coefficient, even though the underlying continuous G(s) is unchanged. A faster sample rate also pushes the Nyquist frequency higher, reducing warping distortion at any fixed test frequency.

What does it mean if the discrete and continuous magnitudes match exactly at the warped frequency?

It confirms the bilinear substitution algebra is exact: the true discrete magnitude response |H(e^{j*omega_d*T})| always equals the continuous magnitude |G(j*omega_analog)| evaluated at the warped frequency, to floating-point precision. This is not a coincidence or approximation, it is the defining identity of the Tustin transform, and this calculator displays both values so you can see the match directly.

Why does the naive (unwarped) curve diverge from the actual discrete response on the chart?

The naive curve evaluates the original continuous G(s) directly at the discrete test frequency omega_d, skipping the tan() pre-warping step entirely. Since the true relationship bends through tan(omega_d*T/2) rather than a straight line, the naive curve tracks the actual discrete response closely at low frequencies but separates increasingly as omega_d approaches the Nyquist frequency pi/T.