### Lecture 12 - University of Toledo

```D
u
S
-1

S
S
c1
c2
z1

…
…
z2
a1
a2
S
S

S
S
cn-1
cn
zn-1
an-1
…
S
Professor Walter W. Olson
Department of Mechanical, Industrial and Manufacturing Engineering
University of Toledo
System Solutions

zn
an
y
Outline of Today’s Lecture
 Review
 Convolution Equation
 Impulse Response
 Step Response
 Frequency Response
 Linearization
 Reachability
 Testing for Reachability
Transformations
 We can transform our state space representation to other
state variables (different that the ones in use).
 Mathematically, this is called a change of basis vectors.
 Why would we ant to do this?
 To make the problem easier to solve!
 To isolate a particular property of the system
 To uncouple the modes of the system
Transformations
 Say we have some matrix T that is invertible (this is important)
which results in the vector z when x is premultiplied by T. We
then say that we have transformed the vector x into z, or
alternatively, we have transformed x into z:
 x1 
 t1 1
 

z  T x w here x  ... , T is ...
 

 x n 
 t n 1
xT
1
T hen
T
d
d
x
1
...
T
1
 z1 
 
exists, an d z  ...
 
 z n 
z  T ( Ax  Bu )  TAx  TBu  TAT
dt
z  Du
L et A  T A T
d
...
t1 n 

... ,

t n n 
z
dt
y  CT
...
1
z  Az  Bu
dt
y  Cz  Du
,
B  TB ,
and C  C T
1
. T hen
1
z  T B u and
Convolution Equation
y (t )  C e
A(t )
x (0 ) 

t
Ce
A ( t  )
B u ( ) d   D u ( t )
0
is called the “Convolution Equation”
Expresses the effect of an input on the system
 What is convolution?
 a twisting or folding together of two things
 A convolution is found in many phenomena:
 A sound that bounces off of a wall and interacts with the source
sound is a convolution
 A shadow is a convolution between the light source and the object
 In statistics, a moving average is a convolution
The Impulse Function
 Imagine a function that has a shape that is infinitesimally thin
in the independent variable but infinitely high domain or
response:
 In other words this is a very long and sharp spike
 This is what we try to model with the impulse function
 Mathematically we define the Dirac Delta Function, d(t), also
called the Impulse Function by
0

1
u ( t )  p ( t )  

 0
d ( t )  lim p  ( t )
0
t0
0t
t
System Response
u (t )  d (t )
y (t )  C e
y (t )  C e
A(t )
x (0 ) 

t
Ce
x (0 ) 
A ( t  )

t
Ce
A ( t  )
B u ( ) d   D u ( t )
0
Bd (t )d   D u (t )  C e
A(t )
x (0 )  C e
A(t )
B  D u (t )
0
If
T hen
A(t )
h (t ) 
y (t )  C e

t
Ce
A ( t  )
Bd (t )d   C e
A(t )
B
0
A(t )
x (0 ) 

t
h ( t   ) u ( ) d   D u ( t )
0
Since our system is linear and we can add solutions, we can
approximate the response as a sum of the convolutions of h(t-)d(t)
y(t)
+ + + + +…
12 345
t
System Response
S(t)
 A unit step is defined as
0
S (t )  
1
t0
1
t>0
t
 With zero initial conditions
y (t ) 

t
Ce
A ( t  )
B S ( ) d   D S ( t )
0
t
 C e
A ( t  )
Overshoot
Mp
Bd  D
0
t
 C e
A
0
1
Bd  D  C  A e
1
A
1
 CA e B  CA B  D
At
}
}
Transient
State
B
 t
 0
d
{
Rise time, tr

Transient period=settling time, ts
System Response
 Another common test function is a sinusoid for frequency
response
u ( t )  cos  t 
e
i t
e
 i t
2
 Since we have a linear system, we only need
u (t )  e
st
where s   i
and assuming that the eigenvalues A do not equal s
y ( t )  C e x (0 ) 
At

t
Ce
s
Be d  D e
At

t
e
 sI  A 
At
st
At
 x (0 )  ( sI  A )
1
1
 e  sI  A  t  I  B  D e st



B   C  sI  A 
1

BD e
st
}
}
 Ce
s
Be d  D e
0
 C e x (0 )  C e ( sI  A )
At
st
0
 C e x (0 )  C e
At
A ( t  )
Transient
State
System Response:
Frequency Response
 Time history with respect to a sinusoid:
Phase
Shift, DT
Amplitude
Ay
Amplitude
Au
Input Sin(t)
G ain 
Ay
Au
Period,T
Transient Response
P hase  2 
DT
T
System Response
Frequency Response
y (t )  C e
At
 x (0 )  ( sI  A )

y ss ( t )  C  sI  A 
1
1


B   C  sI  A 
BD e
st
i
 Me e
st
1
 Me

B D e
i  st
M is the magnitude and  is the phase
G ain 
Ay
 M
Au
1
D C G ain  M 0   C A B  D
P hase  2 
DT

T
y ss ( t )  M cos(  t   )
st
Linearization
 Good solutions for the Linear Model
 Equally good techniques for the Nonlinear Model are not
easy to come by
 What if the Nonlinear Model is well enough behaved in the
region of interest so that we could apply Linear techniques
strictly to that region?
 We did this with the inverted pendulum!
 We assumed small angles!
Linearization Techniques
 Ignore the nonlinearity
 In some cases, the nonlinearity has a relatively small effect
 In those cases, build a linear system and treat the nonlinearity as a
disturbance
 Small angle approximations sin   
cos   1
 Often only useful near equilibrium points
 Taylor Series Truncation about an operating point
0
f ( x  a )  f (a )  x
df ( a )
dx

1
2
2
x
2
d f (a )
dx
2
 ...
 Assumes that 2nd and higher orders are negligible
 Feedback linearization
Reachability
 Consider the following problem:
 With the linkage below, can you control the position of p?
y
y’
yp
x’
u(t)
x
p
Reachability
 We define reachability (often times called controllability) by the
following:
 A state in a system is reachable if for any valid states of the system,
say, initial state at time t=0, x0 , and a state xf , there exists a solution
for t>0 such that x(0) = x0 and x(t)=xf.
 There are systems which we can not control
 the states are not reachable with our input.
 There in designing control systems, it is important to know if the
system is controllable.
 This is closely linked with the concept of ergodicity of the system
in which we ask the question whether or not it is possible to with
some measure of our system to measure every possible state of the
system.
Reachability Testing
d
x  Ax  Bu
and y  C x  D u w here x (0 )  0 and D  0
dt
x (t ) 

t
e
A ( t  )
0
B u   d 
Im pulse response is x d 

t
e
A ( t  )
0
B d   d   e B
At
T he response to the rate of change in th e im pulse response is
xd 
dx d
 Ae B 
At
dt
for u ( t )   1d  t    d  t  , the response w ould then be x ( t )   1 e B   2 A e B
At
C ontinuing the process through further d erivatives, w e get for
u ( t )   1d  t    2 d  t    3 d  t    4 d
( n  1)
 t   ...   n d  t 
x ( t )   1 e B   2 A e B   3 A e B   4 A e B  ...   n A
At
At
2
At
3
At
lim x ( t )   1 B   2 A B   3 A B   4 A B  ...   n A
2
t 0
lim x ( t )   B
t 0
W r   B
AB
AB
A
A
n 1
n 1
3
n 1
n 1
B
B  
B  is called the reachability m atrix
At
e B
At
Reachability
 For the system,
d
,
x  Ax  Bu
and y  C x  D u
dt
all of the states of the system are reachable if and only if Wr is
invertible where Wr is given by
W r   B
AB
A
n 1
B 
State Space Formulation
T o p u t it in th e d esired fo rm
 Is this a reachable system?
L et z1  z , z 2  z , z 3  z u ,
z4  zu
T h en w e can w rite

 z1  z 2


 z3  z4

 m z  bz  kz  bz u  kz u

 m u z u  bz u  ( k  k t ) z u  k t z r  bz  kz
 m z   bz  kz  bz u  kz u

 m u z u   bz u  ( k  k t ) z u  k t z r  bz  kz
T he state variables are
 z, z, zu , zu 
u  z r is the input airfield profile
T he output i s z, the nose deflection
z2  
z4 
 0
 z1   k
  
m
d z2
 =
dt  z3   0
  
 z4   k
 m
 u
kz1
m
kz1
m

mu
bz 2
k
m
m
0
0
b
mu



bz 4
y  1
0
0
 z1 
 
z2
0  
 z3 
 
 z4 

bz 4
mu

kt zr
mu

0 
z  
b
1
   0 


m  z2
    0 u
1   z3  

 
kt

b   z4  

 m u 
m u 
m  5, 000, 00 0
T
m
(k  k t ) z3
0
k  kt
mu
kz 3
mu
0
b

m
mu
1

bz 2

mu  50
k  250, 000
k t  1, 250, 000
b  125, 000
Example
 z1   0
  
 0.05
d z2
 =
dt  z3   0
  
 z 4   5000
1
0
 0.025
0.05
0
0
2500
 30000
  0.05

125
2
A  
5000


7
  1.25 * 10
W r   B
AB
 0.025
0.05
62.4 5
 750
2500
 30000
 6.245 * 10
125


 312300
3
A  
7
 1.25 * 10

10
 3.11 * 10
 156000
 6.245 * 10
1.554 * 10
A B
6
7.5 * 10


 62.45

 2500 
6 
6.22 * 10 
7
 62.45
1.874 * 10
6
10
0




625


AB 
 25000 

7 
  6.25 * 10 
7.5 * 10
6
7
 1.866 * 10
 0

0
3
A B   
 0

 25000
625


6

 1.562 * 10
2

A B  
7
  6.25 * 10 

11 
 1.555 * 10 
0.025
 750
62.45
2
  z1   0 
  

z
0.025
0
 2  
u
1   z3   0 
  

 2500   z 4   25000 
0
11
  1.561 * 10 6 

9 
3.884
*
10
2

A B  
11
 1.555 * 10 

14 
  3.869 * 10 


155400

6
6.22 * 10 
10 
 1.548 * 10 
0
625
625
 1.562 * 10
25000
 6.25 * 10
 6.25 * 10
7
1.555 * 10
6
7
11
6
 1.561 * 10 
9 
3.884 * 10 
11
1.555 * 10 
14 
 3.869 * 10 
Example
W r   B
Wr
1
AB
 0.9958

23.75
 
 1.975

 0.00079
2
A B
 0

0
3
A B   
 0

 25000
23.75
 0.4938
 10
0.25
 0.9992
0.02498
 0. 0004
0.00001
0
625
625
 1.562 * 10
25000
 6.25 * 10
 6.25 * 10
0.00004 

0

0


0

7
1.555 * 10
6
7
11
6
 1.561 * 10 
9 
3.884 * 10 
11
1.555 * 10 
14 
 3.869 * 10 
T he inverse of the reachability m a trix exists
 Since the inverse of the reachability matrix exists, the system
is reachable and controllable.
Matlab
 Matlab has the function ctrb(A,B) which will compute the
reachability matrix:
>> A=[0 1 0 0; -0.05 -0.025 0.05 0.025;...
0 0 0 1; 5000 2500 -30000 -2500]
A=
1.0e+004 *
0 0.0001
0
0
-0.0000 -0.0000 0.0000 0.0000
0
0
0 0.0001
0.5000 0.2500 -3.0000 -0.2500
>> B = [0;0;0;25000]
B=
0
0
0
25000
>> Wr=ctrb(A,B)
Wr =
1.0e+014 *
0
0 0.0000 -0.0000
0 0.0000 -0.0000 0.0000
0 0.0000 -0.0000 0.0016
0.0000 -0.0000 0.0016 -3.8688
>> inv(Wr)
Warning: Matrix is close to singular or badly
scaled. Results may be inaccurate. RCOND =
9.669679e-017.
ans =
0.9937 23.7500 -0.4938 0.0000
23.7500 -10.0000 0.2500
0
1.9750 -0.9992 0.0250
0
0.0008 -0.0004 0.0000
0
Canonical Forms
 The word “canonical” means prescribed
 In Control Theory there a number transformations that can
be made to put a system into a certain canonical form where
the structure of the system is readily recognized
 One such form is the Controllable or Reachable Canonical
form.
Reachable Canonical Form
 A system is in the reachable canonical form if it has the structure
 z1    a 1
  
z2
1
d   
 z3    0
dt   
...
...
  
 z n   0
y   b1
b2
b3
a2
 a3
...
0
0
...
1
0
...
0
0
1
 a n   z1   1 
   
z
0
0
 2  
0   z3    0  u
   
...
...
0
   
0   z n   0 
bn  z  D u
...
Such a structure can be represented by blocks as
D
u
S
-1

S
S
c1
c2
z1

…
…
z2
a1
a2
S
S

S
S
cn-1
cn
zn-1
an-1
…
S

zn
an
y
Reachable Canonical Form
 It can be shown that the characteristic polynomial is
A   I       a1
n
n 1
 a2
n2
 ...  a n  1   a n 
2
 To convert to Reachable Canonical Form, consider the
transformation
A  TA T
W
r
1
B  TB
n 1
 B

AB
A B  TA T
1
A
B

TB  TA B
2
A B  ( TA T
n
...
1
) TB  TA T
2
1
TA T
1
TB  TA B
2
A B  TA B
W
r
n
 T  B
AB
...
A
n 1
B   TW r  T  W rW r
1
Reachability Canonical Form
  a1

1

A  0

...

 0
W
r
 B

a2
 a3
...
1
an 

0

0 

...

0 
0
0
...
1
0
...
A
...
0
0
AB
A B
n 1
2
1
 
0
 
B  0
 
0
 
 0 
C  CT
1
B

for a 4 state variable state m atrix,
W
r
1

0
 
0

0
 a1
a1  a 2
1
 a1
0
1
0
0
 a1  2 a1a 2  a 3 

2
a1  a 2


 a1

1

2
3
w here the a i are the coefficients of the c haracteristic polyn o m ia l
 I  A    a1  a 2   a 3   a 4
4
3
2
Example: Inverted Pendulum
 Develop the reachability canonical
form for the Segway using the inverted
pendulum model of Lecture 5
0

0
A 
0

0
1
0
0
 6.405
0
0
0
7.205
0

0

1

0
0




0.01837

B 
0




  0.008163 
T he eigenvalues of A are {2.684,  2.684, 0., 0.}
0

0
AB  
0

0
U sing the m odel developed in L ecture 5 for the inverted pendulum
0

x
0
 

d v
 

dt   
0

 
  
0

y  0
1
1
0
2 2
0

m l g
J (M  m)  Mml
0
0
0
0
m lg ( M  m )
J (M  m)  Mml
x
 
v
0  
 
 
 
2
2
0

0

 x
 
 J  ml2 
0   
2

 v
    J (M  m)  Mml

1   
0

 
   
ml
0

2
 J ( M  m )  M m l

M  10 kg
w ith
m  80 kg
l  1m
J  100 kg  m / s
2
2




F




0

0
2
A B  
0

0
1
0
0
 6.405
0
0
0
7.205
1
0
0
 6.405
0
0
0
7.205
 0.05228 


0.
3

A B  
  0.05882 


0.


0 
0
  0.01837 

 

0
0.01837
0.

 

1 
0
   0.008163 

 

0    0.00816 3  
0.

0 0

0 0

1 0

0 0
1
0
0
 6.405
0
0
0
7.205
0 
0
0.
 


 

0
0.01837
0.05228



1 
0
0.
 


 

0    0.008163    0.05882 
Example
W r   B
A B
0


0.01837
Wr  
0


  0.0081633
T  W rW r
A  TA T
1
0

1.
A
0

0
C  CT
1
1
1

0

0

0
0.
0.
0.05228
 0.008163
0.
0.
 0.05 882
0
7.2051
1.
0
0.
1.
0.
0.
7.205
0
0
0
1.
0
0
1.
 z1   0
  
1.
d z2
 
dz  z 3   0
  
 z4   0
4
0.01837
0


0

0


  12.491
 0
T he characteristic polynom ial of A is  I  A    7.205 
3
A B 
2
AB
1
0
 a1
a1  a 2
1
 a1
0
1
0
0
  0.

7.2051
90.

0 
0.

1.    12.491
90.
0.
0.
80.
 12.491
0.
0.
 28.10
80.  
0
 
0.
0

 28.10  
0
 
0.    12.491
0
0
0
0
 122.5
 12.491
0
0.
 28.10
0

0

0

0
1

0

0

0
0.05228 

0.

 0.05882 

0.

 122.5   0

0
0

 28.10   0

0.   0
0


0
B  TB  
0


  12.491
0


0.01837
0 
0


  0.008163
7.205
0
0
0
1.
0
0
1.
0   z1 
 
0 z2
 
0   z3 
 
0   z4 
W
1
0
0
 6.405
0
0
0
7. 205
0
0
 122.5
 12.491
0
0.
 28.10
0
0
 0.0801
 0.008163
0
0
0
y  0
0 
0

0
0.01837

1 
0

0    0.008163
0
0.01837
1
 
0
 u
0
 
0
r
0.008163
2
0
0
0
 122.5
 12.491
0
0.
 28.10
0.01837
0
0
 0.0801
 0.008163
0
0
0
 122.5  
0
 1

  
0
0.01837
0

 
 28 .10  
0
 0

  
0 .    0.008163   0 
 0.08001 

0
  0
0


0

0
3
 a1  2 a1a 2  a 3   1
 
2
0
a1  a 2

 0
 a1
 
1
 0
0.008163
 z1 
 
z2
 0.008163   
 z3 
 
 z4 
0
 0.008163 
0
7.2051
1.
0
0.
1.
0.
0.
 122.5 

0

 28.10 

0. 
 0.08001 

0

0


0

2


7.2051

0 

1. 
0
Summary
 Reachability
 A state in a system is reachable if for any valid states of the system, say,
initial state at time t=0, x0 , and a state xf , there exists a solution for t>0
such that x(0) = x0 and x(t)=xf.
 Testing for Reachability
W r   B
AB
 For the system,
A
d
n 1
B  is called the reachability m atrix
x  Ax  Bu
and y  C x  D u
,
all of the states of the system are reachable if and only if Wr is
invertible where Wr is given by
dt
W r   B
AB
A
n 1
Next: State Feedback
B 
```