HomeVideos

Discrete control #5: The bilinear transform

Now Playing

Discrete control #5: The bilinear transform

Transcript

372 segments

0:00

ayyyy everyone welcome back to control

0:02

system lectures this is video number 5

0:05

on discrete control and here we're gonna

0:07

cover the famous and useful bilinear

0:09

transform if you've missed any of the

0:11

other previous videos on discrete

0:13

control you can find their links in the

0:14

description below but let's get to it

0:16

the bilinear transform is yet another

0:19

method for converting or mapping a

0:22

continuous system into a discrete system

0:24

or as is often the case an analogue

0:27

filter designed in the s domain into a

0:29

digital filter however as you will

0:32

hopefully see throughout this video the

0:34

bilinear transform has a few properties

0:36

that make it one of the most widely used

0:37

continuous to discrete transformations

0:40

let's begin with something as simple as

0:43

the name because sometimes even a name

0:45

isn't that simple what should we call

0:48

this transformation i mean i'm clearly

0:50

calling it the bilinear transform but

0:52

you'll also hear it called tustin's

0:54

method named for arnold tustin a british

0:56

engineer and professor whose work

0:58

generated a lot of interest in this

0:59

approach for example if you use MATLAB

1:02

they call it Tustin in their c2d

1:04

function and add that it's the bilinear

1:07

approximation in the description

1:09

lastly it can be called the trapezoidal

1:12

integration method for obvious reasons

1:14

we'll get to a bit later however this

1:17

name isn't as popular as the other two

1:19

so you may not ever hear it with that

1:21

being said I'm not really sure which

1:22

groups of people use which name so to be

1:25

safe just understand that it could be

1:27

called any of these three depending on

1:29

the textbook or the field that you're

1:30

working in in this video I'll switch

1:32

between bilinear transform and tustin's

1:34

method okay with the names out of the

1:37

way let's take a look at the actual

1:38

equations at the moment I'm just going

1:41

to write them out with no proof for now

1:43

just assume that they're correct and

1:44

they work just fine we'll go through the

1:46

derivations later on in this video the

1:49

capital T is the sample time or interval

1:52

period of the discrete system that

1:53

you're going to or from now even though

1:56

I told you just to take it on faith that

1:58

I wrote these equations out correctly

1:59

it's pretty easy to show that at the

2:01

very least these two equations are in

2:03

fact inverses of each other by solving

2:06

for Z in the first equation therefore if

2:08

nothing else we do know that one in fact

2:10

undoes the other if you want to verify

2:13

this now is a good time to pause the

2:15

video and go through the math yourself

2:17

alright are you back let's see these

2:20

equations in action let's say we have a

2:22

point in the S plane at location minus 1

2:25

plus 1 J what is the corresponding Z

2:29

plane location assuming our discrete

2:31

system has a sample time of two seconds

2:33

well it's simple to figure out let me

2:36

copy down the inverse bilinear transform

2:38

equation first now in this equation we

2:41

just set s to minus 1 plus J and capital

2:45

T to 2 and then solve for Z and doing so

2:48

we get Z equals minus 0.2 plus 0.4 J so

2:53

the point minus 1 plus J in the S plane

2:56

maps to the point minus point 2 plus

2:58

point 4 J in the Z plane given a sample

3:01

time of 2 seconds but rather than

3:04

mapping each point over individually one

3:06

at a time we can map entire systems over

3:09

in the same way if you have a continuous

3:12

system in the S domain say G of s equals

3:15

2 over s plus 1 then the bilinear

3:17

transform will convert the entire thing

3:19

to the Z domain simply by replacing

3:22

every

3:23

with the bi-linear transform equation

3:24

let's say our sample time is capital T

3:27

equals 0.1 seconds for this example the

3:31

resulting Z domain transfer function is

3:33

2z plus 2 divided by 20 1 z minus 19 or

3:38

if you prefer to have the denominator

3:40

