linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf ·...

31
EE263 Autumn 2015 S. Boyd and S. Lall Linear dynamical systems with inputs & outputs I inputs & outputs: interpretations I impulse and step responses I examples 1

Upload: others

Post on 04-Jun-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

EE263 Autumn 2015 S. Boyd and S. Lall

Linear dynamical systems with inputs & outputs

I inputs & outputs: interpretations

I impulse and step responses

I examples

1

Page 2: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Inputs & outputs

recall continuous-time time-invariant LDS has form

x = Ax+Bu, y = Cx+Du

I Ax is called the drift term (of x)

I Bu is called the input term (of x)

picture, with B ∈ R2×1:

x(t)Ax(t)

x(t) (with u(t) = 1)

x(t) (with u(t) = −1.5)B

2

Page 3: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Interpretations

write x = Ax+ b1u1 + · · ·+ bmum, where B =[b1 · · · bm

]I state derivative is sum of autonomous term (Ax) and one term per input

(biui)

I each input ui gives another degree of freedom for x (assuming columns of Bindependent)

write x = Ax+Bu as xi = aTi x+ bTi u, where aTi , bTi are the rows of A, B

I ith state derivative is linear function of state x and input u

3

Page 4: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Response to input

I the solution to x = Ax+Bu is

x(t) = etAx(0) +

∫ t

0

e(t−τ)ABu(τ) dτ

I etAx(0) is the unforced or autonomous response

I etAB is called the input-to-state impulse response or impulse matrix

4

Page 5: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Impulse response

impulse response h(t) = CetAB +Dδ(t)

with x(0) = 0, y = h ∗ u, i.e.,

yi(t) =

m∑j=1

∫ t

0

hij(t− τ)uj(τ) dτ

interpretations:

I hij(t) is impulse response from jth input to ith output

I hij(t) gives yi(t) when u(t) = ejδ(t)

I hij(τ) shows how dependent output i is, on what input j was, τ seconds ago

I i indexes output; j indexes input; τ indexes time lag

5

Page 6: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Step response

the step response or step matrix is given by

s(t) =

∫ t

0

h(τ) dτ

interpretations:

I sij(t) is step response from jth input to ith output

I sij(t) gives yi when u = ej for t ≥ 0

for invertible A, we have

s(t) = CA−1(etA − I

)B +D

6

Page 7: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example 1

u1 u2u1 u2

I unit masses, springs, dampers

I u1 is tension between 1st & 2nd masses

I u2 is tension between 2nd & 3rd masses

I y ∈ R3 is displacement of masses 1,2,3

I x =

[yy

]

7

Page 8: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example 1

system is:

x =

0 0 0 1 0 00 0 0 0 1 00 0 0 0 0 1−2 1 0 −2 1 01 −2 1 1 −2 10 1 −2 0 1 −2

x+

0 00 00 01 0−1 10 −1

[u1

u2

]

eigenvalues of A are

−1.71± i0.71, −1.00± i1.00, −0.29± i0.71

8

Page 9: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example 1: Impulse response

0 5 10 15

−0.2

−0.1

0

0.1

0.2

0 5 10 15

−0.2

−0.1

0

0.1

0.2

t

t

h11

h21

h31

h12

h22

h32

impulse response from u1

impulse response from u2

roughly speaking:

I impulse at u1 affects third mass less than other two

I impulse at u2 affects first mass later than other two

9

Page 10: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example 2: Circuit

u

C3 C4

C1 C2

I u(t) ∈ R is input (drive) voltage

I xi is voltage across Ci

I output is state: y = x

I unit resistors, unit capacitors

I step response matrix shows delay to each node

10

Page 11: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example 2: Circuit

system is

x =

−3 1 1 01 −1 0 01 0 −2 10 0 1 −1

x+

1000

u, y = x

eigenvalues of A are

−0.17, −0.66, −2.21, −3.96

11

Page 12: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example 2: Circuit

step response matrix s(t) ∈ R4×1:

