Skip to content
DeepForgeby svx
All problems
MediumCalculusca-176

Bilinear Transform

Problem

The bilinear transform maps a continuous-time pole or zero s to the discrete-time location

z = (2/T + s) / (2/T - s)

where T is the sampling period. Given s and T > 0, return z. The left half-plane maps inside the unit circle.

Hint

s = 0 maps to z = 1 and s = -2/T maps to z = 0.

Test cases

case 1
in: [0,1]
expected: 1
case 2
in: [1,1]
expected: 3
case 3
in: [1,0.5]
expected: 1.6666666666666667
case 4
in: [-2,1]
expected: 0
Starter codePython
def bilinear_transform(s, t):
    # Your code here
    pass

4 test cases · run your code against them in the editor