with a leading coefficient of 1 you can

3:42

write it as 2 over 21 times z plus 2

3:44

over 21 divided by z minus 19 over 21 i

3:48

added it this way because this is the

3:50

form that MATLAB will return using the c

3:52

2d function and that way we can compare

3:54

them easier now at this point this is

3:56

the Z domain representation of 2 over s

3:59

plus 1 and we could just implement this

4:01

transfer function in a digital computer

4:02

running with a sample time of 0.1

4:05

seconds but just for completeness the

4:08

inverse bilinear transform will take you

4:10

from this Z domain transfer function

4:12

back to the s domain transfer function

4:14

in the same fashion and thus the circle

4:17

of bilinear transformation is complete I

4:20

went through this math very fast so

4:22

again please pause the video here if you

4:24

want to try it on your own the important

4:26

thing to take away from this is that

4:28

plugging in the bilinear transform for s

4:30

gets us to the Z domain and plugging in

4:33

the inverse equation for Z gets us right

4:35

back to where we started in the S domain

4:37

now that's pretty cool if you're into

4:39

random mapping trivia but what we just

4:42

did is more than just a random mapping

4:44

into the Z plane using this transform we

4:46

actually accomplished something

4:47

worthwhile

4:49

to see what we accomplished let's go

4:51

over to MATLAB and verify and plot the

4:53

results the first thing I always do is

4:56

to define the Laplace variable s that

4:59

way we can create our transfer function

5:00

in what I think is a more

5:02

straightforward manner now that we have

5:05

G of s we can convert it into G of Z

5:07

using the c2d function and the Tustin

5:10

method of course it helps if I use the

5:12

correct sample time the one that we used

5:15

in our example so let me just change

5:17

that to 0.1 seconds and recalculate G of

5:19

Z now in the hand calculations I left

5:22

the coefficients as fractions rather

5:23

than decimal but this does match what we

5:26

calculated by hand so that's good now

5:29

that we have G of s and G of Z we can

5:32

see how the frequency response compares

5:34

between the two systems with the bode

5:36

function and it's pretty close both the

5:40

phase and magnitude plots align really

5:42

well up to about 10 radians per second

5:44

we can also see how the time response

5:46

compares between the two by plotting the

5:48

step responses again really well the two

5:52

responses live right on top of each

5:54

other okay so we know that the bilinear

5:57

transform works it does in fact create a

6:00

discrete system that behaves similar to

6:02

the continuous system in both the

6:04

frequency and time domain but rather

6:06

than just understanding how to do the

6:08

calculations we want to get to a point

6:10

that makes sense intuitively what

6:13

exactly is this equation doing and why

6:15

does it work at all to understand that

6:17

we need to derive the equations

6:19

ourselves and where should we start with

6:22

the derivation well at the beginning of

6:25

course and in this case that is with the

6:27

definition of Z itself Z equals e to the

6:30

St that's what it is

6:33

if you recall for the Mast method we use

6:35

this equality to move each pole in zero

6:37

location over to the Z domain and then

6:39

built the transfer function from there

6:41

so why don't we just do that again

6:43

unfortunately we can't do that for the

6:45

entire system easily because if we just

6:47

replace Z with e to the S T it'll result

6:50

in a nonlinear function we were only

6:52

able to do it for single points so what

6:54

do we do we linearize e to the st first

6:57

and we do that with the Taylor series

6:59

expansion of e to the X which is the

7:02

summation from N equals 0 to infinity of

7:05

X to the N divided by n factorial so for

7:09

Z equals e to the St the expanded series

7:12

becomes 1 plus St over 1 plus St squared

7:16

over 2 plus St cubed over 6 and so on

7:20

for infinity now at this point we throw

7:22

away the higher-order terms and what

7:24

we're left with is the first order

7:26

approximation for Z or Z is

7:29

approximately equal to 1 plus St and

7:32

this is an OK linear first order

7:35

