You are on page 1of 277

# Signal- und Systemtheorie II D-ITET, Semester 4 Notes 0: Introduction

John Lygeros
Automatic Control Laboratory, ETH Zrich
www.control.ethz.ch

## Where and when

Lectures
Thursdays, 8:00-10:00, ETF C1

Examples classes:
Mondays, 13:00-15:00, ETF C1 and ETF E1

Assessment
Examples papers (7/9 required) WriPen examination Exercises in lecture notes are not assessed Please try to do them nonetheless and discuss with instructor and assistants if you have questions

0.2

Lecture notes
Slides handout Blackboard notes

Recommended book

## Other excellent books

K.J. strm and R.M. Murray: Feedback Systems: An Introduction for Scientists and Engineers, Princeton U.P., 2008 hPp://www.cds.caltech.edu/~murray/amwiki/index.php/Main_Page G.F. Franklin, J.D. Powell, and A. Emami-Naeini, Feedback control of dynamical systems, Prentice-Hall, 2006 (also used in Regesysteme I/II) J. Hespanha, Linear Systems Theory, Princeton U.P., 2009 T. Kailath, Linear systems, Prentice-Hall, 1980 E.A. Lee and P. Varaiya, Structure and interpretation of signals and systems, Addison-Wesley, 2002

0.3

Dynamical systems
Describe evolution of variables over time
Input variables Output variables State variables
SS1 SS2

Control:
Steer systems using inputs RS1 Feedback

0.4

## From signals to systems

Input

System

Output

SS1: System maps input signals to output signals SS2: Where does input-output map come from? RS1: What happens when we connect system inputs and outputs?
0.5

Input

u(t)

x(t)

+
A

+ + y(t)

Output

System 1 System 2

Dynamical systems
Describe evolution of variables over time
Input variables Output variables State variables

What is a state? What values can it take? What is time? What values can it take? What is evolution? How can evolution be described?
0.6

Discrete vs continuous
Discrete Finite (or countable) values
{0, 1, 2, 3, } {a, b, c, d} {ON, OFF}, {hot, warm, cool, cold},

## Continuous Real values