0 5 10 150

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

s1

s2

s3s4

I shortest delay to x1; longest delay to x4

I delays consistent with slowest (i.e., dominant) eigenvalue −0.17

12

Page 13: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

DC or static gain matrix

I DC gain describes system under static conditions, i.e., x, u, y constant:

0 = x = Ax+Bu, y = Cx+Du

eliminate x to get y = H0u where

H0 = −CA−1B +D

I if system is stable,

H0 =

∫ ∞0

h(t) dt = limt→∞

s(t)

if u(t)→ u∞ ∈ Rm, then y(t)→ y∞ ∈ Rp where y∞ = H0u∞

13

Page 14: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

DC gain matrix

DC gain matrix for example 1 (springs):

H(0) =

1/4 1/4−1/2 1/2−1/4 −1/4

DC gain matrix for example 2 (RC circuit):

H(0) =

1111

(do these make sense?)

14

Page 15: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Discretization with piecewise constant inputs

linear system x = Ax+Bu, y = Cx+Du

suppose ud : Z+ → Rm is a sequence, and

u(t) = ud(k) for kh ≤ t < (k + 1)h, k = 0, 1, . . .

define sequences

xd(k) = x(kh), yd(k) = y(kh), k = 0, 1, . . .

I h > 0 is called the sample interval (for x and y) or update interval (for u)

I u is piecewise constant (called zero-order-hold)

I xd, yd are sampled versions of x, y

15

Page 16: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Discretization with piecewise constant inputs

xd(k + 1) = x((k + 1)h)

= ehAx(kh) +

∫ h

0

eτABu((k + 1)h− τ) dτ

= ehAxd(k) +

(∫ h

0

eτA dτ

)B ud(k)

xd, ud, and yd satisfy discrete-time LDS equations

xd(k + 1) = Adxd(k) +Bdud(k), yd(k) = Cdxd(k) +Ddud(k)

where

Ad = ehA, Bd =

(∫ h

0

eτA dτ

)B, Cd = C, Dd = D

called discretized system. If A is invertible, we can express integral as∫ h

0

eτA dτ = A−1(ehA − I

)16

Page 17: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example: Force on mass

Newton’s law gives continuous-time LDS

x(t) =

[0 10 0

]x(t) +

[01

]u(t)

y(t) =[1 0

]x(t)

let’s compute the discretization

Ad = eAh

= I +Ah+1

2A2h2 + · · ·

= I +Ah

=

[1 h0 1

]17

Page 18: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example: Force on mass

Bd =

∫ h

0

eAsB ds

=

∫ h

0

[1 s0 1

] [01

]ds

=

∫ h

0

[s1

]ds =

[12h2

h

]

so the discretization is

xd(k + 1) =

[1 h0 1

]xd(k) +

[12h2

h

]ud(k)

yd(k) =[1 0

]xd(k)

18

Page 19: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Stability of discretization

stability: if eigenvalues ofA are λ1, . . . , λn, then eigenvalues ofAd are ehλ1 , . . . , ehλn

discretization preserves stability properties since

<λi < 0 ⇔ |ehλi | < 1

for h > 0

19

Page 20: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Extensions and variations

I offsets: updates for u and sampling of x, y are offset in time

I multirate: ui updated, yi sampled at different intervals

(usually integer multiples of a common interval h)

both very common in practice

20

Page 21: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Causality

interpretation of

x(t) = etAx(0) +

∫ t

0

e(t−τ)ABu(τ) dτ

y(t) = CetAx(0) +

∫ t

0

Ce(t−τ)ABu(τ) dτ +Du(t)

for t ≥ 0:

current state (x(t)) and output (y(t)) depend on past input (u(τ) for τ ≤ t)

i.e., mapping from input to state and output is causal (with fixed initial state)

21

Page 22: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Idea of state

x(t) is called state of system at time t since:

I future output depends only on current state and future input

I future output depends on past input only through current state

I state summarizes effect of past inputs on future output