approximation of e to the st however we

7:38

can do better we can have a polynomial

7:40

fraction in the form a plus B s divided

7:42

by C plus D s and have it still be a

7:45

linear first order approximation

7:47

and this fractional expansion will be a

7:49

little closer to e to the st than this

7:51

one which is just a single polynomial

7:53

how do we do that

7:55

it's simple but not necessarily

7:57

something that is intuitive

7:59

we take e to the St and split it into

8:02

two Exponential's e to the S T divided

8:05

by two times e to the S T divided by two

8:08

recall that when you multiply powers

8:10

like this the exponents sum or in this

8:12

case resulting back to our original e to

8:14

the S T now we can make it a fraction by

8:17

moving one of those to the denominator

8:18

and flipping the exponent sign from here

8:22

we expand this fraction like we did

8:24

before by replacing both the top and

8:25

bottom with their respective Taylor

8:27

series again if we keep only up to the

8:30

first order terms we're left with 1 plus

8:32

St divided by 2 over 1 minus s T divided

8:36

by 2 and this is a more accurate first

8:38

order approximation of e to the st which

8:41

if you recall is the equation for the

8:44

inverse by linear transform so one way

8:47

to interpret the bilinear transform

8:49

equations is that they are the linear

8:50

first order approximation of e to the st

8:53

and all we're doing is replacing Z with

8:56

this approximation and that's all well

8:59

and good but for me I prefer a different

9:02

way to interpret what the bilinear

9:03

transform is doing and for that method

9:05

we're going to be using trapezoidal

9:07

integration let's start with a quick

9:10

refresher on trapezoidal integration

9:11

we're given a function f of X and we

9:14

want to find the following integral

9:15

basically we have some function this red

9:18

line and we want to calculate the blue

9:19

area under the curve between points x0

9:22

and x1 instead of solving the integral

9:25

directly we can approximate the area

9:27

with a trapezoid by drawing a straight

9:29

line between f of X 0 and f of X 1 this

9:34

works out that the original integral is

9:35

approximately equal to x1 minus x0 or

9:38

the width of the trapezoid times its

9:41

average height now if we add a second

9:44

point x2 and extend our red line

9:47

function out we can draw a second

9:49

trapezoid between X 1 and X 2 and the

9:52

approximated area for this next section

9:54

is drawn out in yellow but what is the

9:57

value of y between x0 and x2

10:00

remember why is the total area under the

10:03

curve so it's the old green area plus

10:06

the new yellow area the yellow area

10:09

again is the trapezoid width times its

10:11

average height and since y equals the

10:14

area into the curve the old green area

10:16

is actually the value of Y back at point

10:20

x1 and now we can generalize this to any

10:23

point X sub K with this equation its Y

10:27

sub K equals the width of each trapezoid

10:30

or Delta X times the average height or X

10:33

sub K minus 1 plus X sub K all divided

10:36

by 2 plus the old area Y sub K minus 1

10:42

all right with that out of the way let's

10:45

apply this integration to a system let's

10:48

say that our system is G of S which is

10:50

the transfer function with output Y of s

10:52

and input X of s and the whole thing is

10:55

equal to 1 over s we can rearrange the

10:58

equation to get s times y of s equals X

11:02

of s and then if we take the inverse

11:04

Laplace transform to get it back to the

11:05

time domain we're left with the

11:07

differential equation y dot of t equals

11:11

X of T now we can integrate both sides

11:14

to get Y of T equals the integral of X

11:17

of T DT and this is starting to look

11:20

really familiar you guessed it we're

11:22

going to use trapezoidal integration now

11:25

the first step is to change the variable

11:26

t to break it up into sample periods

11:28

capital T we haven't discretized in this

11:31

step it's still continuous because at

11:33

this point K doesn't have to be an

11:35

integer now we separate this one

11:37

integral into two integrals the first

11:40

one sums over the last sample period

11:43

capital T and the second one sums over