!R, x !R n x !["1,1] # x !R,!1 " x ! 1 x 2 2 {(x1 , x2 ) !R 2 | x1 + x2 ! 1}

## Hybrid Part discrete and part continuous

Airplane + ight management system Thermostat + room temperature 0.7

## System classication (examples)

Time State

Discrete
Finite state machines, Turing machines z-transform

Hybrid

Discrete

## Continuous xk +1 = Axk + Buk

yk = Cxk + Duk
Mixed Logic- Dynamical systems

## Impulse dierential inclusions Hybrid automata 0.8

Hybrid

Switching diusions

In this course
We will concentrate mostly on
Continuous state Continuous time Linear systems Continuous state Discrete time Linear systems

and to

## Course outline: Introductory material

1. Modeling
Mechanical and electrical systems Discrete and continuous time systems Discrete and continuous state systems Linear and nonlinear (continuous state) systems ODE = Ordinary Dierential equations Existence and uniqueness of solutions Range and null spaces of matrices Eigenvalues, eigenvectors,

0.10

## Course outline: Continuous time LTI

3. Time domain
LTI = Linear Time Invariant State space equations Time domain solution of state space equations

## 4. Controllability, observability, energy 5. Frequency domain

Revision of Laplace transforms Laplace solution of state space equations Stability Bode and Nyquist plots 0.11

## Course outline: Discrete time LTI and advanced topics

6. Discrete time LTI systems
Sampled data systems Linear dierence equations Controllability and observability z-transform Simulation, Euler method and its stability Dierences from linear systems Multiple equilibria, limit cycles, chaos Linearization Stability Examples 0.12

7. Nonlinear systems

Notation
Z denotes the integers. This is a discrete set Z = {!,!2,!1,0,1,2,!} N N denotes the natural numbers = {0,1,2,!} C denotes the complex numbers

s = s1 + js2 !C

Im[s] = s2 Re[ s] = s1

## 2 | s |= s12 + s2 1 s2 s = tan s1 s =| s | e j!s

Im[ s ] s2 |s|
s

Belongs to

e = cos( ) + j sin( )
j

s1 Re[ s ]
0.13

Notation
Rn denotes Euclidean space of n dimensions. It is a
nite dimensional vector space (sometimes called linear space). Special cases: x !R n=1, real line, (drop the superscript) n=2, real plane,

## x1 \$ & x2 & 'R n & ! & xn & %

0.14

Notation
R n!m matrices with n rows and m columns, whose
elements are real

Also a vector space, can dene length, Special cases n = R n!1 ,R = R1!1 R Assume familiar with basic matrix operations (addition, multiplication, eigenvalues)

! # # A=# # # "

## a11 a21 ! an1

a12 ! a1m \$ & a22 ! a2m & = ! aij \$ (R n'm & " % n'm ! " ! & an2 ! anm & %

0.15

Notation
2 Denition of sets !R 2 | x12 + x2 ! 1} {x Special case: Intervals for !R,a < b a,b

x2
-1

1 1 -1

x1

## [a,b] = {x !R | a ! x ! b} [a,b) = {x !R | a ! x < b} (a,!) = {x !R | a < x}

R + = [0,!) means for all means there exists

## x !R 2 x1 ! x2 and y !R !x !R, y=x 2

} look like?
0.16

Notation
Continuous time Discrete time Continuous state Continuous input Continuous output Discrete state e.g. thermostat
t !R +

k !N
x !R n u !R m y !R p

q !Q q !Q = {ON ,OFF}

## Lower case lePers: Vectors/numbers x, u, t, k Upper case lePers: Matrices, A, B, C,

0.17

Notation
x !X f (i) : X ! Y f function returning for an (x) !Y
x ! f (x)

## Example: Discrete time input signal

u(i) : N ! R m k ! u(k) = uk
Input at time k Shorthand notation Discrete time

## Example: Continuous time state signal

x(i) : R + ! R n t ! x(t)
State at time t 0.18

Continuous time

## Linear functions: Euclidean space

f Special case: Linear function (i) : R n ! R m n x For any 1 , x2 !R , a1 ,a2 !R f (a1 x1 + a2 x2 ) = a1 f (x1 ) + a2 f (x2 )
f (x) = Ax f (a1 x1 + a2 x2 ) = A(a1 x1 + a2 x2 ) = a1 Ax1 + a2 Ax2 = a1 f (x1 ) + a2 f (x2 )
All linear functions on nite dimensional vector spaces can be wriPen in this way

## A Multiplication by a matrix !R m"n ,

Exercise: Show that if f (i) : R n ! R m , g(i) : R m ! R p are linear functions, then their composition g( f ()) : R n ! R p is also linear. If f and g are defined in terms of matrices A !R m"n , B !R p"m what does this composition correspond to? 0.19

## Linear functions: Function spaces

Linear functions dened more generally for vector (linear) spaces u For example, for 1 (i),u2 (i) : R ! R, a1 ,a2 !R dene by (a1u1 + a2u2 )(i) : R ! R (a1u1 + a2u2 )(t) = a1u1 (t) + a2u2 (t) !t !R Likewise, for 1 (i),U 2 (i) : C ! C, a1 ,a2 !C U dene by (a1U1 + a2U 2 )(i) : C ! C (a U + a U )(s) = a U (s) + a U (s) !s !C 1 1 2 2 1 1 2 2
0.20

## Laplace transform and convolution

u(i) Given : R ! R U Laplace transform (i) : C ! C U (s) =
!"

u(t)e ! st dt #
"

"

## Convolution of u with xed function : R ! R h(i)

(u ! h)(i) : R ! R
(u * h)(t) =
!"

# u(! )h(t ! ! ) d !

cf. SSI
Exercise: Show that the Laplace transform and the convolution are linear functions of u(.) 0.21

## Important dierence from SSI

In SSII interested in system response for t positive times !R + Implicitly assume all signals = 0 for < 0 t Hence Laplace transform simplies to
U (s) =

## t<0 (since u(t)=0 for ) And convolution simplies to

!" 0 (since ) u(! ) = 0 for ! < 0 and h(t ! ! ) = 0 for ! > t
0.22

!"

u(t)e ! st dt = # u(t)e ! st dt #
0

"

"

(u * h)(t) =

"

## Signal- und Systemtheorie II D-ITET, Semester 4 Notes 1: Modeling

John Lygeros
Automatic Control Laboratory, ETH Zrich
www.control.ethz.ch

Series of examples
1. Pendulum: Continuous time, continuous state, nonlinear autonomous system 2. RLC circuit: Continuous time, continuous state linear system with inputs 3. Amplier circuit: Continuous time, continuous state linear system with inputs and outputs 4. Population dynamics: Discrete time, continuous state nonlinear system 5. Manufacturing machine: Discrete time, discrete state system 6. Thermostat: Continuous time, hybrid state system 1.2

Example 1: Pendulum
A continuous time, continuous state, autonomous, nonlinear system Mass m hanging from weightless string of length l l String makes angle q with downward vertical m Friction with dissipation constant d mg Determine how the pendulum is going to move i.e. assuming we know where the pendulum is at ! time t=0 (0) and how fast it is moving ( ) !0 determine where it will be at time t ((t)) 1.3

## Pendulum: Equations of motion

Evolution of q governed by Newtons law

## !! ! ml! (t) = !dl! (t) ! mg sin ! (t) Exercise: Derive the

Angular acceleration Friction force Gravity force

## dierential equation from Newtons laws of motion

Need to solve Newtons dierential equation i.e. nd a function () : R + ! R ! such that ! (0) = ! 0
Time Angle

1.4

## Pendulum: Existence and uniqueness

Such a function is known as a solution or a trajectory of the system ! !0 , !0 1.Does a trajectory exist for all ? ! !0 , !0 2.Is there a unique trajectory for each ? 3.Can we nd this trajectory? Clearly important questions for dierential equations used to model physical systems In general answer to questions may be no In fact, answer to question 3 usually is no! However, we can usually approximate the trajectory by computer simulation 1.5

## Pendulum: MATLAB simulation

! l = 1, m = 1, d = 1, g = 9.8, ! 0 = 0.75, ! 0 = 0
! ! (t)
function [xprime] = pendulum(t,x) xprime=[0; 0]; l = 1; m=1; d=1; g=9.8; xprime(1) = x(2); xprime(2) = -sin(x(1))*g/l-x(2)*d/m;

! (t)

>> x=[0.75 0]; >> [T,X]=ode45(pendulum, [0 10], x); >> plot(T,X); >> grid;

1.6

## Pendulum: State space description

Convenient to write ODE more compactly

## ! x(t) = f (x(t)), x(t) !R n

For the pendulum, let ! x (t) \$ & 'R 2 with x(t) = # 1 # x2 (t) & " % ! x1 (t) = ! (t), x2 (t) = ! (t) Then Exercise: A dierent f(x(t)) would be obtained if x1(t) and x2(t) are selected dierently. Derive f(x(t)) for ! ! x 1 (t) = ! 3 (t) + ! (t), x2 (t) = ! (t)

1.7

## Pendulum: State space description

x(t) !R This rst order ODE for describes exactly ! the same dynamics as second order ODE for (t) !R x(t) !R 2 Vector called the state of the system Function called the vector eld f () : R 2 ! R 2 For the pendulum f is a nonlinear function of x Solving Newtons equation is equivalent to nding a function : R + ! R 2 x() Angle & angular
2

such that

Time

velocity

! !t !R + , x(t) = f (x(t))
1.8

## Pendulum: Vector eld & phase plane

Vector field f(x)
x2

x2 (t)

t =0

t
x1

x1 (t)
1.9

## Example 2: RLC circuit

Continuous time, continuous state, linear system Input voltage v1(t) (not autonomous) Determine evolution of voltages and currents
+ +

vR (t)

v L (t)

iL (t)
+

L C

v1 (t)
-

vC (t)
-

1.10

## RLC circuit: Equations of motion

From Kirchos laws + element equations E.g.
d 2 vc (t) dt 2 R dvc (t) 1 1 + + vc (t) = v1 (t) L dt LC LC

dvC (t) C = iL (t) dt diL (t) L = v L (t) dt vR (t) = RiL (t) v L (t) = v1 (t) ! vR (t) ! vC (t)

Solution to ODE gives vC(t) All other voltages and currents can be computed from vC(t)
1.11

## RLC circuit: MATLAB simulation

R = 10 L =1 C = 0.01 x0 = 0
Low pass filter Exercise: Modify the MATLAB code for the pendulum to simulate the RLC circuit and generate such plots. 1.12

## RLC circuit: State space description

! x(t) Try to write rst order vector ODE = f (x(t)), x(t) !R Based on our experience with the pendulum Second order ODE for vC(t) suggests !R 2 x(t) x(t) has something to do with energy ! (! ) (! ) Potential and kinetic in the pendulum
! x (t) \$ 1 & 'R 2 , x1 (t) = vC (t), x2 (t) = iL (t) Try = # x(t) # x2 (t) & " %
(in circuits this usually works: Voltages across capacitors and
currents through inductors can be selected as the states) Stored in capacitor (vC) and inductor (iL) in circuit
n

## RLC circuit: State space description

Relate state (x(t)) and input (u(t))
dvC (t) 1 !1 (t) = x2 (t) C = iL (t) ! x dt C diL (t) 1 R 1 !2 (t) = u(t) ! x2 (t) ! x1 (t) L = v1 (t) ! vR (t) ! vC (t) " x dt L L L

In matrix form

" \$ 0 ! x(t)= \$ \$ !1 \$ # L

1 C !R L

% " 0 % ' ' x(t) + \$ 1 ' u(t) \$ ' ' \$ L ' ' # & &
1.14

## RLC circuit: State space description

Have wriben ODE of the form

## ! x(t)=Ax(t) + Bu(t) = f (x(t),u(t))

Similarities to pendulum

## Dierences from pendulum

2nd order ODE two states States related to energy stored in system External source of energy input u(t) system no longer autonomous Function f(x,u) linear in x and u dynamics described by linear ODE 1.15

## Example 3: Amplier circuit

Continuous time, continuous state linear system Input voltage v1(t) vC (t) Output voltage v0(t) iC0 (t) + 0

iR (t)
0

C0

i1
+

R1

vC (t)
+
1

+ -

iin

R0
+

C1

vin

iout

v1 (t)
-

v0 (t)
-

1.16

## Reminder: Operational amplier (OpAmp)

Input current Input voltage
+

iin

vin
-

Rin
+

Rout
+

+

vin

iout

vout
-

Gain (large)

1.17

Assume

Rout ! 0

Rin ! "

!"

## iout independent of vout vin ! 0 if vout finite

iin ! 0

Virtual earth assumption Makes circuit analysis much easier Note that Necessary energy comes from external voltage source (not shown!) 1.18
Input power iinvin=0 Output power ioutvout is arbitrary

## Amplier circuit: Equations of motion

Assuming OpAmp is ideal
C1 dvC (t)
1

dt

1

dvC (t)
1

0

dt

1

vC (t)

R1
dvC (t)
0

dt

= ic (t)
0 0 0

dt

## v1 (t) =! ! + R0C0 R1C0 R1C0

0 1

vC (t)

vC (t)

1 iR (t) = vC (t) 0 R0 0

0

1.19

## Amplier circuit: State space description

First order ODE in vector variables From our experience so far we would expect
Two state variables Voltages of capacitors, x1(t)=vC1(t), x2(t)=vC0(t) One input variable, u(t)=v1(t) One output variable, y(t)=v0(t)

## Write equations that relate input, states and output

! 1 0 # ! dx(t) # R1C1 =# dt 1 # ! 1 ! R0C0 # R1C0 " y(t) = " 0 !1 \$ x(t) # % \$ ! 1 & # & # R1C1 & x(t) + # 1 & # & # R1C0 % " \$ & & & u(t) & & %

1.20

## Amplier circuit: State space description

Have wriben in the form

## ! x(t)=Ax(t) + Bu(t) = f (x(t),u(t)) y(t) = Cx(t) + Du(t) = h(x(t),u(t))

f and h are linear functions of the state and inputs Exercise: What are the matrices A, B, C and D? What are their dimensions? Exercise: Modify the matlab code given for the pendulum to simulate the amplier circuit 1.21

## Amplier circuit: Simulation

Exercise: Why does the output settle to zero even though input is non-zero? 1.22

## Amplier circuit: Energy

Energy stored in the system

## 1 E(t) = x(t)T Qx(t) 2

Exercise: What is the matrix Q in this case? Exercise: Derive the energy equations for the pendulum and the RLC circuit. Can you nd a matrix Q in both cases? 1.23

## Amplier circuit: Power

Power: Instantaneous energy change

d 1 1 T ! ! P(t) = E(t) = x(t) Qx(t) + x(t)T Qx(t) dt 2 2 1 1 T T T T = x(t) A + u(t) B Qx(t) + x(t)T Q Ax(t) + Bu(t) 2 2 1 1 T T = x(t) A Q + QA x(t) + u(t)T BT Qx(t) + x(t)T QBu(t) 2 2

1.24

## Amplier circuit: Power (u(t)=0)

(" " %+ 1 1 % 1 ! 0 '" '*\$ ! % " C 0 %\$ ! RC R1C1 R1C0 ' C1 0 1 '1 1 T *\$ \$ '+\$ 1 '\$ P(t) = x(t) * \$ '\$ 0 C ' \$ 0 C '\$ '- x(t) 2 1 1 ' 1 ' 0 & 0 &\$ # # *\$ ! ! 0 ! R0C0 'R0C0 ' *\$ \$ R1C0 )# # &, & " 2 1 % ! Exercise: Derive this \$ ! ' R1 R1 ' 1 T \$ equation directly by = x(t) \$ ' x(t) 2 \$ !1 ! 2 ' dierentiating the energy R0 ' \$ R1 of the circuit # & 1 1 x1 (t) 2 x1 (t)x2 (t) x2 (t) 2 2 2 . P(t) = ! ! ! E(t) = C1vC (t) + C0 vC (t) 1 0 R1 R1 R0 2 2

## Exercise: Repeat for the RLC circuit and pendulum 1.25

Population dynamics
A discrete time, continuous state system Experiment:
Closed jar containing a number (N) of fruit ies Constant food supply

Question: How does y population evolve? Number of ies limited by available food, epidemics
Few ies abundance of space/food more ies Many ies competition for space/food fewer ies

x=

N N MAX

[0,1]
1.26

## Population dynamics: State space model

Track x from generation to generation: xk population at generation k How does population at generation k+1 depend on xk? Classic model: Logistic map

## xk +1 = rxk (1! xk ) = f (xk )

Exercise: Is the function f(x) linear or non-linear? Exercise: Show that if r ![0,4] and x0 ![0,1] then xk ![0,1] for all k=0, 1, 2, 1.27

## Population dynamics: Solution

r represents the food supply Large r means a lot of food is provided Small r means lible food is provided Shape of f(x) reects population trends Small population now small population next generation (not enough individuals to breed) Large population now small population next generation (food/living space shortage, epidemics, etc.) How does the population change in time? This depends a lot on r xk 1. If then decays to 0 (i.e. all ies die) r ![0,1) xk 2. If then tends to a steady state value (i.e. the r ![1,3) y population stabilizes) r ![3,1+ 6) 3. If then tends to a 2-periodic solution xk (i.e. the population alternates between two values) 4. Eventually chaotic behavior!

1.28

## Population dynamics: Solution

Exercise: By solving f(x)=x find all possible steady state values when r ![0,1) and when ![1,3). r

Single equilibrium

## Population dynamics: Simulation

1.30

Manufacturing system
A discrete time, discrete state system Model of a machine in a manufacturing shop Machine can be in three states
Idle (I) Working (W) Broken (D)

## Finite number of states and inputs:

Finite State machine or Finite Automaton

A part arrives and starts gebing processed (p) The processing is completed and the part moves on to the next machine (c) The machine fails (f) The machine is repaired (r)

1.31

## Manufacturing system: State space model

Possible states of the machine q !Q = {I,W , D} Possible inputs (events) ! !" = { p,c, f ,r} Not all events are possible for all states, e.g.
A part cannot start gebing processed (=p) while the machine is broken (q=D) The machine can only be repaired (=r) when broken (q=D)

## ! Transition function : Q ! " # Q Write as discrete time system

qk +1 = ! (qk ,! k )

Exercise: Is linear or nonlinear? Does the question even make sense? 1.32

## Manufacturing system: Automaton

! (I, p) = W ! (W ,c) = I ! (W , f ) = D ! (D,r) = I
All other combinations not allowed Assume we start at I Easier to represent by a graph Exercise: If graph has e arrows, how many lines are needed to dene ? Exercise: Q has n elements and has m elements, how many lines are needed (at most) to dene ? Initial state

I p c W f r

D
1.33

## Manufacturing system: Solution

Assume initially q0=I. What are the sequences of events the machine can experience? Some sequences are possible while others are not pcp possible ppc impossible The set of all acceptable sequences is called the language of the automaton Arbitrary no. The following are OK Nothing of repetitions Arbitrary number of pc
denoted by (pc)* Arbitrary number of pfr denoted by (pfr)* Possibly followed by a p or pf

( p ! c + p ! f ! r)* ! (1+ p + p ! f )
OR Followed by 1.34

Thermostat
A continuous time, hybrid system Thermostat is trying to keep the temperature of a room at around 20 degrees Turn heater on if temperature 19 degrees. Turn heater o if temperature 21 degrees. Due to uncertainty in the radiator dynamics, the temperature may fall further, to 18 degrees, or rise further, to 22 degrees Both a continuous and a discrete state Discrete state: Heater q(t) !Q = {ON ,OFF}

## Thermostat: State space model

Dierent dierential equations for x, depending on ON or OFF
Heater OFF: Temperature decreases exponentially toward 0

Exercise: Solve the dierential equations Heater ON: Temperature increases to verify exponential exponentially towards 30 increase/decrease.

! x(t) = !! x(t)

Heater changes from ON to OFF and back depending on x(t) Natural to describe by mixture of dierential equation and graph notation 1.36

## Thermostat: Hybrid automaton

Initial state (OFF,20)
OFF

x(t) ! 19

ON

x(0) = 20

## ! x(t) = !ax(t) x(t) ! 18

x(t) ! 21
While OFF x(t) changes according to

## Can stay OFF as long as

1.37

Thermostat: Solutions
q(t) x(t)

ON

OFF

1.38

## Continuous modeling: Generic steps

1. Identify input variables
Usually obvious Quantities that come from the outside Say m such input variables u(t) !R m Stack them in vector form, denote by Usually obvious Quantities that can be measured Say p such quantities Stack them in vector form, denote by !R p y(t)

1.39

## Continuous modeling: Generic steps

3. Select state variables
Need to encapsulate the past Need (together with inputs) to determine future For physical systems often related to energy storage For mechanical systems can usually select positions (q(t)) and velocities (v(t)) For electrical circuits can usually select capacitor voltages (vC(t))and inductor currents (iL(t)) Other choices possible, equations may be simpler Say n such variables Stack them in vector form, denote by !R n x(t) 1.40

## Continuous modeling: Generic steps

4. Take derivatives of states
Try to obtain n equations with derivative of one state on the left hand side and a function of the states and inputs on the right hand side For mechanical systems

! Position derivatives easy, q(t) = v(t) Velocity derivatives (=accelerations) from Newton law
Current/voltage relations C

1.41

## Continuous modeling: Generic steps

5. Write output variables as a function of state and input variables
Usually easy y(t) = h(x(t),u(t)) Result: Vector algebraic equation Are the functions f and h linear or not?

## 6. Determine whether the system is linear, etc. Disclaimer:

Generic steps seem easy, but require creativity! Mathematical models never the same as reality With any luck, close enough to be useful 1.42

Signal- und Systemtheorie II D-ITET, Semester 4 Notes 2: Revision of ODE and linear algebra
John Lygeros
Automatic Control Laboratory, ETH Zrich
www.control.ethz.ch

## State space models

For the time being continuous time, continuous state models
Nonlinear Linear

## State equations are ordinary dierential equations

Reminder of some tools to deal with these

## Continuous state models have extra structure

States, inputs, and outputs take values in vector spaces

To exploit structure need tools from linear algebra Discrete time continuous state models very similar
State equations are dierence equations, else the same

## Discrete state and hybrid models somewhat dierent 2.2

Assumed to be known
Matrix product, compatible dimensions
(AB)C = A(BC) Associative: A(B Distributive with respect to addition: + C) = AB + AC AB Non-commutative: ! BA in general
T = BT AT (AB)

## Transpose of a matrix For square matrices AI Identity matrix = IA = A

In every dimension there exists a unique identity matrix !1 Inverse matrix A = AA = I A!1 May not always exist When it does it is unique Computation of the determinant and its basic properties

2.3

The 2-norm
Definition: The 2-norm is a function i : R n ! R that to each x !R n assigns a real number Fact 2.1: For all x, y !R n , a !R 1. x ! 0 and x = 0 if & only if x = 0 2. ax = a ! x 3. x + y ! x + y Exercise: Prove 1 and 2. Is the 2-norm a linear function?

x =

xi2 !
i=1

## Exercise: Show that x

= xT x

The 2-norm is a measure of size or length Distance between is x ! y x, y !R n x The set of points that are closer than r>0 to !R n

y !R n

x! y <r

2.4

Inner product
Definition: The inner product is a Fact 2.2: For all x, y, z !R n , a,b !R function i,i : R n ! R n ! R that 1. x, y = y, x n takes two vectors x, y !R and 2.a x, y + b z, y = ax + bz, y returns the real number 2 n 3. x, x = x T

x, y = ! xi yi = x y
i=1

Definition: Two vectors x, y !R n are called orthogonal if x, y = 0. A set of vectors, x1 , x2 ,, xm !R n are called orthonormal if

## Orthogonal: Meet at right angles

Orthonormal: Pairwise orthogonal and unit length Exercise: Are the vectors ! # orthogonal? Orthonormal? "
0 \$,! 1 \$ & # & 2 % " 0 %

xi , x j

" 0 if i ! j \$ =# \$ 1 if i = j %

2.5

Linear independence
n Definition: A set of vectors {x1 , x2 ,!xm } !R is called linearly independent if for a1 ,a2 ,!am !R

a1 x1 + a2 x2 +! + am xm = 0 ! a1 = a2 = ! = am = 0

Otherwise they are called linearly dependent. Linearly dependent if and only if at least one is a a1 linear combination of the rest. E.g. if ! 0 am a2 a1 x1 + a2 x2 +! + am xm = 0 ! x1 = " x2 "! " xm a1 a1 Fact 2.3: There exists a set with n linearly Exercise: What is a set of independent vectors in R n ,but any set with n linearly independent more than n vectors is linearly dependent. vectors of R n ? 2.6

Subspaces
Definition: A set of vectors S ! R n is called a subspace of R n if for all x, y !S and a,b !R, we have that ax + by !S. Note that the set S is generally an innite set Examples of subspaces of n R
S = R n and S = {0}

Not subspaces

{ x { !R

n x !R x1 = 2x2 n

x1 = 0

{ { x !R

n x !R x1 = 1 n

x1 = 0 or x2 = 0

Exercise: Draw these sets for n=2. Prove that they are/are not subspaces.

2.7

Basis of a subspace

## In fact, span = smallest subspace containing x1 , x2 ,, xm

n Definition: A set of vectors x1 , x2 ,, xm ! R is called a basis for a subspace S ! R n if 1. { x1 , x2 ,, xm } are linearly independent 2. S = span { x1 , x2 ,, xm }

## In this case, m is called the dimension of S.

All subspaces of have bases. The number of vectors, m, in all Rn bases of a given subspace is the same. By Fact 2.3, n m Basis of subspace is not unique Dierent bases related through change of coordinates

2.8

## Range space of a matrix

Definition: The range space of a matrix A !R n"m is the set
range(A) = y !R n | ! x !R m , y = Ax

Fact 2.4: range(A) is a subspace of R n Definition: The rank of a matrix A !R n"m is the dimension of range(A).
A = ! a1 "

## Exercise: Prove Fact 2.4

! a % 1i a2 !am # , where ai = % ! \$ % a % ni " # & & & & \$

Fact 2.5: range(A) = span {a1 ,a2 ,,am }. rank(A)=number of linearly independent Exercise: Prove Fact 2.5 columns, a1, , am of A. 2.9

## Null space of a matrix

Definition: The null space of a matrix A !R n"m is the set null(A) = x !R m | Ax = 0

## Rm Fact 2.6: null(A) is a subspace of m

! aT # 1 A=# ! # T # an "

2.10

## Inverse of a square matrix

Definition: The inverse of a matrix A !R n"n is a matrix A!1 "R n#n

A!1 A = AA!1 = I
Fact 2.9: If an inverse of A exists then it is unique. Definition: A matrix is called singular if it does not have an inverse. Otherwise it is called non-singular or invertible. Exercise: Prove Fact 2.9

2.11

## Inverse of a square matrix

If A is invertible Exercise: Show that
! d 'b \$ '1 # & ! a b \$ 'c a % " # & = ad ' bc " c d %

!1

## Adjoint matrix= matrix of subdeterminants transposed

Fact 2.11: A is invertible if and only if the system of linear n n equations Ax = y has a unique solution x !R for all y !R Fact 2.12: A is invertible if and only if null(A) = 0

{}

## Systems of linear equations

Ax = y
A !R , y !R given m x !R unknown
n!m n

m=n unique solutions if and only if A invertible (Fact 2.11) If A singular system will have either no solutions, or innite number of solutions n>m equations > unknowns generally no solution Fact 2.14: If A has rank m then x = A A unique minimizer of Ax ! y
T

( )

!1

AT y is the

n<m unknowns > equations generally innite solutions Fact 2.15: If A has rank n then the system has infinitely many !1

## x = AT AAT solutions. The one with the minimum norm is

y
2.13

Orthogonal matrices
Fact 2.16: A is orthogonal if and only if its columns are ortho-normal. The product of orthogonal matrices is orthogonal. If A is orthogonal then Ax = x

2.14

## Eigenvalues and eigenvectors

Definition: A (nonzero) vector w !C n is called an eigenvector of n"n a matrix A !R if there exists a number ! !C such that

## Aw = ! w. The number is then called an eigenvalue of A

Eigenvalues and eigenvectors are in general complex even if A is a real matrix An nxn matrix has n eigenvalues (some may be repeated). They are the solutions of the characteristic polynomial det(! I ! A) = ! n + a1! n!1 + a2! n!2 +! + an = 0 The n eigenvalues of A are Exercise: Show that if w is an called the spectrum of A eigenvector then so is aw for any a !C 2.15

## Eigenvalues and eigenvectors

Theorem 2.1: (Cayley-Hamilon) Every matrix A is a solution of its characteristic polynomial An + a1 An!1 + a2 An!2 +! + an I = 0 Exercise: Show that this implies that all m powers A for m=0, 1, can be written as linearxcombinations of I, A, A2 ,, An!1 Rn Fact 2.17: A is invertible if and only if all its eigenvalues are non-zero Exercise: Show Fact 2.17 using Fact 2.12

2.16

Diagonalizable matrices
Awi = !i wi ! A[ w1 w2 ... wn ] = [ w1
W !C n"n

" \$ \$ \$ w2 ... wn ] \$ \$ \$ W \$ #

!1
0 . . 0

0 . . 0

. . . . . . . .

!2 . .

## Definition: A is called diagonalizable if W is invertible

! "C n#n

A = W !W

!1

Fact 2.18: If the eigenvalues of A are distinct (!i ! ! j if i ! j) then its e-vectors are linearly independent

## Symmetric, positive denite and positive semi-denite matrices

Definition: A matrix is called symmetric if A = AT Fact 2.19: Symmetric matrices have real eigenvalues and orthogonal eigenvectors Exercise: If A is symmetric then there exists U !R n"n orthogonal & ! "R n#n diagonal such that Definition: A symmetric matrix is called positive definite if x T Ax > 0 for all x ! 0. It is called positive semi-definite if x T Ax ! 0. Fact 2.20: A matrix is positive definite if and only if it has (real) positive e-values. It is positive semi-definite if and only if it has (real) non-negative e-values.

A = U !U T

## Singular value decomposition

Fact 2.21: For any A !R n"m where U !R m"m and V !R n"nare orthogonal and ! "R n#m diagonal with non-negative elements The elements of are called the singular values of A

A = U !V

2.19

## State Space: Inputs, outputs and states

Mathematical model of physical system described by Input variables (denoted by ) u1 ,u2 ,....,um !R All inputs states and outputs are real numbers Usually write more compactly as vectors
! # # u=# # # " u1 \$ & u2 & '" m & ! & um & %

Input vector

! # # y=# # # "

Output vector

! # # x=# # # "

State vector

## x1 \$ & x2 & n & '" ! & xn & %

Exercise: Which of the examples in Notes 1 can be described by real vectors? What are these vectors?

## State space: Dynamics

Dynamics of process imply relations between variables
Dierential equations giving evolution of states as a function of the states, inputs and possibly time, i.e. we have functions

f i (i) : R ! R ! R + ! R,
n m

## d xi (t) = f i (x(t),u(t),t), i = 1,!,n dt

Algebraic equations giving the outputs as a function of the states, inputs and possibly time, i.e. we have functions

hi (i) : R n ! R m ! R + ! R,

## Equations usually come from laws of nature

Newtons laws for mechanical systems Electrical laws for circuits Energy and mass balance for chemical reactions

2.21

In vector form
Usually write more compactly be dening
f (i) : R n ! R m ! R + " R n

h(i) : R n ! R m ! R + " R p

# f (x,u,t) & # h (x,u,t) & 1 % ( % 1 ( ( f (x,u,t) = % ! ( h(x,u,t) = % ! % f (x,u,t) ( % h (x,u,t) ( % n ( % p ( \$ ' \$ ' Then state, input and output vectors are linked by
d x(t) = f (x(t),u(t),t) dt y(t) = h(x(t),u(t),t)
Exercise: What are the functions f for the pendulum, RLC and opamp examples of Notes 1? What are the dimensions of these systems?

2.22

## Linear and autonomous systems

Definition: A system in state space form is called time invariant if its dynamics do not depend explicitly on time Definition: A system in state space form is called autonomous if it is time invariant and has no input variables
Exercise: Which of the systems considered in Notes 1 are autonomous? Which are time invariant?

## ! x(t) = f (x(t),u(t)), y(t) = h(x(t),u(t))

Definition: A system in state space form is called linear if the functions f and h are linear, i.e.

! x(t) = f (x(t)),

y(t) = h(x(t))

## ! x(t) = A(t)x(t) + B(t)u(t) y(t) = C(t)x(t) + D(t)u(t)

Exercise: Which of the systems considered in Notes 1 are linear?

Exercise: What are the general equations for a linear time invariant system?

2.23

## Higher order dierential equations

Often laws of nature expressed in terms of higher order dierential equations
For example, Newtons law second order ODE

These can be converted to state space form by dening lower order derivatives (all except the highest) as states
Exercise: Convert the following dierential equation of order r into state space form " d r y(t) dy(t) d r!1 y(t) % + g \$ y(t), ,..., =0 r r!1 ' dt dt dt # & What is the dimension of the resulting system? Is it autonomous? Under what conditions is it linear?

2.24

## Time invariant systems

The explicit time dependence can be eliminated by introducing time as an additional state with

! t =1
The result is a time invariant system of dimension n+1
Exercise: Convert the following time varying system ! x(t) = f (x(t),u(t),t), x !R n y(t) = h(x(t),u(t),t) of dimension n into a time invariant system of dimension n+1. Exercise: Repeat for the linear time varying system ! x(t) = A(t)x(t) + B(t)u(t), x !R n y(t) = C(t)x(t) + D(t)u(t) Is the resulting time invariant system linear?

2.25

Coordinate transformation
What happens if we perform a change of coordinates for the state vector? Restrict abention to time invariant linear systems

## ! x(t) = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t)

and linear changes of coordinates x (t) = Tx(t), T !R n!n ,det(T ) ! 0 In the new coordinates we get another linear system

## ! x(t) = TAT !1 x (t) + TBu(t) y(t) = CT !1 x (t) + Du(t)

Could be useful, transformed system may be simpler 2.26

## Solution of state space equations

Only autonomous systems for the time being

! x(t) = f (x(t)),

y(t) = h(x(t))

Non-autonomous systems essentially the same, formal mathematics more complicated What is the solution of the system? Would like to nd functions

x(t Where do we start? Say 0 ) = x0 !R , How long do we go? Say until some ! t0 t1
n

at time t0 !R

2.27

## Solution of state space equations

Definition: A pair of functions x(i) : !t0 ,t1 # % R n , y(i) : !t0 ,t1 # % R p " \$ " \$ is a solution of the state space system over the interval !t0 ,t1 # " \$ n starting at x0 !R if ! 1. x(t0 ) = x0 2. x(t) = f (x(t)), !t " #t0 ,t1 % \$ & 3. y(t) = h(x(t)), !t " #t0 ,t1 % \$ & Note that x(.) implicitly denes y(.) Therefore the diculty is nding the solution to the dierential equation Exercise: Show that x(t) is a solution Because the system is over the interval [0, T] if and only if autonomous the starting x(t-t0) is a solution over the interval [t0, t0+T] starting at the same initial time is also unimportant state. 2.28

## Existence and uniqueness of solutions

For autonomous systems the only thing we need to f (i) : R n ! R n , x0 !R n ,T ! 0, do is, given nd a function x(i) : !0,T # % R n " such that \$ Exercise: Does the function x(.) have ! x(0) = x0 and x(t) = f (x(t)), !t " #0,T % to be continuous? \$ & Dierentiable? Does such a function exist for some T? Is it unique, or can there be more than one? Do such functions exist for all T? Can we compute them even if they do? Clearly all these are important for physical models Unfortunately answer is sometimes no 2.29

Examples
Illustrate potential problems on 1 dimensional systems No solutions: Consider the system

## # !1 if x(t) " 0 % ! x(t) = !sgn(x(t)) = \$ % 1 if x(t) < 0 &

Exercise: Compute the solutions for x0 = 1 and x0 = -1. Are they dened for all T?

starting at x0=0. The system has no solution for any T ! x(t) Many solutions: Consider the system = 3x(t) 2 3 , x0 = 0. For any a 0 the following is a solution for the system

## Exercise: Prove this is the case.

2.30

Examples
No solutions for T large: Consider the system

! x(t) = 1+ x(t) 2 , x0 = 0.
The solution is (t ) = tan(t ) x
Exercise: Prove this. What happens at t= /2?

So many things can go wrong! Fortunately many important systems are well-behaved Definition: A function f : ! n ! ! n is called Lipschitz if there exists ! > 0 such that for all x, x !! n

f (x) ! f ( x ) " ! x ! x
2.31

LipschiQ functions
l is called the Lipschih
constant of f Lipschih functions are continuous but not necessarily dierentiable All dierentiable functions with bounded derivatives are Lipschih Linear functions are Lipschih
Exercise: Show that the f(x) in the three pathological examples in p. 2.30-2.31 are not Lipschih. Exercise: Show that any other is also a Lipschih constant Exercise: Show that f(x)=|x| (x is a real number) is Lipschih. What is the Lipschih constant? Is the function dierentiable? Exercise: Show that f(x)=Ax is Lipschih. What is a Lipschih constant? Is the function dierentiable?

2.32

## Existence and uniqueness

Theorem 2.2: If f is Lipschih then the dierential equation ! x(t) = f (x(t)), with initial condition x0 !R n x() : [0,T ] ! ! n has a unique solution for all T 0 x0 !! n . and all So state space systems dened by Lipschih vector elds are well behaved: They have unique solutions Over arbitrarily long horizons Wherever they start 2.33

Continuity
Even if a unique solution exists, this does not mean we can nd it Sometimes we can: See the pathological examples above and linear systems (Notes 3) Usually have to resort to simulation on computer Construct approximate numerical solution It helps if solutions that start close remain close

Theorem 2.3: If f is Lipschih then the solutions starting at t are such that for all ! 0 x0 , x0 !! n

x(t) ! x (t) ! e !t x0 ! x0

## Continuous dependence on initial condition 2.34

Non-autonomous systems
Formally, we would expect that given

## f (i) : R n ! R m ! R + " R n , x0 #R n ,t1 \$ t0 \$ 0,u(i) : %t0 ,t1 ' " R m & (

x(i) " the solution would be a function : !t0 ,t1 # % R \$ ! x(t0 ) = x0 and x(t) = f (x(t),u(t),t), !t " #t0 ,t1 % \$ & This is OK if f is continuous in u Exercise: What goes wrong and t and u(.) is continuous in t in the case of discontinuity? Unfortunately discontinuous u(.) are quite common Fortunately there is a x, but the math is harder Roughly speaking need
n

## f(x,u,t) Lipschih in x, continuous in u and t u(t) continuous for almost all t

2.35

Signal- und Systemtheorie II D-ITET, Semester 4 Notes 3: Continuous LTI systems in time domain
John Lygeros
Automatic Control Laboratory, ETH Zrich
www.control.ethz.ch

## LTI systems in state space form

General state space systems
d x(t) = f (x(t),u(t),t) dt y(t) = h(x(t),u(t),t)
! # # u=# # # " u1 \$ & u2 & m & '" ! & um & %

State space
x1 \$ & x2 & n & '" ! & xn & %

Input vector

! # # y=# # # "

Output vector

State vector

A !! n"n
C !! p"n

B !! n"m
D !! p"m
3.2

D B
+

u(t)

+ +

. x(t)
A

x(t)

++

y(t)

3.3

## LTI systems in state space form

! For LTI systems state space equations # n coupled, rst order, linear dierential equations = # A # # p linear algebraic equations # Time invariant coecients " a1n \$ & a21 a22 ... a2n & & ! ! " ! & an1 an2 ... ann & % ! b ... b1m \$ 11 # & B=# ! " ! & # b ... bnm & # n1 & " % ! c ... c1n \$ 11 # & C=# ! " ! & # c ... c pn & # p1 & " % ! d ... d1m \$ 11 # & D=# ! " ! & # d ... d pm & p1 # & " % a11 a12 ...

! x1 (t) = a11 x1 (t) + ... + a1n xn (t) + b11u1 (t) + ... + b1mum (t) ! x2 (t) = a21 x1 (t) + ... + a2n xn (t) + b21u1 (t) + ... + b2mum (t) ! " xn (t) = an1 x1 (t) + ... + ann xn (t) + bn1u1 (t) + ... + bnmum (t)
y1 (t) = c11 x1 (t) + ... + c1n xn (t) + d11u1 (t) + ... + d1mum (t) y2 (t) = c21 x1 (t) + ... + c2n xn (t) + d 21u1 (t) + ... + d 2mum (t) ! y p (t) = c p1 x1 (t) + ... + c pn xn (t) + d p1u1 (t) + ... + d pmum (t)

3.4

Examples
RLC Circuit
dv (t) C C = iC (t) = iL (t) dt di (t) L L = v L (t) = v1 (t) ! vR (t) ! vC (t) dt

Amplier Circuit
dvC (t)
1

dvC (t)
0

dt

=!
0

vC (t)
1

dt

=!

vC (t) R0C0

R1C1

+
1

vC (t) R1C0

v1 (t) R1C1

v1 (t) R1C0
\$ & & & u(t) & & %

" \$ 0 ! x(t)= \$ \$ 1 \$ ! # L

1 % " 0 % ' ' C ' x(t) + \$ 1 ' u(t) \$ R ' \$ L ' ! ' # & L &

## % ' ' ' &

nonlinear

3.5

System solution
Since system is time invariant, assume we are given n x Initial condition 0 !R The input values u() : [0,T ] ! ! m Compute the system solution x() : [0,T ] ! ! n

## ! x(0) = x0 and x(t) = Ax(t) + Bu(t), !t " #0,T % \$ &

If we can do this, then output : [0,T ] ! ! p y()

## y(t) = Cx(t) + Du(t), !t " #0,T % \$ &

For simplicity assume input continuous function of time 3.6

State solution
The system solution is where

0

## A2 t 2 Ak t k At n#n !(t) = e = I + At + + ... + + ... "R 2! k!

State transition matrix and the integral is computed element by element a 2t 2 e at = 1+ at + + ... if a !! (cf. Taylor series expansion: ) 2! 3.7

Output solution
Simply combine state solution

0

0

3.8

## Transition matrix properties

Fact 3.1: The state transition matrix is such that Exercise: Prove properties 1, 2 and that (harder)

1. 2. 3. 4.

## !(0) = I d !(t) = A!(t) dt !("t) = [!(t)]!1 "(t1 + t2 ) = !(t1 )!(t2 )

!(t)!("t) = !("t)!(t) = I
Exercise: By invoking the existence discussion from Notes 2, show property 4 (harder).

3.9

Clearly

## x(0) = !(0)x0 + ! !(0 " ! )Bu(! ) d ! = x0

0

! x(t) = Ax(t) + Bu(t) To show that we use the LeibniX formula for dierentiating integrals d g (t ) d ! f (t ) l(t,! ) d ! = l(t, g(t)) dt g(t) dt d " l(t, f (t)) f (t) dt g (t ) # +! l(t,! ) d ! f (t ) #t
3.10

Example: RC circuit

u(t) Inputs: = vs (t) Voltage x(t) States: = vC (t) Input + x Initial condition: 0 = vC (0) vS(t) State space equations

+ R

_ + iC(t) vC(t) _ C

## 1 1 ! x(t) = ! x(t) + u(t) RC RC

Response to step with amplitude 1V
t " % ! x0 + \$ 1! e RC ' # &

x(t) = e

t RC

Exercise: Derive the state space equations. What are the matrices A and B? Exercise: Derive the step response 3.11

## State solution structure

The solution consists of two parts:
x(t) = !(t)x0 + # !(t " ! )Bu(! ) d !
0 t

Total transition

## u(t) = 0!t " x(t) = ZIT

x0 = 0 ! x(t) = ZST

Linear function of initial state Linear function of input Convolution integral 3.12

## Output solution structure

The solution consists of two parts:
y(t) = C!(t)x0 + C ! !(t ! ! )Bu(! ) d ! + Du(t)
0 t

Total Response

## u(t) = 0!t " y(t) = ZIR Linear function of initial state

x0 = 0 ! y(t) = ZSR
Linear function of input cf. linear system definition in SS1 Convolution integral 3.13

## Zero input transition

If we know the state transition matrix we can (in principle) compute all solutions of linear system Given matrix A would like to compute

Many ways of doing this Summing innite series (in some rare cases!) Using eigenvalues and eigenvectors (this set of notes) Using the Laplace transform (later) Numerically (later) Using eigenvalues at least two methods Using Cayley Hamilton Theorem (Theorem 2.1) Using eigenvalue decomposition (used here) 3.14

Ak t k At !(t) = e = I + At + + + k!

## E-values and E-vectors: Rough idea

Recall that (p. 2.15) i = !i wi Aw ZIT ! x(t) = Ax(t) ! x(t) = "(t)x(0)

x(0) = wi

! ! x(0) = Awi = !i wi

i.e. if we start on e-vector we stay on e-vector x(t) increases/decreases depending on sign of x2 E.g.

w2

w1

n = 2, !1 < 0, !2 > 0

! x (0) x(0)
! x (0)

x1
3.15

## Transition matrix computation

Change of coordinates using matrix of eigenvectors Assume matrix diagonalizable (p.2.17)

AW = W ! " A = W !W #1
Therefore (Fact 2.18) At !t !1 !(t) = e = We W where " !1t
Matrix of e-vectors

## Exercise: Prove by induction that

Ak = W ! kW !1
Exercise: Prove this

\$ e =\$ \$ \$ #
!t

e ! 0

3.16

## Example: RLC circuit

Recall that (p. 1.14)

d ! vC (t) \$ ! 0 1 C \$ ! vC (t) \$ + ! 0 # i (t) & = # '1 L ' R L & # i (t) & # 1 L dt " L %" L % " % "
Set R=3, C=0.5, L=1

\$ v (t) & s %
- iL (t ) +
C
vC (t)

A=" 0 2 \$ # !1 !3 %
Eigenvalues:

+ +
v1 (t)

vR (t)
R

- +

vL (t)
L

Eigenvectors:

!1 = !1, !2 = !2

3.17

## RLC circuit: Transition matrix

e = We W
At !t "1

# 2 1 % # e "t 0 % # 1 1 % Using Matlab: = \$ "1 "1 & ' 0 e "2t ( \$ "1 "2 & A=[0 2;-1 -3]; \$ & >>

e !t

W !1

# 2e "t " e "2t 2e "t " 2e "2t & !(t) = % "e "t + e "2t "e "t + 2e "2t ( \$ '

3.18

## RLC circuit: ZIT

x(0) = w1 x(0) = w2 x(0) = a1w1 + a2 w2 ! x(t) = "(t) \$ 2 & = e #t \$ 2 & % #1 ' % #1 ' ! x(t) = "(t) \$ 1 & = e #2t \$ 1 & % #1 ' % #1 ' ! x(t) = "(t)(a1w1 + a2 w2 ) ! x(t) = a1e #t w1 + a2e #2t w2 *t()( \$ 0 & ** %0'

Because w1 and w2 linearly independent they form a basis for (p. 2.8) R2 Therefore all initial conditions can be wrinen as

x(0) = a1w1 + a2 w2
Therefore ZIT 0 for all initial conditions

3.19

## RLC circuit: Step input

ZST with u(t) = V , for t ! 0
x(t) = # !(t " ! )Bu(! ) d !
0 t

## = !(t) # !("! )BV d !

0

\$ "2e "t + e "2t + 1 'V ,t*+* \$ V ' = ,, & e "t " e "2t ) %0( % (

3.20

## Notes: Diagonalizable matrices

For diagonalizable matrices, state transition matrix linear combination of terms of the form !it e Generally i = ! j! !C,! ,! !! ! So ZIT linear combination of terms of the form 1 if !i = 0 (! = 0,! = 0) t if ! = ! (! ! 0,! = 0) e! i Part of ZIT corresponding to = " j# !i Constant if = 0," = 0 !
! Converges to 0 if < 0 Periodic if = 0," ! 0 ! ! Goes to innity if > 0
sin(! t) and cos(! t) if !i = j! (" = 0,! ! 0) e! t sin(" t) and e! t cos(" t) if # = ! j" (! ! 0,"
i

! 0)

3.21

Im()

Re()

3.22

## Stability: Zero input transition

! x(t) Consider the system = Ax(t) + Bu(t) x(t) Let x(t) be its ZIT = !(t)x0 = e At x0
Definition: The system is called stable if for all > 0 there exists > 0 such that

## if x0 ! ! then x(t) ! ! for all t ! 0.

Otherwise the system is called unstable.

i.e. if the state starts small it stays small (p. 2.4) or you can keep the state as close as you want to 0 by starting close enough
3.23

Asymptotic stability
Definition: The system is called asymptotically stable
if it is stable and in addition

x(t) ! 0 as t ! "

i.e. not only do we stay close to 0 but also converge to it Note that

## Exercise: Show that x(t) ! 0 if and only if ! 0 x(t)

Denitions do not require diagonalizable matrices In fact we, will see that they also work for nonlinear systems (Notes 7) 3.24

Diagonalizable matrices
Theorem 3.1: System with diagonalizable A matrix is:
Stable if and only if Re[!i ] ! 0,"i Asymptotically stable if and only if Re[!i ] < 0 !i Unstable if and only if !i : Re[ !i ] > 0

## Proof: By inspection! !i t Transition matrix linear combination of e

Re[!i ] < 0,!i " for all initial conditions ZIT tends to zero ZIT remains bounded and for Re[!i ] ! 0 "i # some initial conditions is periodic (or constant) for some initial conditions ZIT !i : Re[!i ] > 0 " tends to innity 3.25

## Phase plane plots

For two state variables (n=2) x2(t) vs x1(t) parameterized by t for different initial states Trajectory plot x2(t)/x1(t) vs t Phase plane plot x2(t) vs x1(t)

Stable node

3.26

Unstable node

3.27

Stable focus

Center

3.28

Unstable focus

+ + + + +

+ + +

+ +

3.29

## Non-diagonalizable matrices (examples)

At A1 = ! 0 1 # % e 1 = ! 1 t # "0 0\$ "0 1\$

" !1 1 \$ & e A2t = " e !t te !t \$ A2 = ' 0 e !t ( Exercise: Prove the formulas # 0 !1 % # % for the transition matrices
Exercise: Repeat the computations for the matrices

Exercise: What are the eigenvalues of A1 and A2? What are the eigenvectors? What goes wrong with their diagonalization?

3.30

## Non-diagonalizable matrices (general)

Distinct e-values matrix diagonalizable (Fact 2.18) !1 Assume some e-value repeated r times, = !2 = = !r = " j# In general, ZIT linear combination of terms of the form
1,t,t 2 ,,t r-1

if ! = 0,! = 0

## e! t ,te! t ,,t r-1e! t

if ! ! 0,! = 0

sin(! t),cos(! t),t sin(! t),,t r!1 cos(! t) e! t sin(" t),e! t cos(" t),,t r!1e! t cos(" t)

if " = 0,! ! 0

## if ! " 0," " 0

Can be shown using generalized eigenvectors and Jordan canonical form 3.31

## Non-diagonalizable matrices (general)

Note that: ! If < 0,
! If > 0,

e! t , t k e! t cos ! t, t k e! t sin ! t #t!"! 0 tk ## Hence ZIT tends to zero (for some initial states) e! t , t k e! t cos ! t, t k e! t sin ! t #t!"! " tk ## Hence ZIT tends to innity (for some initial states)

If = 0, !

1,cos ! t, sin ! t remain bounded , t k cos ! t, t k sin ! t #t!"! " for k ! 1 tk ## ZIT may remain bounded or tend to innity Cannot tell just by looking at e-values
3.32

## Non-diagonalizable matrices: Stability

Theorem 3.2: The system is:
Asymptotically stable if and only if Re[!i ] < 0 !i Unstable if !i : Re[ !i ] > 0

## Subtle dierences with diagonalizable case

Asymptotic stability condition the same Instability condition sucient but not necessary

!i Re[!i ] ! 0 but "i Re[!i ] = 0 Reason is that if then stability not determined by e-values alone.
ZIT may remain bounded for all initial conditions ZIT may go to innity for some initial conditions If matrix non-diagonalizable, but no e-value with is repeated then Theorem 3.1 still applies Re[!i ] = 0 3.33

## Zero state transition: Dirac function

Can be thought of as a function of time which is
Innite at t=0 Zero everywhere else Satises

" !"

! (t) = 1

1!

## # % % % ! " (t) = \$ % % % &

if t < 0

1 if 0 ! t < ! ! 0 if t " !

3.34

n = m = 1 !

## ! x(t) = ax(t) + bu(t), a !R, b !R

(x State impulse transition h(t) is ZST 0 = 0) for u(t) = ! (t)

## h(t) = # !(t " ! )B! (! )d!

0

=e

at

t 0

e "a! b" (! ) d ! = e at b
t

0 0

## = ! h(t ! ! )u(! ) d ! = (h ! u)(t)

0

3.35

Example: RC circuit
1 1 For the RC circuit: A = ! !!, B = !! RC RC
" t RC

!(t) = e
Impulse transition

1 h(t) = !(t)b = e RC
t

"

t RC

3.36

## Impulse transition H(t) (general)

For general n, m impulse transition given by matrix

## ! h (t) # 11 # H (t) = # . . # # hn1 (t) "

. . h1m (t) \$ & & . . . = '(t)B (! n)m & . . . & . . hnm (t) & %

hij(t) equal to xi(t) when x(0) H (t) = !(t)B = 0 u j (t) = ! (t), uk (t) = 0 k ! j Again, ZST convolution of input with impulse transition

x(t) = (H ! u)(t)

3.37

## Output impulse response K(t)

Usually interested in input-output behavior Output impulse response: output solution to
Input (t) Initial state x(0)=0

Combine impulse transition formula and output map, output impulse response given by
K (t) = C!(t)B + D! (t) "R p#m

## and output ZSR to input u(t) is Exercise: Verify

y(t) = (K ! u)(t)

## Stability with inputs: Zero state transition

! x(t) Consider the system = Ax(t) + Bu(t) t x(t) Zero state transition = !(t " ! )Bu(! ) d !

Theorem 3.3: Assume that Re[!i ] < 0 !i . Then there exists ! ! 0 such that ZST, x(t), satisfies

u(t) ! M !t ! 0 "
t!"

x(t) ! ! M !t ! 0
t!"

## ! u(t) ### 0 then x(t) ### 0. !

So small inputs lead to small states. If in addition the input goes to zero, so does the state Asymptotic stability needed, not enough Re[!i ] ! 0
3.39

## ! x(t) = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t)

Complete response = ZIR + ZSR If Re[!i ] < 0 !i ZIT/ZIR and ZST/ZSR small if input and x(0) small Bounded input, bounded state (BIBS) property Bounded input, bounded output (BIBO) property ZIT/ZIR and ZST/ZSR tend to 0 if input tends to 0 Hence output tends to 0 if input tends to 0
3.40

## Signal- und Systemtheorie II D-ITET, Semester 4 Notes 4: Energy, Controllability, Observability

John Lygeros
Automatic Control Laboratory, ETH Zrich
www.control.ethz.ch

## Wien oscillator: Circuit

i0 (t) iin i1 (t) R
+ +v - in + + +

(k !1)R iout
C1 R1
+

vR
C2

R2

Ideal amplifier

v0 (t)
-

## # % % vin = 0 ! vR (t) = vC (t) ! \$ 2 % % &

iin = 0 ! i1 (t) = i0 (t) ' % % vC (t) 2 % i1 (t) = " ( ! v0 (t) = kvC2 (t) R vC (t) " v0 (t) % % i0 (t) = 2 % (k "1)R ) 4.2

## Wien oscillator: State equations

Linear circuit State Variables: vC (t),vC (t)

! v (t) \$ # C1 & 'R 2 x(t) = # v (t) & # C2 & " % Input Variable: none (autonomous)
! v (t) \$ ! v (t) C1 d # & = A # C1 # v (t) dt # vC (t) & # 2 & # C2 " % " \$ & & & %

dvC 2 (t) + C1 + C2 =0 KCL: R2 dt dt dvC (t) 1 KVL: v (t) ! v (t) ! R C ! kvC (t) = 0 C2 C1 1 1 2 dt
2 1

vC (t)

dvC (t)

4.3

## Wien oscillator: Response

R For simplicity set 1 = R2 = R,C1 = C2 = C Autonomous system (ZI) Stability deftermined by sign of the real part of eigenvalues Eigenvalues are the roots of the characteristic polynomial
3! k 1 det(! I ! A) = 0 ! ! + !+ =0 2 RC (RC)
2

## For second order polynomials

a! 2 + b! + c = 0 the sign of real part of roots determined by signs of a, b, c

This is NOT true for higher order polynomials, we need HurwiJ test

4.4

## Wien oscillator: Stability

a, b, c same sign a, b, c not same sign Some of a, b, c = 0

Degenerate case

## Exercise: Prove this

#!i % < 0 ' Response k < 3 ! "i,Re \$ & goes to 0 j Response oscillates with k = 3 ! !i = ! frequency =1/RC RC Response goes to #!i % > 0 ' infinity (generally) k > 3 ! Re \$ &
4.5

## Wien oscillator: Eigenvalue locus

Eigenvalues are = !
k ! 3 (k !1)(k ! 5) 2RC

## Exercise: Show this

0 Real and negative < k ! 1 1 Complex, negative real part < k < 3 k Imaginary = 3 3 Complex, positive real part < k < 5 k Real and positive ! 5

Exercise: Simulate the Wien oscillator for k = 0.5, 2, 3, 4, 6 and plot x1 vs. x2 Exercise: Plot locus of the e-values as k goes from 0 to innity (in matlab)

## k = 1 or 5 Roots real and equal (critical damping)

4.6

System energy
For the Wien oscillator

! C 0 \$ 1 1 1 2 2 & x(t) E(t) = C1vC (t) + C2 vC (t) = x(t)T # 1 1 2 2 2 2 # 0 C2 & " % 1 Quadratic function of the state E(t) = x(t)T Qx(t) 2
Matrix Q

!0 Any quadratic with Q that satises these properties serves as an energy like function Exercise: Find Q Example: Coordinate change such that x (t) = Tx(t) = 1 x (t)T Qx (t) for T invertible E(t) 2
4.7

Symmetric (Q=QT) (in this case diagonal) T Q Positive denite > 0, i.e. x Qx > 0 !x

System power
Instantaneous change in energy

! ! dE(t) x T (t)Qx(t) x T (t)Qx(t) P(t) = = + dt 2 2 x(t)T AT + u(t)T BT Qx(t) x(t)T Q Ax(t) + Bu(t) = + 2 2 x(t)T AT Q + QA x(t) u(t)T BT Qx(t) + x(t)T QBu(t) = + 2 2

)
)

## For autonomous systems or when u=0 (ZIT)

P(t) =

x(t)T AT Q + QA x(t) 2

## x(t)T Rx(t) =! , for R = ! AT Q + QA 2

4.8

System power
Power also a quadratic of the state Exercise: Show R is symmetric Matrix R is symmetric R If it is positive denite > 0, i.e. x T Rx > 0 !x ! 0 then energy decreases all the time Natural to assume that in this case system is stable Exercise: Compute power for the Wein oscillator. For which values of k is R positive denite? Theorem 4.1: The eigenvalues of A have negative real part if and only if for all R = RT > 0 there exists a unique Q = Q T > 0 such that AT Q + QA = !R 4.9

Lyapunov equation
Lyapunov equation

T

## Aleksandr Lyapunov 1857-1918

Elements of A

Aq = r

of Q

Because Q and R symmetric n(n+1)/2 equations in n(n +1)/2 unknowns Fact 2.11 equation has: A Unique solution if non-singular A Multiple solutions or no solutions if singular 4.10

Elements of R

Lypunov functions
Linear version of Lyapunov Theorem (Notes 7)

## A Q + QA = !R Possible to solve eciently (e.g. Matlab)

T

For any solving for Lyapunov equation for R = RT > 0 ! x(t) unknown Q allows us to determine stability of = Ax(t)
Unique positive denite solution Asymptotically stable No solution, multiple solutions Non-positive denite solution

## Not asymptotically stable

Resulting energy-like function : R n ! R V Exercise: Why is Lyapunov equation linear? Is Lyapunov known as Lyapunov function function linear?

1 V (x) = x T Qx 2

4.11

Input-State-Output relations
Investigate the eect of
Input on state State on output

## Two fundamental questions

1. Can I use inputs to drive state to desired value 2. Can I infer what the state is by looking at output

## Answer to 1. Controllability Answer to 2. Observability Answers hidden in structure of matrices A, B, and C

4.12

Controllability
Consider a linear system

## dx (t) = Ax(t) + Bu(t) dt x !R n ,u !R m , y !R p y(t) = Cx(t) + Du(t)

Definition: The systemn is called controllable over [0, t] if for all x(0) = nx0 !! initial conditions and all terminal x1 !! conditions there exists an input u() : [0,t] ! ! m such that x(t) = x1
4.13

Observations
x0 , x1 In other words: For any we can nd such that u() : [0,t] ! ! m
t

## x1 = e At x0 + ! e A(t!! ) Bu(! )d!

0

Observations: Input can drive the state from to in time t, x0 x1 x1 but not necessarily keep it at afterwards Input to state relation, outputs play no role and can be ignored for the time being Denition generalizes to other systems (nonlinear, time varying, etc) but more care is needed 4.14

Observations
Fact 4.1: The system is controllable over [0, t] if and only if for n all x1 !! there exists an input u() : [0,t] ! ! m such that x(t ) = x1 starting at x(0) = 0
Proof: Exercise: Prove only if part If: To drive the system from x(0)=x0 to x(t)=x1 use input that drives At ! ! x it from (0) = 0 to x (t) = x1 ! e x0 Fact 4.2: The system is controllable over [0, t] if and only if for all x0 !R n there exists an input u() : [0,t] ! ! m such that x(t) = 0 starting at x(0) = x0 Proof: Exercise: Prove only if part If: To drive the system from x(0)=x0 to x(t)=x1 use input that drives ! At ! ! it from (0) = x0 ! e x1 to x (t) = 0 x

4.15

Controllability gramian
Given time t, dene controllability gramian

T

## Exercise: Show that WC (t) = WCT (t) ! 0

Fact 4.3: The system is controllable over [0, t] if and only if WC(t) is invertible Proof: If. Drive system from to in time t. x0 !! n x1 !! n By Fact 4.1, assume x0=0 and select T AT (t!! ) !1 Exercise: Complete

u(! ) = B e

WC (t) x1 , ! ![0,t]

the if part

4.16

Controllability gramian
Only if: If WC(t) is not invertible then (Fact 2.11, 2.17) there exists with such that z !! n z!0
t T T A! T AT ! WC (t)z = 0 ! z WC (t)z = 0 ! " z e BB e z d ! = 0 0 t 2 z T e A! B d ! = 0 ! z T e A! B = 0 for all ! #[0,t] !" 0 t

Therefore T x(t) = z T e A(t!! ) Bu(! ) d ! = 0 z 0 and only x(t) orthogonal to z can be reached from x(0)=0. By Fact 4.1, the system is not controllable

"

4.17

Controllability test
Dene the controllability matrix P = [B AB A2 B ! An!1B] !R n!nm Theorem 4.2: The system is controllable over [0, t] if and only if the rank of P is n The rank of P is at most n since it has n rows (Fact 2.5) Proof: We know that the system is controllable over [0, t] if and n only if WC(t) is invertible. WC(t) is invertible if and only if for !! z WC(t)z=0 z=0 (else WC(t) has 0 as an eigenvalue, Fact 2.17). If we can show WC(t) z=0 PTz=0 this would imply PT has rank n if and only if WC(t) is invertible.

4.18

## Controllability test: Proof

As in the proof of Fact 4.3 we can show that T AT ! WC (t)z = 0 ! B e z = 0 for all ! ![0,t]
T

By Taylor series, the last part holds if and only if BTeA z and all its derivatives at =0 are equal to zero, in other words d T AT ! T AT ! T B e z = BT AT z = 0 B e z =B z=0 d! ! =0 ! =0 and so on, until d n!1 T AT ! B e z = BT (An!1 )T z = 0 d! n!1 ! =0 Higher derivatives (involving An, An+1, etc.) are then automatically zero by the Cayley-Hamilton Theorem 2.1. Summarizing WC (t)z = 0 ! P T z = 0 and the system is controllable if and only if P has rank n.

4.19

## Example: OpAmp circuit

Ideal amplifier: i1 (t) = i0 (t) + iC (t) + iL (t)

dvC (t) vin (t) vC (t) ! = +C + iL (t) R1 R0 dt dvC (t) 1 1 1 ! = ! iL (t) ! vC (t) + vin (t) dt C R0C R1C
diL (t) diL (t) vC (t) L = vC (t) ! = dt dt L
i1 (t)

iL (t)

L
-

iC (t)

vC (t)

R1

i0 (t)

R0
+

vin (t)

v0 (t)
-

4.20

## Example: OpAmp circuit

The state space matrixes are: " % " % 0 1 L 0 ', B = \$ A=\$ ' ,C = " 0 !1 % # & \$ !1 C !1 R0C ' \$ 1 R1C ' # & # & Note that the input aects only one of the two states directly It can use this state to inuence the second state through the dynamics encoded in the matrix A ! \$ 1 # 0 & R1 LC & !1 # P=# & ' det(P) = R 2 LC 2 ! 0 1 1 # 1 & ! # R1C R0 R1C 2 & " % 4.21

Observations
Easy test for controllability Requires matrix multiplications and rank test, instead of integration of matrix exponential Proof of Theorem 4.2 implies the following Corollary 4.1: The set of x1 !! for which !u() : [0,t] ! ! such that x(t) = x1 starting at x(0) = 0 is equal to Range(P) Fact 4.4: WC(t) is invertible for some t > 0 if and only if it is invertible for all t > 0.
n

## Exercise: Prove Fact 4.4

Roughly speaking, if the system is controllable can get from any state to any other state as fast as we like The faster we go, the more the energy and the bigger the inputs we will need 4.22

## Minimum energy inputs

Consider as the energy of the input the quantity 0 In our example of p. 4.20

! u(! )
t

u(! ) d ! = ! u(! ) d !
0

! u(! )
0

## d ! = R1 ! vin (! )i1 (! ) d ! = R1 i(energy provided by vin )

0

Theorem 4.2: Assume that the system is controllable. Given x1 !! n and t > 0, the input that drives the system from x(0)=0 to x(t)=x1 and has the minimum energy is given by

um (! ) = B e
T

AT (t!! )

4.23

## Minimum energy inputs: Proof

Proof: In the proof of Fact 4.3 we saw that the proposed um
u (! )T u (! ) d ! = x TW (t) "1 e A(t"! ) BBT e AT (t"! )W (t) "1 x d ! m C 1 ! m ! 1 C 0 0 # t A(t"! ) T AT (t"! ) & T T = x1 WC (t) "1 % ! e BB e d ! ( WC (t) "1 x1 = x1 WC (t) "1 x1 \$0 ' To show that this energy is minimum, consider any other input u(.) that drives the state from x(0)=0 to x(t)=x1. u(.) can u(! ) = um (! ) + u(! ). be wri[en as So its energy will be
u(! )T u(! ) d ! = ! (um (! ) + u(! ))T (um (! ) + u(! )) d ! !
0 0 t t

t t

0

4.24

## Minimum energy inputs: Proof

But x(t) = " e A(t!! ) Bu(! ) d ! = " e A(t!! ) B(um (! ) + u(! )) d ! 0 0 t t t = " e A(t!! ) Bum (! ) d ! + " e A(t!! ) Bu(! ) d ! = x1 + " e A(t!! ) Bu(! ) d !
0 0 0 t t

Since x(t)=x1, we have that e A(t!! ) Bu(! ) d ! = 0 0 t t t T and um (! )T u(! ) d ! = ! u(! )T um (! ) d ! = ! x1 WC (t) "1 e A(t"! ) Bu(! ) d ! = 0 ! 0 0 0 Therefore
T u(! )T u(! ) d ! = x1 WC (t) "1 x1 + ! u(! )T u(! ) d ! # ! um (! )T um (! ) d ! ! 0 0 0 t t t

4.25

Observability
dx (t) = Ax(t) + Bu(t) x !R n ,u !R m , y !R p dt y(t) = Cx(t) + Du(t)
Definition: The system is called observable over [0, t] if given u() : [0,t] ! ! m and y() : [0,t] ! ! p we can uniquely n determine the value of x() : [0,t] ! ! Again time of observation, t, will turn out to play no role Inputs play little role, just carried along Generalizations (to e.g. non-linear systems) possible, but care is needed 4.26

## Initial state observability

Recall that x(t) = e At x0 + e A(t!! ) Bu(! )d!
0

Therefore to infer given u() : [0,t] ! ! x() : [0,t] ! ! n it suces to infer the initial condition x(0)=x0 Assume that two initial conditions, x0 and , under the x0 u() : [0,t] ! ! m same input lead to the same output

## y() : [0,t] ! ! p , i.e. !! ![0,t]

!

Ce A! x0 + C " e A(! !s) Bu(s)d s + Du(! ) = Ce A! x0 + C " e A(! !s) Bu(s)d s + Du(! )
0 0

Then A! (x0 ! x0 ) = 0, for all ! ![0,t] Ce x !R n such that called unobservable Ce A! x = 0 !! ![0,t]
4.27

Unobservable states
! Ce A! x = 0 x !R nunobservable if and only if for all ![0,t]
A!

Note that if x=0 then , so x=0 is an Ce x = 0 unobservable state Exercise: Show that the System is observable if and only unobservable states form if x=0 is the only unobservable state a subspace In this case the initial state x0 is uniquely determined by the zero input response since

## ! Ce A! (x0 ! x0 ) = 0 for all ! ![0,t] ! (x0 ! x0 ) unobservable ! (x0 ! x0 ) = 0 ! x0 = x0

4.28

Observability
Note that two initial conditions that under the same input lead to the same output dier by an unobservable state By a Taylor series argument A! x = 0 for all ! ![0,t] Ce if an only if all its derivatives at = 0 equal to 0 d A! Ce x = Cx = 0, Ce A! x = CAx = 0,! ! =0 dt ' ! =0 d n!1 Exercise: Show this Ce A! x = CAn!1 x = 0 n!1 d! ! =0 By the Cayley Hamilton theorem, if for k=0, CAk x = 0 1, , n-1 then for all k>n-1 Exercise: Show this CAk x = 0 4.29

Observability
Therefore a state x is unobservable if an only if = 0 Qx
" C \$ \$ CA Q= \$ ! \$ CAn!1 # % ' ' (R np!n ' ' &

If Q is full rank then the only unobservable state is 0 In this case, system is observable since

## Ce A! (x0 ! x0 ) = 0 for all ! ![0,t] ! x0 = x0

Theorem 4.3: The system is observable over [0, t] if and only if the rank of the matrix Q is n 4.30

## Example: OpAmp circuit (p. 4.20)

1 0 1 Q = therefore it is observable det(Q) = C 0 1 C 1 R0C We are only measuring one of the two states directly We can infer the value of the other state by its eect on the measured state through the dynamics encoded in A Roughly speaking use measured state + all its derivatives to deduce the value of the unmeasured states

4.31

Observability Gramian
One can also construct and observability gramian t Exercise: Show that AT ! T A! n!n W (t) = e C Ce d ! "R T O WO (t) = WO (t) ! 0 0 Fact 4.5: The system is observable over [0, t] if and only if WO(t) is invertible. If the system is observable over some [0, t] then it is also observable over all [0, t] Notes Checking the rank of matrix Q is easier Corollary 4.2: Set of unobservable states Rank of Q at most n (n columns) equal to Null(Q) Time of observation is immaterial

4.32

## Output derivative interpretation

! x(t) = Consider dierentiating y(t) along Ax(t) + Bu(t)
y(t) = Cx(t) + Du(t) ! ! ! ! y (t) = Cx(t) + Du(t) = CAx(t) + CBu(t) + Du(t)

## !! = CA2 x(t) + CABu(t) + CBu(t) + Du(t) ! !! y(t)

" y(0) \$ ! \$ y (0) \$ ! \$ \$ y (n!1) (0) # % " ' \$ C ' \$ CA '=\$ ! ' \$ n!1 ' # CA & % " D 0 ' \$ D ' x(0) + \$ CB ' \$ CAB CB ' \$ CAn!2 B CAn!3 B # &
np

" ! 0 % \$ u(0) ' ! ! 0 ' \$ u(0) ! 0 '\$ ! \$ ' ! D & \$ u (n!1) (0) #
np"nm

Y = Qx(0) + KU

Y !R , K !R

,U !R

nm

4.33

## Output derivative interpretation

Y = Qx(0) + KU
Measured Q full rank Known System of linear equations to be solved for x(0) If p=1, !R n!n has rank n ! Q invertible Q

x(0) = Q !1 (Y ! KU )
If p>1, more equations than unknowns, least squares solution. If Q has rank n, pseudo-inverse (Fact 2.14)

x(0) = Q Q
T

!1

Q T (Y ! KU )
4.34

But
Dierentiating measurements is a bad idea Noise gets amplied Example: Sinusoidal signal corrupted by small amplitude, high frequency noise y(t) = asin(! t) + bsin(! n t) b ! a, ! n ! ! a Signal-to-noise ratio: SNR = ! 1 b a! a ! (t) = ! a cos(! t) + ! n bcos(! n t) SNR = y " b! n b
a! 2 a! !! = !! asin(! t) ! ! bsin(! n t) SNR = y(t) " 2 b! n b! n Derivative of signal soon becomes useless
2 2 n

4.35

Observers
Instead of dierentiating, build a lter ! Progressively construct estimate of the state (t) !R n x ! Start with some (arbitrary) initial guess (0) !R n x Measure y(t) and u(t) Update estimate according to

## ! dx ! ! (t) = Ax (t) + Bu(t) + L " y(t) ! Cx (t) ! Du(t) \$ # % dt

Mimic evolution of true state, plus correction term Gain matrix L Error dynamics

## ! ! e(t) = x(t) ! x (t) ! e(t) = (A ! LC)e(t)

4.36

Observers
Theorem 4.4: If the system is observable, then L can be chosen such that eigenvalues of (A-LC) have negative real parts. In this case error system is asymptotically stable Error goes to zero e(t) #t!"! 0 ## t!" ! x ! State estimate converges to true state (t) ### x(t) Convergence arbitrarily quick by choice of L In presence of noise transients may be bad Kalman lter: Optimal trade-o for L if
State and measurement equations corrupted by noise System linear and noises Gaussian

## R.E. Kalman 1930 -

4.37

Kalman decomposition
There exists change of coordinates invertible such that: T R nn
! # # x (t) = Tx(t) = # # # # " x1 (t) \$ controllable & observable & x2 (t) & controllable & unobservable & x3 (t) & uncontrollable & observable & x4 (t) & uncontrollable & unobservable %

## " \$ \$ !1 A = TAT = \$ \$ \$ \$ # C = CT !1 = " \$ #

A11 A 0 0

21

0 A 0 0

22

A13 A

23

A33 A

43

0 % " ' \$ ' A24 \$ ' , B = TB = \$ 0 ' \$ ' \$ A44 ' # &

## B1 % ' B2 ' ' 0 ' 0 ' &

C1 0 C3 0 % ' &

4.38

Kalman decomposition
'! )# )# (" A11 A
21

## \$* &, controllable, &, %+

'! A ) # 11 )# 0 ("

## * A13 \$ ! & , C C \$, observable 1 3 & " %, A33 & # + %

u(t)
B2

B1

C+O
x1 (t)
A23 A21 A24 A13 A43

C1

y(t)

C3

C+O
x2 (t)

C+O
x3 (t)

C+O
x4 (t)
4.39

## Stabilizability and detectability

Definition: The system is detectable if all eigenvalues of A22 and A44 in the Kalman decomposition have negative real part. Can design observer for observable part ! A A \$ ' * 11 13 & ! , C1 C3 \$, with overall observation error decaying ) # &, " % ) # 0 A33 & # (" + % to zero Definition: The system is stabilizable if all eigenvalues of A33 and A44 in Kalman decomposition have negative real part. '! A Can design controller for controllable part 0 \$ ! B1 \$* 11 &,# &, )# which ensures overall system ) # A21 A22 & # B2 &, (" %+ % " asymptotically stable 4.40

Signal- und Systemtheorie II D-ITET, Semester 4 Notes 5: Continuous LTI systems, frequency domain
John Lygeros
Automatic Control Laboratory, ETH Zrich
www.control.ethz.ch

Laplace Transform
Convert time function f(t) to a complex variable function F(s) F :C! C f :R!R " L ! st !!! F (s) " f (t) #!! F(s) = L f (t) = f (t)e dt !1 ! L 0 Recall that we assume that f(t)=0 for all t<0 (unlike SSI, p. 0.22) Can also be dened for matrix valued functions

} #
n"m

f :R!R

n"m

F :C! C

## Laplace Transform: Properties

Assumption: The function f(t) is such that the integral can be ## defined, i.e. f (t)e ! st #t!"! 0 quickly enough

## L s shift e f (t) = F(s + a) !d \$ Time derivative " f (t) % = sF (s) ! f (0) L

# dt & L Convolution ( f * g)(t) = F (s)G(s)

!at

## Laplace Transform: Useful functions

L A. Dirac function ! (t) = 1
B.

## L C. Exponential function e !at = 1

D. Sinusoidal functions

## { } L Step function {1} = 1 s

{ }

s+a

L {sin(! t)} = !

L cos(! t) = s

s2 + ! 2
s2 + ! 2
t!0

Exercise: Prove C using the s shift property. Prove D using C. Prove B using A and the time derivative property.

s!"

t!" s!0

## Inverse Laplace Transform

Dened as an integral Laplace transforms of interest here will be proper, rational functions
Ratio of two polynomials in s Degree of numerator less than or equal to degree of denominator Exercise: Compute the Laplace transform of:

f (t) = t, f (t) = t n , f (t) = te !at , f (t) = e !at cos(! t), d2 g(t) = 2 f (t), dt f (t) = sin(! t + ! )

## In this case use partial fractions Example:

!1

" % % 1 1 1 % !1 " !1 " 1 L # 2 ! &= L # &= L # & \$ s + 3s + 2 ' \$ (s + 1)(s + 2) ' \$s +1 s + 2' !1 " 1 % !1 " 1 % !t !2t =L # &! L # &=e !e \$ s + 1' \$s + 2'

5.5

Time domain:

## Take Laplace Transform

! dx(t) \$ L" % = L Ax(t) + Bu(t) ' sX (s) ( x(0) = AX (s) + BU (s) # dt & X (s) = (sI ! A) !1 x0 + (sI ! A) !1 BU (s) Laplace domain:

5.6

## Comparison with time domain

Time domain solution

## x(t) = e At x0 + " e A(t!! ) Bu(! ) d !

Take Laplace transform
0

Convolution

{ } ) X (s) = L {e }
L x(t) = L e At

{ }

At

## " t A(t!! ) & \$ \$ x0 + L # ! e Bu(! ) d ! ' \$0 \$ % ( x0 + L e At BU (s)

{ }

Comparing

L e At = (sI ! A) !1
5.7

{ }

## Example (p. 3.21)

R
+

L
C
! # 0 d ! vC (t) \$ # # &= dt # iL (t) & # 1 " % # ! " L 1 C R ! L \$ & ! v (t) \$ ! 0 \$ &# C & + # 1 & vs (t) & & # iL (t) & # % # L & &" " % %

vs (t )

For R=3, C=0.5, L=1 " 0 2 % " s !2 % A=\$ ' ( (sI ! A) = \$ ' # !1 !3 & # 1 s+3 & Laplace transform of state transition matrix
" s+3 2 % 1 (sI ! A) = 2 \$ ' s + 3s + 2 # !1 s &
!1

5.8

## Example: Transition Matrix

) # s + 3 2 &1 + + !(t) = L (sI " A) = L * 2 % (. + s + 3s + 2 \$ "1 s ' + , / )# &s+3 2 +% 2 (+ 2 + + = L"1 * % s + 3s + 2 s + 3s + 2 ( . (+ "1 s +% % ( + \$ s 2 + 3s + 2 s 2 + 3s + 2 ' + , / )# 2 1 2 2 &+% " " (+ +% s + 1 s + 2 s + 1 s + 2 (+ = L"1 * . % "1 (+ 1 "1 2 + + + +% s + 1 s + 2 s + 1 s + 2 (+ '/ ,\$
"1

"1

"1

& ( ( '

## Example: Step transition (p. 3.24)

ZST with input vs (t) = V for t ! 0 Laplace transform s (s) = V s V
" % 2 \$ ' \$ s(s + 1)(s + 2) 'V !1 X (s) = (sI ! A) BVs (s) = \$ ' s \$ ' \$ s(s + 1)(s + 2) ' # & " 1 2 1 % + \$ ! ' No need to compute = \$ s s + 1 s + 2 'V \$ ' entire (sI-A)-1, just 1 1 ! \$ ' second column s +1 s + 2 & # x(t) = L
!1

5.10

## Example: Step transition

! 2 # # s(s + 1)(s + 2) X (s) = # s # # s(s + 1)(s + 2) " \$ & &V & & & %

## Initial value theorem x(0) = limt!0 x(t) = lim s!" sX (s)

! 2 # (s + 1)(s + 2) x(0) = lim s!" # # s # # (s + 1)(s + 2) " \$ & &V = ! 0 \$ (ZST) # & & 0 % " & & %

5.11

## Example: Sinusoidal input

ZST with input vs (t) = V sin(t) Laplace transform (s) = V s 2 + 1 Vs " 2 \$ 2 \$ (s + 1)(s + 1)(s + 2) !1 X (s) = (sI ! A) BVs (s) = \$ s \$ 2 \$ (s + 1)(s + 1)(s + 2) # " !3s + 1 1 2 % VC (s) = X 1 (s) = \$ 2 + ! 'V # 5(s + 1) s + 1 5(s + 2) &
3V V 2 !2t !t vC (t) = ! cos(t) + sin(t) +Ve ! Ve 5 5 5
External input response Eigenvalue response

5.12

## Example: Sinusoidal input

t The system is stable, so as ! "
2 Ve ! Ve !2t ! 0 5
!t

## 3V V vC (t) ! " cos(t) + sin(t) 5 5

In general, for stable systems with sinusoidal input steady state solution is also sinusoidal with
Same frequency as input Amplitude and phase determined by system matrices

5.13

Transfer function
Consider ZSR (s) = (sI ! A) !1 BU (s) X Y (s) = CX (s) + DU (s)

## Y (s) = C(sI ! A) !1 B + D U (s)

Transfer function

## G(s) = C(sI ! A) B + D "C

If we measure y=iL C

!1

p#m

Summarizes system input-output behavior (s) = G(s)U (s) Y In the RLC example s
= ! 0 1 # , D = 0 ! G(s) = " \$ (s + 1)(s + 2)

If we measure y=vC C

5.14

## Transfer function structure

System called
Single input, single output (SISO) if m=p=1 Multi-input, multi-output (MIMO) if m or p >1

## Cadj(sI ! A)B Cadj(sI ! A)B + D det(sI ! A) G(s) = +D= !C det(sI ! A) det(sI ! A)

All entries are rational functions of s For SISO systems System zeros

## Proper and strictly proper transfer function

Consider SISO system described by rational G(s) Transfer function is called proper if numerator degree denominator degree Fact 5.1: SISO transfer functions arising from state space descriptions of LTI systems are always proper Transfer function is called strictly proper if numerator degree < denominator degree Fact 5.2: SISO transfer functions arising from state space descriptions of LTI systems are strictly proper if and only if D=0 Input aects output only through system dynamics 5.16

## Proper and strictly proper transfer function

(s ! z1 )(s ! z2 )!(s ! zk ) G(s) = !C (s ! p1 )(s ! p2 )!(s ! pn ) Proper k n, strictly proper k<n ! If G(s) is strictly proper, expanding polynomials

G(s) =

## b1s n!1 + b2 s n!2 +! + bn s n + a1s n!1 + a2 s n!2 +! + an

Some bi may be zero If no pole-zero cancellations denominator is the characteristic polynomial of A i.e. poles are the eigenvalues of A For simplicity we will mostly consider SISO, strictly proper transfer functions in the rest of these notes 5.17

## Transfer function and impulse response

y(t) = C ! e SISO systems, ZSR
0 t A(t!! )

Bu(! ) d ! + Du(t)

## K (t) = Ce At B + D! (t) (c.f. Notes 3)

Taking Laplace transform

## L{K (t)} = L Ce At B + D! (t) = C(sI ! A) !1 B + D

Transfer function is Laplace transform of output impulse response y(t) ZSR: impulse response-input convolution = (K *u)(t)

5.18

## Transfer function and stability

From our knowledge of time domain solutions If poles are distinct system is Asymptotically stable if and only if pi ] < 0,!i Re[ If poles are repeated system is
Stable if and only if Re[ pi ] ! 0 !i Unstable if and only if : Re[ pi ] > 0 !i

Re[ Asymptotically stable if and only if pi ] < 0,!i Unstable if !i : Re[ pi ] > 0 If system may be stable !i Re[ pi ] ! 0 and "i Re[ pi ] = 0 or unstable, depending on partial fraction expansion (cf. depending on eigenvectors of matrix A, Notes 3)

Block diagrams

## G1(s) G1(s) G2(s)

G2(s) + + +

G2(s)G1(s)

G2(s)+G1(s)

+-

G1(s) G2(s)

[1+G1(s)G2(s)]-1G1(s)

## Caution: MIMO transfer functions in general matrices! 5.20

Block diagrams
u K1(s) + + y K2(s) K3(s)
Y (s) = [1+ G(s)K 2 (s)K 3 (s)] G(s)K 2 (s)K1 (s)U (s)
!1

G(s)

In the SISO case: Composition or rational transfer functions is also a rational transfer function Properties of closed loop system studied using the same tools

Exercise: In the SISO case, show that if G(s) strictly proper, K1(s), K2 (s), K3(s) proper then closed loop transfer function is strictly proper

5.21

Frequency response
In RLC example, steady state response to sinusoidal input is sinusoidal More generally consider proper, stable SISO system with transfer function G(s) Apply u(t)=sin(t) Output secles to sinusoid y(t)=Ksin(wt+f) with The same frequency, Amplitude = G( j! ) = Re[G( j! )]2 + Im[G( j! )]2 K

5.22

## # Im[G( j! )] & Phase = !G( j! ) = tan % ! \$ Re[G( j! )] ( '

"1

Frequency response
Response of system to sinusoids at dierent frequencies called the frequency response Frequency response important because
Sinusoids are common inputs Directly related to any other input by Fourier transform Frequency response tells us a lot about system behavior E.g. Will it be stable under various interconnections?

Frequency response usually summarized graphically Bode plots: Log-log plot lin-log plot j! ) vs. ! !G( G( j! ) vs. ! ,
Nyquist plot: G(j) in polar coordinates, parameterized by G( j! ) vs. !G( j! ), Nichols chart: Log-lin plot parameterized by

5.23

## Bode plots (bode.m)

log ( ) (in rad/sec) Pair of plots, x-axis the same , y-axes 20log G( j! ) (in dB) and !G( j! ) (in degrees)

2 G(s) = (s + 1)(s + 2)

s G(s) = (s + 1)(s + 2)

5.24

## Nyquist plot (nyquist.m)

Plot of Im[G(j)] vs. Re[G(j)] parameterized by

2 G(s) = (s + 1)(s + 2)

G(s) =

s (s + 1)(s + 2)

5.25

Resonance

f (t)

Appears in second order systems (two poles) Bode magnitude plot has maximum at some frequency Sinusoidal inputs around this frequency get amplied Important consequences for performance Second order systems very common in practice Example: Simplied suspension model
x(t)
Output: position Input: Force

## ! M!! + dx(t) + kx(t) = ! f (t) x(t)

X (s) 1 =! 2 F (s) Ms + ds + k
Second order transfer function

5.26

Resonance
Second order transfer functions of interest look like
2 K! n G(s) = 2 , 2 s + 2!" n s + ! n k ! , For suspension example: n = M

!n > 0
!=
d 2 km , 1 K =! k
Gain
2 K! n 2 n

Frequency response
G( j! ) = K!
2 n 2 (! n ! ! 2 ) + j(2!" n! )

Natural frequency

Damping ratio

G( j! ) =

(!

!!

) + (2!" ! )
2 n

## # 2!" n! & !G( j! ) = "tan % 2 2( \$ !n " ! '

"1

5.27

Resonance
1. 2. 3. 4. 5.
Exercise: Verify 1-5 ! For stability need ! 0 For poles real (over-damped system) ! !1 For poles real and equal (critical damping) ! =1 0 <! <1 For poles complex (under-damped system) For poles imaginary (undamped system) ! =0

1 !! 6. For magnitude Bode plot decreasing in w 2 1 7. For magnitude Bode plot has a maximum 0 !! < 2 Exercise: Take K the derivative ! = ! n 1! 2! 2 at and j! ) = G( G( j! ) of to 2! 1! ! 2
verify 6-7

5.28

Resonance
Bode plots typically drawn with normalized axes As damping 0
Max. freq. n ! Max. ampl. Gain =1

5.29

## Transfer function realization

Time domain description unique transfer function

## dx (t) = Ax(t) + Bu(t) dt y(t) = Cx(t) + Du(t)

Transfer function unique time domain description?? \$ dx ? & (t) = Ax(t) + Bu(t) (s ! z1 )(s ! z2 )!(s ! zk ) G(s) = "" % dt # (s ! p1 )(s ! p2 )!(s ! pn ) & y(t) = Cx(t) + Du(t) ' Given G(s), choice of A, B, C, D such that C(sI ! A) !1 B + D = G(s) known as a realization of G(s) Clearly not unique, e.g. coordinate change = Tx, det(T ) ! 0 x 5.30

## Realization: SISO, strictly proper system

b1s n!1 + b2 s n!2 +! + bn G(s) SISO, strictly proper system = n s + a1s n!1 + a2 s n!2 +! + an
! # # ! x(t) = # # # # " y(t) = ! " 0 0 ! 0 !an bn 1 0 0 1 ! ! 0 0 !an!1 !an!2 bn!1 0 0 " ! 1 !a1 \$ ! & # & # & x(t) + # & # & # & # " % 0 0 ! 0 1 \$ & & & u(t) & & & %
! # # # ! x(t) = # # # # " y(t) = ! " 0 0 1 0 0 1 ! ! " 0 0 0 0 ! !an \$ & # # !an!1 & & # !an!2 & x(t) + # & # ! & # !a1 & # % " 1 # x(t) \$ bn \$ & bn!1 & & bn!2 & u(t) & ! & b1 & %

bn!2 b1 # x(t) \$

## Observable canonical form

Exercise: Show that both the controllable and the observable canonical forms are realizations of G(s)

5.31

## Uncontrollable and unobservable systems

" !1 1 % x(t) + ! 1 \$ u(t), ! x(t) = \$ ' # & # 0 1 & " 0 % y(t) = ! 1 0 # x(t) " \$
" !1 0 % ! 1 \$ ! x(t) = \$ ' x(t) + # & u(t), # 1 1 & " 0 % y(t) = ! 1 0 # x(t) " \$

## 1. In both cases transfer function G(s) = 2. 3. 4. 5.

1 s +1

! x(t) Same as = !x(t) + u(t), y(t) = x(t) !R Exercise: Show points 1-5 Original state space system unstable Transfer function poles have negative real parts! Pole-zero cancellation of term corresponding to uncontrollable/unobservable part 6. Can be shown in general using Kalman decomposition
5.32

In summary
Transfer function alternative system description to state space Closely related, not equivalent Advantages
+ + + + +

Coordinate independent Easier to manipulate for system composition Easier to compute response to complicated inputs Immediate connection to steady state sinusoidal response May also work for systems that do not have state space description (e.g. delay elements) Less natural in terms of physical laws Used mostly for ZSR May contain less information than state space description Unobservable and uncontrollable parts lost

5.33

Signal- und Systemtheorie II D-ITET, Semester 4 Notes 6: Discrete time LTI systems
John Lygeros
Automatic Control Laboratory, ETH Zrich
www.control.ethz.ch

## Sampled Data Systems

Computers operate on bit streams Value and time quantization
1. Variables can take nitely many values 2. Operations performed at xed clock period

6.2

## Sampled Data Systems

In embedded computational systems digital computer has to interact with analog environment.
Measurements of physical quantities processed by computers Decisions of computer applied to physical system

Requires transformation of real valued signals of real time to discrete valued signals of discrete time and vice-versa
Analog to digital conversion (A/D or ADC) Digital to analog conversion (D/A or DAC)

6.3

## Sampled Data Systems

Usually value quantization is quite accurate. Here we ignore value quantization, we concentrate on time quantization. Assume:
ADCsample every T DACzero order hold

6.4

COMPUTER

Z.O.H SYSTEM

6.5

## Sampled Data Linear Systems

How does linear system with sampling and zero order hold look like from computer? n"m n"n x(t) = Ax(t) + Bu(t) A !! B !! ! y(t) = Cx(t) + Du(t) C !! p"n D !! p"m u(t) = uk for all t ![kT ,(k + 1)T ) yk = y(kT ) t For ![kT ,(k + 1)T )

x(t) = e

A(t!kT )

kT

6.6

## Sampled Data Linear Systems

# (k +1)T e A((k +1)T !! ) Bd! % u x (k + 1)T = e x(kT ) + " \$ kT & k AT # T e A(T !! ) Bd! % u = e x(kT ) + " \$ 0 & k
AT

## y(kT ) = Cx(kT ) + Du(kT )

Exercise: Show that

(k +1)T

kT

A((k +1)T !! )

0
T

AT 0

C = C, D = D
6.7

## Discrete Time Linear Systems

Solution: Given x0 !R n and uk !R m , k = 0,2,, N !1 solution consists of two sequences xk !R n ,k = 0,1,, N p and yk !R , k = 0,1,, N such that:

6.8

## Solution of Discrete Time Linear Systems

xk = A x0 + " A
k i=0

k !1

k !i!1

Bui
Exercise: Prove this by induction

ZIT

ZST

## ZST: Discrete time convolution of Input State impulse response

6.9

Computation of solution
Hard part is computation of (c.f. ) If matrix is diagonalizable
" ! k ... 0 \$ 1 !k = \$ ! " ! \$ 0 ... !nk \$ # % ' ' ' ' &

Definition: The system is called stable if for all > 0 there exists > 0 such that x0 ! ! ! xk ! ! for all k = 0,1, It is called asymptotically stable if in addition lim k!" xk = 0 . A system that is not stable is called unstable. 6.10

## Stability, diagonalizable matrices

If matrix diagonalizable, Ak linear combination of
!i

= ! i j! i , !i = ! i2 + ! i2

## Exercise: Show that if

!i, Re !!1 # < 0 then " \$

A is diagonalizable and
A = e AT

## is diagonalizable and !i, !i < 0 .

Theorem 6.1: System with diagonalizable A matrix is: Stable if and only if

!i !i ! 1

!i !i < 1
6.11

!i : !i > 1

## Stability, non-diagonalizable matrices

Theorem 6.2: The system is: Asymptotically stable if and only if !i !i < 1 Unstable if !i : !i > 1 As before, eigenvalues not enough to determine stability Case may be either stable, or unstable !i !i ! 1 depending on repetition pa^ern of eigenvalues with (determined by eigenvectors) !i = 1 The analogy to continuous time systems is not always perfect however!

6.12

Assume all eigenvalues of A are zero: Then for some (nilpotent matrix) Example: In general proved using Jordan form x Then k = Ak x0 = 0 for all k ! N ZIT gets to 0 in nite time and stays there. This never happens with continuous time systems.
6.13

Coordinate change
xk = Txk Assume for some invertible !R n"n T In the new coordinates system dynamics are again linear time invariant

xk +1 = Axk + Buk y = Cx + Du
k k k

## Exercise: Show this

with

A = TAT !1 , B = TB = CT !1 , D = D C
6.14

## Energy and Power

Consider energy like function: Power: change of energy in time

If (autonomous system)

6.15

## Stability and Energy

If then energy Exercise: Show that R=RT decreases all the time Natural to assume that system is stable Theorem 6.3: for all i=1, 2, , n if and only if for all the equation has a unique solution with .

6.16

Controllability
System is controllable if we can steer it from any n xN 0 !R n initial condition to any nal condition !R x using appropriate sequence Assume ! n N Dene again controllability matrix

P = [B

AB

A B! A

n!1

B] !R

n!nm

## Exercise: Prove this

6.17

Observability
System is observable if we can infer the state evolution by observing the input and output sequences N Assume ! n !1 " C % \$ ' Dene again \$ CA ' (R np!n Q= observability \$ ! ' \$ matrix n!1 ' # CA & Theorem 6.5: The system is observable if and only if Q has rank n.
Exercise: Prove this 6.18

z Transform
Time function fk converts to a complex variable function F(z) F :C! C f :N! R " Z !k !!!! " F (z) = Z f k = fk z f k #!! F (z) !1 Z k =0 As before we assume that fk=0 for all k<0 (unlike SSI) Can also be dened for matrix valued functions by taking sum element by element can be thought of as unit time delay z !C

{ } #

fk

f k +1
6.19

z Transform: Properties
Assumption: The function fk is such that the sum converges

## Z Linearity a1 f k + a2 g k = a1F(z) + a2G(z)

Z Time shift f k !k0 = z

Z Convolution ( f * g) k = Z
Some common functions:

{ }
{

! k0

F (z)

{!

k i=0

f i g k !i = F (z)G(z)
(! 0 = 1, ! k = 0 if k ! 0)

## Exercise: Prove these

{! } = 1 z Z Step function {1 } = z !1
Z Impulse function
k

Geometric progression Z

{a }
k

## (1k = 1 k ! 0,1k = 0 k < 0)

z = z!a

( a < 1)
6.20

Transfer function
Assume Take z transform of all signals

Y (z) = "C zI ! A \$ #

!1

## B + D %U (z) ' &

Transfer Function
Exercise: Show that the transfer function is z-transform of impulse response (appropriately dened!) 6.21

Transfer function
G(z) = C zI ! A

!1

B+D

Rational function of z. System asymptotically stable Poles of G(z) have magnitude less than 1 If system uncontrollable/unobservable pole zero cancellations.
6.22

Simulation
Simulation: Numerical solution in computer Simulation of discrete time systems (linear or non-linear) is very easy conceptually Discrete time systems can also help understand the simulation of continuous time systems Consider continuous time, LTI system

## ! x(t) = Ax(t) + Bu(t)

x0 !R n , u() : [0,T ] " ! m Given solution is x() : [0,T ] ! ! n , with t At x(t) = e (t) x0 + " e A(t!! ) Bu(! ) d !
0

6.23

## Example: RLC circuit (p. 3.22)

R
+

L
C
! # 0 d ! vC (t) \$ # # &= dt # iL (t) & # 1 " % # ! " L 1 C R ! L \$ & ! v (t) \$ ! 0 \$ &# C & + # 1 & vs (t) & & # iL (t) & # % # L & &" " % %

vs (t )

Solution depends on eigenvalues and eigenvectors Determined by R, L, C Consider autonomous case vs(t)=0 for all t

6.24

For example
w1 w2

## R=3W, L=1H, C=0.005F

!2 = !2 < !1 = !1 < 0

!i = !1.5 14.06 j
6.25

For example

## R=0W, L=1H, C=0.005F

!i = 14.14 j
6.26

Simulation

Exact solution

Approximation

6.27

Numerical approximation
Approximate the solution with a sequence Divide the interval in N equal subintervals Let Simulation step We approximate

## ! x((k + 1)! ) ! x(k! ) + ! x(k! ) = x(k! ) + ! (Ax(k! ) + Bu(k! ))

x So we set 0 = x(0) = x0 , xk = x(k! ), uk = u(k! )

xk +1 = (I + A! )xk + ! Buk
6.28

Numerical approximation
Integration using Euler method First order approximation of the equation
6.29

## Zero input response

Consider autonomous system Solution is

6.30

## Stability of numerical approximation

How small should the step be? If the eigenvalues of A have negative real part, then system asymptotically stable and At the very least we would like to guarantee that the numerical approximation is such that Eigenvalue Assume A diagonalizable
matrix (diagonal)

6.31

## Stability of numerical approximation

Then
Exercise: Prove this

Discrete time system asymptotically stable if and x only if k ! 0 "x0 #R n \$ 1+ !i" < 1 "i = 1,,n For example, if i are real and negative

2 !< max | !i |
i=1,,n

! = 0.01

! = 0.05

6.33

## RLC circuit with R=3W, L=1H, C=0.5F

Exact solution Numerical approximation Instability!

! = 0.25

! = 1.25

## !1 = !1, !2 = !2 " " < 1 for stability

6.34

Simulation
Simple rst order approximation known as forward Euler method Another approach is backward Euler

## ! x = Ax ! xk +1 " xk + ! Axk +1 ! xk +1 " (I # ! A) #1 xk

Care also needed when selecting step
Much be^er methods than Euler exist

E.g. Runge-Ku^a, variable step, high order Specialized methods for sti systems, hybrid systems, dierential-algebraic systems, etc. Coded in robust numerical tools such as Matlab 6.35

## Signal- und Systemtheorie II D-ITET, Semester 4 Notes 7: Nonlinear systems

John Lygeros
Automatic Control Laboratory, ETH Zrich
www.control.ethz.ch

Nonlinear systems
Most of this course: Dynamical systems modeled by linear dierential equations in state space form

## Concentrate on continuous time Discrete time can be more complicated

E.g. the Population Dynamics example in Notes 1 is one dimensional but can be chaotic

7.2

Nonlinear systems
More general than linear system, hence more dicult Concentrate on autonomous, time invariant systems

! x(t) = f (x(t))

## Assume function f is LipschiP

#R n , !! > 0,"x, x

f (x) \$ f ( x ) % ! x \$ x

This implies existence and uniqueness of solutions In general solution cannot be computed analytically Simulation methods applicable however Look into the following issues
Invariant sets Stability of invariant sets

7.3

Invariant sets
Generalization of notion of equilibrium Definition: A set of states S ! R n is called invariant if ! x(t) = f (x(t)) x(t) means the solution to starting at x0 Equilibrium points are an important class of invariant sets Definition: A state x !R n is called an equilibrium if

f ( x) = 0

## x Exercise: Prove that if is S= x an equilibrium then is an invariant set

{}
7.4

Equilibria
Linear systems have a linear subspace of equilibria

Nonlinear systems can have many isolated equilibria Example: The pendulum from Notes 1 has 2 equilibria

## Sometimes only = 0 x More generally, the null space of the matrix A

Exercise: Show that the ! x(t) = Ax(t) equilibria of coincide with the null space of A

" % x2 (t) " ! % Exercise: " 0 % \$ ' ! x(t) = \$ d ' Show this ', x ' = \$ '(x=\$ g # 0 & # 0 & \$ ! m x2 (t) ! l sin x1 (t) ' # & (More precisely, number of pendulum equilibria is innite, but they all coincide physically with these two) 7.5

## Pendulum for d=0

x Exercise: Let k +1 = f (xk ) be a nonlinear system in discrete time (cf. p.1.27). The equilibria for this system are given by

x = f ( x)

7.6

## Shifting equilibria to the origin

It is often convenient to shift an equilibrium to the origin before analyzing the system behavior This involves a change of coordinates

## w(t) = x(t) ! x "R n

In the new coordinates the system becomes

## ! ! w(t) = x(t) = f (x(t)) = f (w(t) + x ) = f (w(t))

The system in the new coordinates has an equilibrium at = 0 !R n w
Exercise: Show this

7.7

Limit cycles
Observed only in systems of dimension 2 or more Definition: A solution x(t) is called a periodic orbit if

## !T > 0,!t ! 0, x(t + T ) = x(t)

Equilibria dene trivial periodic orbits Exercise: Show that Limit cycles: Non-trivial periodic orbits solution starting at an equilibrium is Linear systems exhibit either
Trivial periodic orbits (equilibria) Subspaces of periodic orbits, e.g. periodic

Nonlinear systems can also have non-trivial, isolated periodic orbits Limit cycles 7.8

## Example: Van der Pol oscillator

Developed as a model for dynamics of vacuum tube (transistor) circuits Under certain conditions circuits observed to oscillate Van der Pol showed this is due to nonlinear resistance phenomena Second order dierential equation

## !!(t) ! ! (1! ! (t) 2 )! (t) + ! (t) = 0 ! !

Exercise: Write the equation for the van der Pol oscillator in state space form. Hence determine its equilibria.

7.9

## Example: van der Pol oscillator, =1

Stable limit cycle Exercise: Let be a xk +1 = f (xk ) nonlinear system in discrete time. How would you dene periodic orbits and limit cycles for this system? (cf. p.1.28). Unstable equilibrium 7.10

Strange aGractors
In 2D continuous time equilibria & limit cycles as bad as it gets (Poincare-Bendixson Theorem) In higher dimensions stranger things may happen
Invariant tori Chaotic aeractors

## Example: Lorenz equations

Developed by E.N. Lorenz To capture atmospheric phenomena

! x1 (t) = a(x2 (t) ! x1 (t)) ! x2 (t) = (1+ b)x1 (t) ! x2 (t) ! x1 (t)x3 (t) ! x3 (t) = x1 (t)x2 (t) ! cx3 (t)
E.N. Lorenz 1917-2008

7.11

Chaotic aGractor
For some parameter values, there is a bounded subset of the state space such that if we start inside we stay there for ever and
Trajectories starting (almost) anywhere go around for ever, Without ever meeting themselves (not limit cycles)

Given any two points in this set we can nd a trajectory that starts arbitrarily close to one and ends up arbitrarily close to the other This set is called a chaotic or strange aeractor
Exercise: Compute the equilibria of the Lorenz equations Exercise: Simulate the Lorenz equations for a=10, b=24, c=2, and x0=(-5, -6, 20)

7.12

## Lorenz aGractor simulation

7.13

Stability
Most commonly studied property of invariant sets Trajectories stay close or converge to invariant set Restrict aeention to equilibria Simple characterization for LTI and equilibrium = 0 x
Systems stable if eigenvalues of A have negative real part Poles of transfer function are in left half of complex plane

Definition: An equilibrium x is called stable if for all > 0 there exists > 0 such that

## x0 ! x < ! ! x(t) ! x < ! !t ! 0

Otherwise equilibrium called unstable.

Exercise: Which of the equilibria of the pendulum (simulation p. 7.6) would you say are stable and which not?

7.14

Asymptotic stability
Stability says that if we start close we stay close Do we get closer and closer?

Definition: An equilibrium x is called locally asymptotically stable if it is stable and there exists M > 0 such that

## x0 ! x < M " lim x(t) = x

t#\$

It is called globally asymptotically stable if this holds for any M >0. The set of x0 such that lim x(t) = x is called the domain of attraction t!" of x
Exercise: What is the domain of aeraction of a globally asymptotically stable equilibrium? Exercise: Is there a dierence between local and global asymptotic stability for linear systems?

7.15

## Example: Pendulum with d>0

Exercise: Which of the equilibria would you say are locally asymptotically stable? Which globally?

7.16

Linearization
Simple way to study stability of equilibrium of nonlinear system is to approximate by linear system ! x(t) = f (x(t)), f ( x ) = 0 x equilibrium x Take Taylor expansion about

## f (x) = f ( x ) + A(x ! x ) + higher order terms in (x ! x ) = A(x ! x ) + higher order terms in (x ! x )

! ! x \$ # # 1 & x = # ! & , f (x) = # # # x & # # n & " % " ! # \$ f1 (x1 ,, xn ) # & # &, A = # ! f n (x1 ,, xn ) & # & % # # " \$ 'f1 'f1 ( x) ! ( x) & 'x1 'xn & & ! " ! (R n)n & 'f n 'f n & ( x) ! ( x) & 'x1 'xn & % 7.17

Linearization
Consider distance of x to equilibrium x(t) = x(t) ! x "R n ! When x close to equilibrium, x is small and

d! x(t) ! A! x(t) dt
So close to equilibrium nonlinear system expected to behave like a linear system In particular, stability of the linearization should tell us something about stability of nonlinear system Stability of linearization can be determined just by looking at the eigenvalues of A 7.18

Stability by linearization
Theorem 7.1: The equilibrium x is 1. Locally asymptotically stable if the eigenvalues of the linearization have negative real part 2. Unstable if the linearization has at least one eigenvalue with positive real part
Called Lyapunov rst or Lyapunov indirect method Advantage: Very easy to use Disadvantages:
No information about the domain of aeraction Inconclusive if linearization has imaginary/zero eigenvalues

7.19

## Pendulum example, d>0

x Linearization about = (0,0) " 0 1 % d! x(t) \$ d g ' 2 =\$ g d ' ! x(t) ( ! + ! + = 0 dt m l ! ! \$ l m ' # & Eigenvalues have negative real part, hence equilibrium locally asymptotically stable x Linearization about = (! ,0) " 0 1 % d! x(t) \$ d g ' 2 =\$ g d ' ! x(t) ( ! + ! ! = 0 dt m l ! \$ l m ' # & At least one eigenvalue has positive real part, hence equilibrium unstable
7.20

## Linearization can be inconclusive

Notice that if d=0

x = (! ,0) Linearization about has positive eigenvalue x = (! ,0) Hence is unstable for nonlinear system x = (0,0) Linearization about has imaginary eigenvalues x = (0,0) Stability of not determined from Theorem 7.1

It turns out that equilibrium is stable (see g. on p.7.6) This is not always the case For example, the linearization of both

## ! = x(t)3 and x(t)

! = !x(t)3 x(t)

about has one eigenvalue at zero x=0 But 0 stable for one system and unstable for the other
7.21

Lyapunov functions
In linear systems stability characterized in two ways
Eigenvalues of matrix A (Theorems 3.1, 3.2), or poles of the transfer function (p.5.19) Existence of decreasing energy-like function (Theorem 4.1)

First applies to nonlinear systems, how about second? Properties of energy-like function for linear systems
1 T x Qx 2

## x 4. R = ( A Q + QA) positive denite V(x) decreases for all ! 0

For nonlinear systems keep 2 and 4, but allow more general (non-quadratic) V(x) 7.22

## Lyapunov functions: Stability

Theorem 7.2: Assume there exists an open set S ! R n with x S and a differentiable function V (i) : R n ! R 1. V ( x ) = 0 2. V (x) > 0, !x "S with x # x d 3. V (x(t)) ! 0, "x #S dt Then the equilibrium x is stable Called Lyapunov second or Lyapunov direct method Function V(x) known as Lyapunov function Derivative along trajectories known as Lie derivative
n n d !V d !V V (x(t)) = " (x(t)) xi (t) = " (x(t)) f i (x(t)) = #V (x(t)) f (x(t)) dt dt i=1 !xi i=1 !xi

7.23

Proof: By picture!
Sc = x !S |V (x) ! c

7.24

## Example: Pendulum for d=0

Recall that linearization could not determine the x = (0, 0) stability of when d=0 Consider the energy 1 ! 2 + mgl (1! cos(! )) V (x) = m l! 2 l 1 2 2 = ml x2 + mgl (1! cos(x1 )) 2 S = (!! , ! ) ! R Take check theorem conditions m 1. V (0) = 0 mg 2. V > 0 !x ! 0 (x) d 3. (x(t)) = ml 2 x (t) x (t) + mgl sin(x (t)) x (t) = 0 !2 !1 V 2 1 dt

( )

## Lyapunov functions: Asymptotic stability

Theorem 7.3: Assume there exists an open set S ! R n with x !S and a differentiable function V (i) : R n ! R 1. V ( x ) = 0 2. V (x) > 0, !x "S with x # x d 3. V (x(t)) < 0, !x "S with x # x dt Then the equilibrium x is locally asymptotically stable. If S = R n then it is globally asymptotically stable. Lyapunov functions can help estimate domain of aeraction. If we can nd c > 0 such that x !R n |V (x) " c # S then trajectories that start in this set stay in it and x converge to

7.26

Examples
Consider rst ! x(t) = f (x(t)) = !x(t)3 where x = 0 S Let = R, V (x) = x 2 # Clearly (0) = 0,V (x) > 0 !x " 0, V (x) f (x) = \$2x 4 < 0 !x " 0 V #x Therefore 0 is globally asymptotically stable How about pendulum with d > 0 S = (!! , ! ) ! R As before consider and V(x) the energy
d ! ! V (x(t)) = ml 2 x2 (t) x2 (t) + mgl sin(x1 (t)) x1 (t) = !dl 2 x2 (t) 2 " 0 dt x = (0,0) But =0 whenever x2(t)=0 (not only at ), therefore cannot conclude local asymptotic stability

7.27

La Salles Theorem
Theorem 7.4: Assume there exists a compact invariant set S ! R n and a differentiable function V (i) : R n ! R such that !V (x) f (x) " 0 #x \$S Let M be the largest invariant set contained in the set
S = x !S "V (x) f (x) = 0 # R n

Then all trajectories starting in S tend to M as t ! " Compact means bounded and closed x If only invariant set in x !S !V (x) f (x) = 0 then all trajectories starting in S tend to it

7.28

## Energy when pendulum stopped upside down

S Take V(x) the energy and = x !R 2 |V (x) ! 2mgl ! ! for any > 0 Recall that Exercise: Show & that S is invariant \$x %S 2 2( #0 !V (x) f (x) = "dl x2 ' ( = 0 when x2 = 0 ) x = (0,0) is the only invariant set contained in ! S = { x !S | x2 = 0} (since x2 ! 0 if x2 = 0 but x1 ! 0) x Therefore all trajectories that start in S tend to = (0, 0) By Theorem 7.2 is stable x = (0, 0) Hence, by Theorem 7.4, locally asymptotically stable Moreover, since e is arbitrary, the domain of aeraction of (0,0) contains everything except the other equilibrium , 0) (

7.29