I state is bridge between past inputs and future outputs

22

Page 23: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Change of coordinates

start with LDS x = Ax+Bu, y = Cx+Du

change coordinates in Rn to x, with x = T x

then˙x = T−1x = T−1(Ax+Bu) = T−1ATx+ T−1Bu

hence LDS can be expressed as

˙x = Ax+ Bu, y = Cx+ Du

whereA = T−1AT, B = T−1B, C = CT, D = D

TF is same (since u, y aren’t affected):

C(sI − A)−1B + D = C(sI −A)−1B +D

23

Page 24: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Standard forms for LDS

can change coordinates to put A in various forms (diagonal, real modal, Jordan. . . )

e.g., to put LDS in diagonal form, find T s.t.

T−1AT = diag(λ1, . . . , λn)

write

T−1B =

bT1

...

bTn

, CT =[c1 · · · cn

]

24

Page 25: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Discrete-time systems

discrete-time LDS:

x(t+ 1) = Ax(t) +Bu(t), y(t) = Cx(t) +Du(t)

we have:x(1) = Ax(0) +Bu(0),

x(2) = Ax(1) +Bu(1)

= A2x(0) +ABu(0) +Bu(1),

and in general, for t ∈ Z+,

x(t) = Atx(0) +

t−1∑τ=0

A(t−1−τ)Bu(τ)

25

Page 26: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Discrete-time systems

Solution is

x(t) = Atx(0) +

t−1∑τ=0

A(t−1−τ)Bu(τ)

write this asy(t) = CAtx(0) +H ∗ u

where ∗ is discrete-time convolution

y(t) = CAtx(0) +t∑

τ=0

H(t− τ)u(τ)

and

H(t) =

{D, t = 0CAt−1B, t > 0

is the impulse response

26

Page 27: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Block Toeplitz matrices

we have

y(0)y(1)y(2)

...y(t)

=

DCB DCAB CB D

.... . .

CAt−1B CAt−2B . . . CB D

u(0)u(1)u(2)

...u(t)

+

CCACA2

...CAt

x(0)

I this matrix gives the output sequence y(0), y(1), . . . in terms of the inputsequence u(0), u(1), . . . and the initial state x(0)

I block Toeplitz means blocks are constant along diagonals from top-left tobottom right

I we can use this to find controllers and estimators

27

Page 28: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example: Point mass

unit point mass, with actuators applying force in directions

v1 =

[10

]v2 =

[−0.51

]v3 =

[11

]has dynamics

x(k + 1) =

1 h 0 00 1 0 00 0 1 h0 0 0 1

x(k) +

12h2 0h 00 1

2h2

0 h

[ v1 v2 v2] u1(k)

u2(k)u3(k)

y(k) =

[1 0 0 00 0 1 0

]x(k)

here

I x1, x2 = position, velocity in x-directionx3, x4 = position, velocity in y-direction

I h = sample time; we’ll use h = 1.

I ui(k) force applied by actuator i at time k28

Page 29: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example: Point mass

we would like to drive it through the positions

y(20) =

[53

]y(40) =

[10−1

]y(70) =

[41

]at the above times

we have

y(t) =

t−1∑τ=0

CAt−1−τBu(τ) +Du(t)

this gives the rows of y(20)y(40)y(70)

= Aact

u(0)...

u(70)

here Aact is 6× 213.

29

Page 30: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example: Point mass

let’s find the minimum norm sequence of forces that meets the specifications

u(0)...

u(70)

= A†act

5310−141

trajectory is

0 2 4 6 8 10−2

−1

0

1

2

3

4

30

Page 31: Linear dynamical systems with inputs & outputsee263.stanford.edu/lectures/linsys.pdf · Interpretations write x_ = Ax+ b 1u 1 + + b mu m, where B= b 1 b m I state derivative is sum

Example: Point mass

sequence of force inputs is

0 10 20 30 40 50 60 70 80−0.03

−0.02

−0.01

0

0.01

0.02

0.03

31