11:46

all of the sample periods not including

11:48

the last one you can see that the first

11:51

integral is the new area and the second

11:54

one is the old area just like we had in

11:56

trapezoidal integration all right at

11:58

this point we swap out the continuous

12:00

integrals with the trapezoidal

12:02

approximation x' so that the value of y

12:05

at KT is approximately equal to the area

12:08

of the new trapezoid plus the old area

12:11

this green equation is a bit hard to

12:13

understand so I'll write it in shorthand

12:15

notation Y sub K is approximately equal

12:19

to Y sub K minus 1 plus capital T over 2

12:23

times X sub K plus X sub K minus 1 at

12:27

this point it's worth noting that there

12:29

is no difference between the equation

12:31

for trapezoidal integration and this

12:33

equation that we just wrote the transfer

12:35

function 1 over s is just the transfer

12:37

function of an integral so it makes

12:39

sense that we got exactly an integration

12:41

equation ok from here we can rearrange

12:44

it into this difference equation and if

12:47

you haven't already made the mental leap

12:48

to where this is going then I think this

12:50

is gonna blow your mind it did for me

12:52

anyway

12:53

we take the z-transform of this

12:55

difference equation to get y of Z times

12:58

1 minus Z inverse equals T over 2 times

13:02

X of Z times 1 plus Z inverse and from

13:06

here we can rearrange to get the

13:07

transfer function y of Z over X of Z and

13:10

multiplied by Z over Z to put it in a

13:12

more pleasing form and we get T divided

13:15

by 2 times Z plus 1 divided by Z minus 1

13:19

recall our starting s domain transfer

13:22

function was 1 over s and so this is

13:25

equivalent to our Z domain transfer

13:27

function that we just solved for now all

13:29

we have to do is solve for s and we're

13:31

left with s is approximately equal to 2

13:34

divided by T times Z minus 1 divided by

13:37

Z plus 1 and I probably don't have to

13:40

tell you this but this is the bilinear

13:42

transform so the other way to think of

13:45

the bilinear transform equations is that

13:47

they are an approximation of

13:49

differential equations using trapezoidal

13:51

integration rather than continuous

13:54

integration I think that just makes a

13:56

ton of sense and is really cool alright

13:59

there's more we need to cover on this

14:00

but this video is getting really long so

14:02

let's take a break and we'll come back

14:04

with the second half of bilinear

14:05

transform in the next video and that one

14:08

will cover how it warps the S plane into

14:10

the Z plane how we can pre-warp an

14:12

analogue filter and I'll answer any

14:15

questions you might have on the topic

14:16

that pop up between now and the time I

14:18

put that video out so I'll see you next

14:20

video and thanks for watching and a huge

14:24

thank you to my patreon supporters for

14:26

making this video possible if you'd like

14:28

to support me and my efforts on youtube

14:30

you can from the patreon link in the

14:31

description below for any amount of

14:33

support you can download a digital copy

14:35

of my book in progress on control theory

14:37

now I'm still actively writing the book

14:40

so it's not complete but if you'd like a

14:41

copy of what I have so far but are

14:43

unable to support through patreon for

14:45

any reason at all just email me at

14:47

control system lectures at gmail.com and

14:50

I'll send you a copy for free

14:52

that way we can spread the knowledge and

14:54

help everyone on their quest to becoming

14:56

better control system engineers thanks

14:58

everyone

Interactive Summary

This video introduces the bilinear transform (also known as Tustin's method or trapezoidal integration), a powerful technique for mapping systems from the continuous s-domain to the discrete z-domain and vice-versa. The video explains the mathematical definitions of the transform, provides practical examples for mapping points and transfer functions, and verifies results using MATLAB. Furthermore, it offers two intuitive interpretations of the transformation: as a first-order Taylor series approximation of the exponential function e^(ST), and as a representation of differential equations using trapezoidal integration.

Suggested questions

3 ready-made prompts