State space model: linear: or in some text: where: u: input y: output x: state vector A, B, C, D are const matrices ) , ( : eq Output ) , ( : eq State u x h y u x f x Du Cx y Bu Ax x Ju Hx y Gu Fx x
Jan 21, 2016
State space model:
linear:
or in some text:
where: u: input y: output x: state vectorA, B, C, D are const matrices
),( :eqOutput
),( :eq State
uxhy
uxfx
DuCxy
BuAxx
JuHxy
GuFxx
Example
xy
uxx
31
1
0
32
10
1
0,
32
10
31,0
BA
CD
23
13
2)3(
13
131
2)3(
1
1
2)3(
131
1
0
2
13
2)3(
131
1
0
32
131
1
0
32
10
10
01310
)()(
2
1
1
1
ss
s
ss
s
sss
sss
s
s
ss
s
s
s
BAsICDsH
State transition, matrix exponential
)0(
:solution
:sHomogeniou
:caseScaler
xex(t)
axx
buaxx
at
matrixn transitiostate theiscalled
)0(
linearityby ),0(
:solution
:sHomogeniou
:caseMatrix
At
At
e
xex(t)
xx(t)
Axx
BuAxx
State transition matrix: eAt
• eAt is an nxn matrix • eAt =ℒ-1((sI-A)-1), or ℒ (eAt)=(sI-A)-1
• eAt= AeAt= eAtA
• eAt is invertible: (eAt)-1= e(-A)t
• eA0=I• eAt1 eAt2= eA(t1+t2)
dt
d
...!
1...
!3
1
!2
1
)0( :solution
3322
nnAt
At
tAn
tAtAAtIe
xex(t)
Axx
Example
)(222
2
2
2
1
1
2
2
1
22
1
1
1
2
1
1
2
)2)(1()2)(1(
2)2)(1(
1
)2)(1(
3
2
13
2)3(
1)(
32
1,
32
10
22
22
1
tueeee
eeeee
ssss
ssss
ss
s
ss
ssss
s
s
s
ssAsI
s
sAsIA
stttt
ttttAt
I/O model to state space• Infinite many solutions, all equivalent.
• Controller canonical form:
1 1
1 1 0 1 1 01 1
0 1 1
0 1 1
0 1 0 0 0
0 0 1 0 0
0
0 0 0 1 0
1
[0]
n n n
n nn n n
n
n
d d d d dy a y a y a y b u b u b u
dt dt dt dt dt
x x u
a a a
y b b b x u
I/O model to state space• Controller canonical form is not unique
• This is also controller canonical form
1
1 1 01
1
1 1 01
1 2 1 0
1 2 1 0
1
1 0 0 0 0
0
0 1 0 0 0
0 0 1 0 0
[0]
n n
nn n
n
n n
n n
n n
d d dy a y a y a y
dt dt dtd d
b u b u b udt dta a a a
x x u
y b b b b x u
Example
t
trydydt
dy
dt
yd
dt
yd02
2
3
3
)(235
dt
dry
dt
dy
dt
yd
dt
yd
dt
yd
dt
d 235:
2
2
3
3
4
4
n=4 a3 a2 a1 a0 b1 b0=b2=b3=0
xy
uxx
0010
1
0
0
0
5312
1000
0100
0010
Characteristic values• Char. eq of a system is
det(sI-A)=0the polynomial det(sI-A) is called char. pol.the roots of char. eq. are char. valuesthey are also the eigen-values of A
e.g.
∴ (s+1)(s+2)2 is the char. pol. (s+1)(s+2)2=0 is the char. eq.
s1=-1,s2=-2,s3=-2 are char. values or eigenvalues
uxx
0
1
0
200
120
001
2)2)(1(
200
120
001
det)det(
ss
s
s
s
AsI
2
100
)2(
1
2
10
001
1
)2)(1(00
1)2)(1(0
00)2(
)2)(1(
1)(
2
2
21
s
ss
s
ss
sss
s
ssAsI
)(00
)()(0
00)(
) (
2
22
1
tue
tutetue
tue
e
sts
ts
ts
t
At L
can At
t
t
ee
e
10
0
Set t=0 22I00
01
∴No
canAt
tt
t
eete
e
0
at t=0:
10
01
11
01 yes,
0
11
01
0
A
ete
e
etee
e
dt
d
tt
t
ttt
t
?
?
?
√
√
Solution of state space model
Recall: sX(s)-x(0)=AX(s)+BU(s)
(sI-A)X(s)=BU(s)+x(0)
X(s)=(sI-A)-1BU(s)+(sI-A)-1x(0)
x(t)=(ℒ-1(sI-A)-1))*Bu(t)+ ℒ-1(sI-A)-1) x(0)
x(t)= eA(t-τ)Bu(τ)d τ+eAtx(0)
y(t)= CeA(t-τ)Bu(τ)d τ+CeAtx(0)+Du(t)
DuCxy
BuAxx
t
0
t
0
But don’t use those for hand calculation
use:X(s)=(sI-A)-1BU(s)+(sI-A)-1x(0)
x(t)=ℒ-1{(sI-A)-1BU(s)}+{ℒ-1 (sI-A)-1} x(0)
& Y(s)=C(sI-A)-1BU(s)+DU(s)+C(sI-A)-1x(0)
y(t)= ℒ-1{C(sI-A)-1BU(s)+DU(s)}+C{ℒ-1 (sI-A)-1} x(0)
e.g.
xy
uxx
01
,0
1
20
01 If u= unit step
1
0)0(x
2
11
11
2
1
1
1
1
1
0
2
10
01
11
0
1
2
10
01
1
)(
s
ss
s
ss
s
ss
s
ssX
)(
)()()(
2 tue
tuetutx
t
t
1
11
10
2
11
11
01
)()()(
ss
ss
ss
sDUsCXsY
)()()( tuetuty t
Note: T.F.=D+ C(sI-A)-1B
1
1
0
1
2
10
01
1
010
s
s
s
Eigenvalues, eigenvectors
Given a nxn square matrix A, nonzero vector p is called an eigenvector of A if Ap p∝
i.e. λ s.t. Ap= λpλ is an eigenvalue of A
Example: ,
Let ,
∴p1 is an e-vector, & the e-value=1
Let ,
∴p2 is also an e-vector, assoc. with the λ =-2
20
01A
0
11p 11 0
1
0
1
20
01pAp
1
02p
1
02
2
0
1
0
20
012Ap
• For a given nxn matrix A, if λ, p is an eigen-pair, thenAp= λp λp-Ap=0 λIp-Ap=0 (λI-A)p=0
∵ p≠0 det(∴ λI-A)=0 ∴ λ is a solution to the char. eq of A: det(λI-A)=0
• char. pol. of nxn A has deg=n ∴ A has n eigen-values.e.g. A= , det(λI-A)=(λ-1)(λ+2)=0
⇒ λ1=1, λ2=-2
20
01
Eigenvalues, eigenvectors
• If λ1 ≠λ2 ≠λ3⋯then the corresponding p1, p2, will be ⋯linearly independent, i.e., the matrix
P=[p1 p⋮ 2 p⋮ ⋯ n] will be invertible.Then:
Ap1= λ1p1
Ap2= λ2p2
⋮A[p1 p⋮ 2 ]=[Ap⋮ ⋯ 1 Ap⋮ 2 ]⋮ ⋯
=[λ1p1 ⋮ λ2p2 ]⋮ ⋯
=[p1 p2 ]⋯
0
0
0
0
2
1
∴ AP=PΛ P-1AP= Λ=diag(λ1, λ2, ⋯)
∴If A has n linearly independent Eigenvectors, then A can be diagonalized.
Note: Not all square matrices can be diagonalized.
Example
ks wor1
1
0
0
312
11
0)(or
:1for
2,1
0)2)(1(
232)3(32
1det)det(
32
10
12
111
12
11
11
111111
21
2
P
PP
P
P
PAI
IPPAP
AI
A
11
12
11
12
12
1
21
11
21
11
ks wor2
1
0
0
322
12
0)( :2for
1
1
21
2
2
222
P
PPP
P
P
PAI
),(diag0
0
20
01
21
11
22
12
21
11
32
10
11
12
212
1
1
APP
121
211
),(diag
),(diag
PPA
APP
In Matlab
>> A=[2 0 1; 0 2 1; 1 1 4];
>> [P,D]=eig(A)
P = 0.6280 0.7071 0.3251 0.6280 -0.7071 0.3251 -0.4597 -0.0000 0.8881
p1 p2 p3
D = 1.2679 0 0 0 2.0000 0 0 0 4.7321
λ1
λ2
λ3
If A does not have n linearly independent eigen-vectors(some of the eigenvalues are identical),then A can not be diagonalized
E.g. A=
det(λI-A)= λ4+56λ3+1152λ2+10240λ+32768
λ1=-8λ2=-16λ3=-16λ4=-16
by solving (λI-A)P=0
99149
31163
44244
44812
,
0
1
0
1
1
p
2
0
1
0
2p
There are only two linearly independent eigen-vectors
>> A=[-12 8 -4 -4; 4 -24 4 4; -3 -6 -11 3; 9 -14 9 -9]A = -12 8 -4 -4 4 -24 4 4 -3 -6 -11 3 9 -14 9 -9>> [P,D]=eig(A)P = -0.7071 0.0000 + 0.0000i 0.0000 - 0.0000i 0.0000 -0.0000 0.4472 - 0.0000i 0.4472 + 0.0000i -0.4472 0.7071 -0.0000 + 0.0000i -0.0000 - 0.0000i -0.0000 -0.0000 0.8944 0.8944 -0.8944 D = -8.0000 0 0 0 0 -16.0000 + 0.0000i 0 0 0 0 -16.0000 - 0.0000i 0 0 0 0 -16.0000
Should use: >>[P,J]=jordan(A)P =
0.3750 0 1 0.625 0 8 4 0 -0.375 0 0 0.375 0 16 9 0
J=
-8 0 0 0 0 -16 1 0 0 0 -16 1 0 0 0 -16
a 3x3 Jordan block associated with λ=-16
More Matlab Examples
>> s=sym('s');>> A=[0 1;-2 -3];>> det(s*eye(2)-A) ans = s^2+3*s+2 >> factor(ans)ans =(s+2)*(s+1)
22
I
>> [P,D]=eig(A)P = 0.7071 -0.4472 -0.7071 0.8944
D = -1 0 0 -2
>> [P,D]=jordan(A)P = 2 -1 -2 2
D = -1 0 0 -2
2,1 21
2
1
toscale
8944.0
4472.0
1
1
toscale
7071.0
7071.0
2
2
1
1
P
P
P
P
A = 0 1 -2 -3
>> exp(A)ans = 1.0000 2.7183 0.1353 0.0498
>> expm(A)ans = 0.6004 0.2325 -0.4651 -0.0972
>> t=sym('t') >> expm(A*t) ans = [ -exp(-2*t)+2*exp(-t), exp(-t)-exp(-2*t)][ -2*exp(-t)+2*exp(-2*t), 2*exp(-2*t)-exp(-t)]
32
10
ee
ee
32
10
e
At
tttt
tttt
eeeee
eeee
22
22
222
2
≠
tttt
tttt
tt
tt
tt
tt
tttt
At
tttt
ttttAt
eeee
eeee
ee
ee
ee
eeeeee
e
eeee
eeeee
dt
d
22
22
2
2
2
2
22
22
22
442
222
)}2(3
)(2{
)}22(3
)2(2{222
)(32
10
442
222)(
10
01
1222
1121 :0 t:check √
√
Similarity transformation
DDCPCBPBAPPA
uDxCy
DuxCPy
uBxAx
BuPxAPPx
BuxAPxP
xPxxPx
DuCxy
BuAxx
,,,
,let weIf
)(#
11
11
same
system
as(#)
Example
21
22
11
2
22
12
2
1
20
01
22
12,let
01
1
0
32
10
xxy
uxx
uxx
xy
uxx
PxPx
xy
uxx
diagonalized
decoupled
Invariance:
changednot seigenvalue & valueschar.
sformationafter tran changednot eq. char.or poly char.
)det(
)det()det()det(
))(det(
)det(
)det()det(
1
1
11
1
AsI
PAsIP
PAsIP
APPPsP
APPsIAsI
changed rseigenvectoBut
))((
)(
)(
)()(
])([
)(
)(
)()(
:functionTransfer
111
1
11111
111
1111
111
1
ABAB
sH
BAsICD
BPPAsICPPD
BPPAsIPCPD
BPAPPPsPCPD
BPAPPsICPD
BAsICDsH