State Space For Dynamic System
State Space For Dynamic System
State-Space Approach to
Modeling Dynamic Systems
Instructor: Prof. Kwang-Hyun Cho
Web: http://sbie.kaist.ac.kr
Introduction
x h( x ( t ), u( t ))
y g ( x( t ), u( t ))
Kwang-Hyun Cho
1
Introduction
In the previous topics, we have studied the classical analysis approach of
input-output systems both in time and complex frequency domain.
However, real complex systems may have multiple inputs and multiple
outputs. Such systems may be linear or nonlinear and may be time-
invariant or time-varying. The classical approach, based on input-output
relation, was not convenient to analyze and synthesize such systems any
more.
Rudolf Emil Kalman introduced the state-space approach into system
dynamics field, it therefore formed the modern system and control theories.
Introduction
Kwang-Hyun Cho
2
Introduction - Definitions
State
The state of a dynamic system is the smallest set of variables such that
knowledge of these variables at t = t0, together with knowledge of the input
for t t0, completely determines the behavior of the system for any time t t0
The state of a dynamic system at time t is uniquely determined by the state
at time t0 and the input t t0 and is independent of the state and input
before t0 (this property is called ‘Markov Property’).
State variables
The state variables of a dynamic system are the variables making up the
smallest set of variables that determines the state of the dynamic system.
It is important to note that variables that do not represent physical
quantities can be chosen as state variables, for examples, the i th-order
derivative of output variable (i =1,2,…n-1).
State vector
If n state variables are needed to completely describe the behavior of a
given system, then those state variables can be considered the n
components of a vector x called a state vector.
Kwang-Hyun Cho
Introduction - Definitions
State space
The n-dimensional space whose coordinate axes consist of the x1-axis, x2-
axis, …, xn-axis is called a state space.
State-space equations
In state-space analysis, we are concerned with three types of variables that
are involved in the modeling of dynamic systems: input, output and state
variables.
If a system is linear and time-invariant and if it is described by n state
variables, r input variables, and m output variables, then the state equation
will have the form:
x1 a11 x1 a12 x2 a1n xn b11u1 b12 u 2 b1r u r
x n an1 x1 an 2 x2 ann xn bn1u1 bn 2 u 2 bnr u r
Kwang-Hyun Cho
3
Introduction - Definitions
Instantaneous relation
ym cm1 cm2 cmn dm1 dm2 dmr
Kwang-Hyun Cho
Introduction - Definitions
Matrices A, B, C and D are called the state matrix, input matrix, output
matrix, and direct transmission matrix, respectively.
Vectors x, u, and y are the state vector, input vector, and output vector,
respectively.
The elements of the state vector are the state variables.
A block diagram representation of state equation and output equation is
shown in Figure 5-1.
Figure 5-1
Kwang-Hyun Cho
4
Introduction
Kwang-Hyun Cho
Introduction - Example
Example 5-1
Consider the mechanical system shown in Figure 5-2. The displacement y is
measured from the equilibrium position in the absence of the external force.
5
Introduction - Example
Or x1 x2
k b 1
x2 x1 x2 u
m m m
The output equation is:
y x1
In vector-matrix form:
0 1 0
x1 x1
k b 1
u
Eq. 5-7
x2
x 2 m m m
The output equation can be written as:
x
y 1 0 1 Eq. 5-8
x2
Eq. 5-7 is a state equation, and Eq. 5-8 is an output equation for the
system.
Kwang-Hyun Cho
Introduction - Example
u k b
y y y
m m m
or
1 k b
u x1 x2 x2
m m m Figure 5-3
Kwang-Hyun Cho
6
Transient-response analysis of systems in state-space
form with MATLAB
This section represents the MATLAB approach to obtaining transient-
response curves of systems that are written in a state space form.
Step response
We first define the system with
sys = ss(A,B,C,D)
For a unit-step input, the MATLAB command
step(sys) step(A,B,C,D)
step(sys,t) step(A,B,C,D,iu) step(A,B,C,D,iu,t)
will generate plots of unit-step responses.
Note that the scalar iu is an index into the inputs of the system and
specifies which input is to be used for the response; t is the user-specified
time vector.
Kwang-Hyun Cho
The transfer matrix G(s) relates the output Y(s) to the input U(s), or
Y(s) G(s)U(s)
where
G ( s) C( sI A)1 B D
The derivation of above equation is given as follows.
Kwang-Hyun Cho
7
Transient-response analysis of systems in state-
space form with MATLAB
For the system defined by
x Ax + Bu
y = Cx + Du
The transfer matrix G(s) is a matrix that relates Y(s) and U(s) through:
sX ( s ) x (0 ) A X ( s ) + B U ( s ) Eq. 5-11
Kwang-Hyun Cho
X ( s ) = ( s I - A ) -1 x ( 0 - ) + ( s I - A ) -1 B U ( s )
Y ( s ) = C ( s I - A ) -1 x ( 0 - ) + [ C ( s I - A ) -1 B + D ] U ( s )
Kwang-Hyun Cho
8
Transient-response analysis of systems in state-
space form with MATLAB
In deriving the transfer matrix, we assume that x(0-) = 0 (only zero state
responses are considered). Then, from Eq. 5-11 we get
X ( s ) ( sI A ) 1 B U ( s )
Y ( s ) [C ( s I A ) 1 B D ]U ( s )
Upon comparing this last equation with Eq. 5-10, we see that:
G ( s ) C ( sI A ) 1 B D
G ( s ) C ( sI A ) 1 B
Kwang-Hyun Cho
y1 1 0 x1 0 0 u1
y 0 1 x 2
0 u 2
2 0
Although it is not necessary to obtain the transfer-function expression for
the system in order to obtain the unit-step response curves with MATLAB,
we shall derive such an expression for reference purposes.
G ( s ) C ( sI A ) 1 B
1
1 0 s 1 1 1 1
0 1 6 . 5 s 1
0
Kwang-Hyun Cho
9
Transient-response analysis of systems in state-
space form with MATLAB
1 s 1 1 1 1 s 1 s
s 2
s 6 . 5 6 . 5 s 1 1 0 s 2
s 6 . 5 s 7 . 5 6 . 5
Hence,
s 1 s
Y1 ( s ) s 2 s 6 .5 s 2 s 6 .5 U 1(s)
Y (s) s 7 .5
2 6 .5 U 2 (s)
s 2 s 6 . 5 s 2 s 6 .5
Since this systems involves two inputs and two outputs, four transfer
functions can be defined, depending on which signals are considered as
input and output.
Note that, when considering the signal u1 as the input, we assume that
signal u2 is zero, and vice versa.
Y1 ( s ) s 1 Y1 ( s ) s
G11 ( s ) G12 ( s )
U1 ( s ) U s s 6.5
2
U 2 ( s ) U ( s )0 s 2 s 6.5
2 ( s ) 0 1
Y2 ( s ) s 7.5 Y2 ( s ) 6.5
G21 ( s ) G22 ( s ) 2
U1 ( s ) U s s 6.5
2
U 2 ( s ) U ( s )0 s s 6.5
2 ( s ) 0 1
Kwang-Hyun Cho
Figure 5-4
Kwang-Hyun Cho
10
Transient-response analysis of systems in state-
space form with MATLAB
To plot two step-response
curves for the input u1 in one
diagram and two step-response
curves for the input u2 in
another diagram, we may do as
follows:
Figure 5-6
Kwang-Hyun Cho
11
Transient-response analysis of systems in state-
space form with MATLAB
Response to initial condition
To find the response to the initial condition x0 given to a system in state-
space form, the following command may be used:
[y, t] = lsim(sys,u,t,x0)
Here, u is a vector consisting of zeros having length size(t).
Another way to obtain the response to the initial condition given to a
system in a state-space form is to use the command
initial(A,B,C,D,x0,t)
Example 5-3
Consider the system shown in Figure 5-7.
The system is at rest for t <0. At t = 0, the mass is
pulled downward by 0.1 m (x(0) = 0.1) and is released
with an initial velocity of 0.05 m/s (dx(0)/dt = 0.05).
The displacement x is measured from the equilibrium
position.
There is no external input to this system.
Assume that m = 1 kg, b = 3 N-s/m, and k = 2 N/m.
Figure 5-7
Kwang-Hyun Cho
12
Transient-response analysis of systems in state-
space form with MATLAB
Thus:
0 1 0 1 0 0 0.1
A , B , C , D , x0
2 3 0
0
1
0
0.05
Figure 5-8
Can you solve Example 4-11 again following the same procedures?
Kwang-Hyun Cho
Example 5-4
Consider the mechanical system shown in Figure 5-9.
The system is at rest for t <0. That is x(0-)=0 and dx(0-)/dt=0. At t = 0, a
unit-impulse force, which is the input to the system, is applied to the mass.
Assuming that m = 5 kg, b = 20 N-s/m, and k = 100 N/m, obtain the
response curves x(t) versus t and x ( t ) versus t with MATLAB.
13
State-space modeling of systems with no input
derivatives
The variables that provide the initial conditions qualify as state variables.
Hence, we choose the variables that specify the initial conditions as state
variables x1 and x2.
Thus: x x
x1 x 2
0 1 0
x 1 k x1
x
b 1 u
2 x2
m m m
Kwang-Hyun Cho
14
State-space modeling of systems with no input
derivatives
Example 6-3
Consider the electrical circuit shown in Figure 6-14.
Applying Kirchhoff’s voltage law to the system, we obtain the following
equations:
1 1
Ri
C id t e i
C id t e o
1 1 1 1
RI (s) I (s) Ei (s) I (s) Eo (s)
C s C s
1 1
Assuming the input is ei and I (s)
Eo (s) C s 1
output is eo, the transfer
function of the system is: Ei (s) 1 1 RCs 1
R I (s)
C s Kwang-Hyun Cho
Kwang-Hyun Cho
15
State-space modeling of systems with no input
derivatives
Example 6-4
Consider the electrical circuit shown in Figure 6-15.
Applying Kirchhoff’s voltage law to the system, we obtain the following
equations:
di 1 1
L
dt
Ri
C id t e i
C id t e o
Eo (s) 1
Ei (s) LCs RCs 1
2
Figure 6-15
Kwang-Hyun Cho
x
y 1 0 1
x2
These two equations give a mathematical model of the system in state
space.
Kwang-Hyun Cho
16
State-space modeling of systems with no input
derivatives
Example 5-5
Consider the mechanical system shown in Figure 5-11.
The system is at rest for t < 0. At t = 0, a step force f of newtons is
applied to mass m2.
The displacement z1 and z2 are measured from the respective equilibrium
positions of the carts before f is applied. Therefore, all initial conditions of
states are equal to zeros.
Derive a state-space representation of the system.
Assuming that m1 = 10 kg, m2 = 20kg, b = 20 N-m/s, k1 = 30 N/m, k2 =
60 N/m, and = 10, obtain the response curves z1(t) versus t, z2(t) versus
t, and z1(t) – z2(t) versus t with MATLAB.
Also, obtain z ( ) and z ()
1 2
Figure 5-11
Kwang-Hyun Cho
z 1 k 1 z 1 k 2 ( z 1 z 2 ) b ( z 1 z 2 )
m 1 Eq. 5-13
z 2 k 2 ( z 1 z 2 ) b ( z 1 z 2 ) u
m 2 Eq. 5-14
17
State-space modeling of systems with no input
derivatives
The state equation now becomes:
x 1 x 2
k1 k 2 b k b
x 2 x1 x2 2 x3 x4
m1 m1 m1 m1
x 3 x 4
k2 b k b 1
x 4 x1 x2 2 x3 x4 u
m2 m2 m2 m2 m2
Note that z1 and z2 are the outputs of the system; hence, the output
equations are:
y1 z1 y2 z2
In terms of vector-matrix equations, we have:
0 1 0 0
k k 0
x 1 1 b k2 b x 1 0
2
m1 x2
x 2
m1 m1 m1
x 3 0 u
0 0 0 1 x3
b x4
4
x k b
k2
m 2
2
m2 m2 m2 m2
Kwang-Hyun Cho
x 1 0 1 0 0 x1 0
x 2 x 0
9
2 2 6 2 u
x 3 0 0 0 1 x3 0
x 4 3 1 3 1 x 4 0 .5
So, we have:
0 1 0 0 0
9 2 0
A
6 2
, B , C 1 0 0 0 0
, D
0 1 0 0 0
0 0 0 1 0
3 1 3 1 0 .5
Kwang-Hyun Cho
18
State-space modeling of systems with no input
derivatives
The curves are shown
in Figure 5-12.
Figure 5-12
Kwang-Hyun Cho
19
State-space modeling of systems with no input
derivatives
And 1 1
z 2 ( ) z1 ( )
6 2
Thus,
1 1
z1 ( ) m, z2 ( ) m
3 2
The final values of z1(t) and z2(t) obtained with MATLAB agree with the
result obtained here.
Kwang-Hyun Cho
y k y b ( y u )
m
Or
k b b
y
y y u
m m m
Figure 5-13 Kwang-Hyun Cho
20
State-space modeling of systems with input
derivatives
If we choose the state variables:
x1 y x 2 y
Then we get:
x 1 x 2
k b b
x 2 x1 x2 u Eq. 5-18
m m m
The right-hand side of Eq. 5-18 involves the derivative term u
Note that, in formulating state-space representations of dynamic systems,
we constrain the input function to be any function of time of order up to the
impulse function, but not any higher order impulse functions such as
d (t ) d 2 (t )
, , etc
dt dt 2
To explain why the right-hand side of the state equation should not involve
the derivative of the input function u, suppose that u is the unit-impulse
function.
Kwang-Hyun Cho
Notice that x2 includes the term (k / m) (t ) . This means that x2 (0) ,
which is not acceptable as a state variable.
We should choose the state variables such that the state equation will
not include the derivative of u.
Suppose that we try to eliminate the term involving u from Eq. 5-18.
One possible way to accomplish this is to define:
b
x1 y x 2 y u
m
Then
b
x 2
y u
m
k b b b
y y u u
m m m m
Kwang-Hyun Cho
21
State-space modeling of systems with input
derivatives
k b b
x1 ( x2 u)
m m m
2
k b b
x1 x2 u
m m m
Thus, we have eliminated the term that involves u .
The acceptable state equation can now be given by:
b
0 1
x1 x1 m
x k b
2 u
2 x2 b
m m m
If equations of motion involve u , u , u
, etc. , the choice of state variables
becomes more complicated.
Fortunately, there are systematic methods for choosing state variables for a
general case of equations of motion that involve derivatives of the input
function u.
Kwang-Hyun Cho
Y ( s ) b0 s n b1 s n 1 bn 1 s bn
n
U (s) s a1 s n 1 an 1 s an
We examine two methods when n = 2.
Kwang-Hyun Cho
22
State-space modeling of systems with input
derivatives – Method 1
Method 1
Consider the second-order system:
y a1 y a 2 y b0 u b1u b 2 u
Eq. 5-20
As a set of state variables, suppose that we choose:
x1 y 0 u Eq. 5-21 0 b0
where
x 2 x 1 1 u Eq. 5-22 1 b1 a 1 0
From Eq. 5-21, we have:
y x1 0 u
Substituting this last equation into Eq. 5-20, we obtain:
x1 a1 x1 a 2 x1 1u ( b 2 a 2 0 ) u
Eq. 5-26
Kwang-Hyun Cho
x 2 1u a1 ( x 2 1u ) a 2 x1 1u ( b 2 a 2 0 ) u
which can be simplified to:
x 2 a 2 x1 a1 x 2 2 u Eq. 5-28
where
2 b 2 a1 1 a 2 2
x1 0 1 x1 1
x a a 1 x u Eq. 5-30
2 2 2 2
Kwang-Hyun Cho
23
State-space modeling of systems with input
derivatives – Method 1
From Eq. 5-25, we get the output equation:
x
y 1 0 1 0u Eq. 5-31
x2
Eqs. 5-30 and 5-31 represent the system in a state space.
x 1 0 1 0 0 x1 1
x 0 0 1 0 x 2 2
2
u
x n 1 0 0 0 1 x n 1 n 1
x n a n a n 1 an2 a 1 x n n
Kwang-Hyun Cho
0 b0
1 b1 a 1 0
2 b2 a1 1 a 2 0
n bn a1 n 1 a n 1 1 a n 0
Kwang-Hyun Cho
24
State-space modeling of systems with input
derivatives – Method 2
Method 2
Consider the second-order system: y a1 y a 2 y b0 u b1u b 2 u
Y ( s ) b0 s 2 b1s b2
or its equivalent function 2
U (s) s a1 s a2
Eq. 5-32 can be split into two equations as follows (Suppose there is an
intermediate variable z between u and y):
Z (s) 1 Y (s)
G1 ( s ) 2 G2 ( s ) b0 s 2 b1 s b2
U ( s ) s a1 s a2 Z (s)
We then have:
z a1 z a 2 z u
Eq. 5-33
z b1 z b 2 z y
b0 Eq. 5-34
If we define:
x1 z x 2 z Eq. 5-35
Kwang-Hyun Cho
x 2 a 2 x1 a1 x 2 u
These two equations can be combined into the vector-matrix differential
equation:
x1 0 1 x1 0
x 1 u Eq. 5-38
x 2 a 2 a 1 2
Kwang-Hyun Cho
25
State-space modeling of systems with input
derivatives – Method 2
Eq. 5-37 can be rewritten as:
x
y b 2 a 2 b 0 b1 a 1 b 0 1 b 0 u Eq. 5-39
x2
Eqs. 5-38 and 5-39 are the state equation and output equation, respectively.
Note that the state variables x1 and x2 in this case may not correspond to
any physical signals that can be measured.
Y ( s ) b0 s n b1 s n 1 bn 1 s bn
n
U (s) s a1 s n 1 a n 1 s a n
Kwang-Hyun Cho
x 1 0 1 0 0 x1 0
x 0 0 1 0 x 0
2 2
u Eq. 5-40
x n 1 0 0 0 1 x n 1 0
x n a n a n 1 an2 a 1 x n 1
and
x1
x
y b n a n b 0 b n 1 a n 1b 0 b1 a 1 b 0 2 b 0 u Eq. 5-41
xn
This form is called the Controllable Canonical Form.
Kwang-Hyun Cho
26
State-space modeling of systems with input
derivatives – Method 3
Method 3
Consider the same system description as the previous one
xn y b0u
xn1 y a1 y b0 u b1u
xn2 y a1 y a2 y b0 u b1 u b2u
( n 1) ( n 2) ( n 1) ( n 2)
x1 y a1 y an1 y b0 u b1 u bn1u
Kwang-Hyun Cho
x 1 0 0 0 an x1 b n a n b0
a n 1 a n 1 b 0
x2 1 0 0 x 2 b n 1
0 1 0 an2 bn 2 a n 2 b0 u
x n 1 x n 1
x n 0 0 1 a 1 x n b1 a 1 b 0
and x1
x
y [0 0 0 1] 2 b 0 u
xn
Kwang-Hyun Cho
27
State-space modeling of systems with input
derivatives – Examples
Examples 5-6 and 5-7 illustrate the use of the preceding two analytical
methods for obtaining state-space representations of a differential-
equation system involving derivatives of the input signal.
Example 5-6
Consider the spring-mass-dashpot system mounted on a cart as shown in
Figure 5-14.
Assume that the cart is standing still for t < 0. In this system, u(t) is the
displacement of the cart and is the input to the system.
At t = 0, the cart is moved at a constant speed, or u co n stan t
Figure 5-14
Kwang-Hyun Cho
Kwang-Hyun Cho
28
State-space modeling of systems with input
derivatives – Examples
And identify:
b k b k
a1 , a2 , b 0 0 , b1 , b2
m m m m
0 b0 0
b x1 y 0 u y
1 b1 a1 0
m b
k b
2
x 2 x 1 1 u x 1 u
2 b2 a1 1 a2 2 m
m m
From above equations and Eq. 5-28, we obtain:
b Eq. 5-44
x 1 x 2 u
m
k b k b 2
x 2 a 2 x1 a1 x2 2 u x1 x2 u Eq. 5-45
m m m m
And the output equation is:
y x1 Eq. 5-46
Kwang-Hyun Cho
b
0 1 x
x1 x1 m
y 1 0 1
x k b x u
2 k b x2
2
2
m m m m
These two equations give a state-space representation of the system.
Next, we shall obtain the response curve y(t) versus t for the unit-ramp
input. Substituting the given numerical values for m, b, and k into the state
equation, we obtain:
x1 0 1 x1 2 x
x 1 0 x 6 u y 1 0 1
2 2 2 x2
Kwang-Hyun Cho
29
State-space modeling of systems with input
derivatives – Examples
Figure 5-15
Kwang-Hyun Cho
0 1
x1 x1 0 k b x1
x 1 u y
x k m x 2
b
2 2 m
m m
These last two equations give another state-space representation of the
same system.
Substituting the given numerical values for m, b and k, we get:
x1 0 1 x1 0 x
x 1 0 y 1 0 2 1
2 x 2 1
u
2 x2
Kwang-Hyun Cho
30
State-space modeling of systems with input
derivatives – Examples
Figure 5-16
Kwang-Hyun Cho
Assume that m1, b1, and k1 represent the front tire and
shock absorber assembly and m2, b2, and k2 represent
half of the body of the vehicle.
Assume also that m1 = 10 kg, m2 = 100 kg, b1 = 50 N-
s/m, b2 = 100 N-s/m, k1 = 50 N/m, and k2 = 200 N/m.
31
State-space modeling of systems with input
derivatives – Examples
which can be rewritten as:
x b1 x k1 x b1u k1u
m 1
y b 2 y k 2 y b 2 x k 2 x
m 2
If we substitute the given numerical values and simplify the equations, then
we get:
x 5 x 5 x 5 u 5 u
Eq. 5-47
y y 2 y x 2 x
Eq. 5-48
Laplace transforming Eqs. 5-47 and 5-48, assuming the zero initial
conditions, we obtain:
( s 2 5 s 5) X ( s ) (5 s 5)U ( s )
( s 2 s 2)Y ( s ) ( s 2) X ( s )
Eliminating X(s) from these two equations, we get:
Kwang-Hyun Cho
y a1
y a 2
y a 3 y a 4 y b 0
u b1
u b 2 u b3 u b 4 u
We find that:
a 1 6 , a 2 1 2 , a 3 1 5, a 4 1 0
b 0 0 , b1 0 , b 2 5, b 3 1 5, b 4 1 0
Next, we define the state variable as follows:
x1 y 0 u 0 b0 0
x 2 x 1 1 u 1 b1 a1 0 0
where
x 3 x 2 2 u 2 b2 a1 1 a2 0 5
x 4 x 3 3 u 3 b3 a1 2 a2 1 a3 0 15
Kwang-Hyun Cho
32
State-space modeling of systems with input
derivatives – Examples
Hence,
x 1 x 2
x 2 x 3 5 u
x 3 x 4 1 5 u
x 4 a 4 x 1 a 3 x 2 a 2 x 3 a 1 x 4 4 u
1 0 x1 1 5 x 2 1 2 x 3 6 x 4 4 u
where
4 b4 a1 3 a 2 2 a31 a4 0 40
Thus the state equation and output equation become:
x1 0 1 0 0 x1 0 x1
x 0 0 1 0 x 2 5 x
2 u y 1 0 0 0 2
x 3 0 0 0 1 x3 15 x3
x 4 10 15 12 6 x4 40 x4
Kwang-Hyun Cho
Figure 5-18
Kwang-Hyun Cho
33
State-space modeling of systems with input
derivatives – Examples
Method 2. From Eq. 5-49, the transfer function of the system is given
by:
Y (s) 5 s 2 15 s 10
4
U ( s ) s 6 s 3 12 s 2 15 s 10
Figure 5-19 shows a block diagram in which the transfer function is split
into two parts. If we define the output of the first block as Z(s), then:
Z (s) 1 1
4 4
U ( s ) s 6 s 12 s 15 s 10 s a1 s a 2 s 2 a3 s a 4
3 2 3
and
Y (s)
5 s 2 15 s 10 b0 s 4 b1 s 3 b2 s 2 b3 s b4
Z (s)
Figure 5-19
Kwang-Hyun Cho
x1 0 1 0 0 x1 0 x1
x 0 0 1 0 x 2 0 x
2 u y 10 15 5 0 2
x 3 0 0 0 1 x3 0 x3
x 4 10 15 12 6 x4 1 x4
Kwang-Hyun Cho
34
State-space modeling of systems with input
derivatives – Examples
Figure 5-20
Kwang-Hyun Cho
Kwang-Hyun Cho
35
Transformation of mathematical models with
MATLAB
Transformation from transfer function to state space
Consider the transfer function system:
MATLAB program 5-10
Y (s) s
3
U ( s ) s 14 s 56 s 160
2
Another is:
Example 5-8
Obtain the transfer function of the system defined by the following state-
space equations:
x1 0 1 0 0 x1 0 x1
x 0 x
0 x 2 5
y 1 0 2
2 0 1 u
0 0
x 3 0 0 0 1 x3 15 x3
x 4 10 15 12 6 x4 40 x4
Kwang-Hyun Cho
36
Transformation of mathematical models with
MATLAB
MATLAB Program 5-11 produces the transfer function of the system:
Y (s) 5 s 2 15 s 10
4
U ( s ) s 6 s 3 12 s 2 15 s 10
Example 5-9
Consider a system with multiple inputs and multiple outputs.
When the system has more than one output, the command
[num, den] = ss2tf(A, B, C, D, iu)
produces transfer function for all outputs to each input. Kwang-Hyun Cho
x1 0 1 x1 1 1 u1
x 2 5
4 x 2 0 1 u 2
2
y1 1 0 x1 0 0 u1
y 0
1 x 2 0 0 u 2
2
This system involves two input and two outputs.
Four transfer functions are involved.
Y1 ( s) s4 Y1 ( s ) s 5
G11 ( s) G12 ( s )
U1 ( s ) U s 2 4s 25 U 2 ( s ) U ( s )0 s 2 4s 25
2 ( s )0 1
Y2 ( s ) 25 Y2 ( s ) s 25
G21 ( s ) G22 ( s )
U1 ( s ) U s 2 4 s 25 U 2 ( s ) U ( s )0 s 2 4 s 25
2 ( s ) 0 1
Kwang-Hyun Cho
37
Transformation of mathematical models with
MATLAB
Nonuniqueness of a set of state variables
A set of state variables are not unique for a given system.
Suppose that x1, x2, …, xn are a set of state variables.
Then we may take as another set of state variables any set of functions:
xˆ1 X 1 ( x1 , x 2 , ..., x n )
xˆ 2 X 2 ( x1 , x 2 , ..., x n )
xˆ n X n ( x1 , x 2 , ..., x n )
provided that, for every set of variables xˆ1 , xˆ 2 , ..., xˆ n , there corresponds
a unique set of values x1, x2, …, xn, and vice versa.
Thus if x is a state vector, then
x̂ = Q x
is also a state vector, provided that the matrix Q is nonsingular. (Note that a
square matrix Q is nonsingular if the determinant |Q| is nonzero.)
Kwang-Hyun Cho
P xˆ = A P xˆ + B u
y = C P xˆ + D u
Or,
xˆ = P - 1 A P xˆ + P - 1 B u Eq. 5-55
y = C P xˆ + D u Eq. 5-56
Eqs. 5-55 and 5-56 represent another state-space model of the same
system.
Kwang-Hyun Cho
38
Transformation of mathematical models with
MATLAB
It is sometimes desirable to transform the state matrix into a diagonal
matrix.
Diagonalization of state matrix A
Consider an n x n state matrix.
0 1 0 0
0 0 1 0
A Eq. 5-58
0 0 0 1
a n a n 1 an2 a 1
We first consider the case where matrix A has distinct eigenvalues only.
If the state vector x is transformed into another state vector z with the use
of a transformation matrix P, or
x = Pz
Suppose A has the n (distinct) eigenvalues λ1, λ2, …, λn, and corresponding
eigenvectors e1, e2, …, en, which are independent with each other. Define
the modal matrix of A to be the n × n matrix P = [e1 e2 … en] (Recall the
discussion at the end of Topic 2-2).
Kwang-Hyun Cho
1 1 1 1
2 3 n
1
P 12 22 32 n2 Eq. 5-59
1
n 1
n 1
2n 1 3n 1 n
1 0 0
0 2 0
P -1 A P
0 0 n
39
Transformation of mathematical models with
MATLAB
Problem A – 5 - 18
Obtain the eigenvectors of the matrix A, and assume that the eigenvalues
are 1 , 2 , and , 3 ; that is:
0 1 0
A 0 0 1
a3 a2 a1
1 0
I A 0 1
a3 a2 a1
3 a1 2 a 2 a 3
( 1 )( 2 )( 3 )
Kwang-Hyun Cho
40
Transformation of mathematical models with
MATLAB
Note that if xi is an eigenvector, then axi (where a = nonzero scalar) is also
an eigenvector, because Eq. 5-113 can be written as:
a ( A x i ) = a (i x i )
or
A ( a x i ) = i ( a x i )
Thus, by dividing the eigenvectors given by Eq. 5-114 by x11, x21, and x31,
respectively, we obtain:
1 1 1
, ,
1 2 3
1 2 3
2 2 2
Kwang-Hyun Cho
Kwang-Hyun Cho
41
Transformation of mathematical models with
MATLAB
Example 5-10
Consider a system with the state-space representation
x1 0 1 0 x1 0 x1
x 0 0 1 x 0 u y 1 0 0 x2
2 2
x3 6 11 6 x3 6 x3
or
x A x + B u
Eq. 5-63
y = Cx + Du
where
0 1 0 0
A 0 0 1 , B 0 , C 1 0 0 , D0
6 11 6 6
The eigenvalues of the state matrix A are -1, -2, and -3, or
1 1, 2 2, 3 3
Kwang-Hyun Cho
or
x = Pz Eq. 5-64
where
1 1 1
P 1 2 3 Eq. 5-65
1 4 9
Then substituting Eqs. 5-64 into Equation 5-65, we obtain:
P z A P z + B u
Kwang-Hyun Cho
42
Transformation of mathematical models with
MATLAB
Premultiplying both sides of this last equation by P-1, we get:
z P 1 A P z + P 1 B u
or
z1 3 2.5 0.5 0 1 0 1 1 1 z1 3 2.5 0.5 0
z 3 4 1 0 0 1 1 2 3 z 3 4 1 0 u
2 2
z3 1 1.5 0.5 6 11 6 1 4 9 z3 1 1.5 0.5 6
Simplifying gives:
z1 1 0 0 z1 3
z 0 2 0 z 6 u Eq. 5-67
2 2
z3 0 0 3 z3 3
Eq. 5-67 is a state equation that describes the system defined by Eq. 5-63.
The output equation is modified to:
1 1 1 z1 z1
y 1 0 0 1 2 3 z 2 1 1 1 z 2
1 4 9 z 3 z 3
Kwang-Hyun Cho
Problem A – 5 – 20
Prove that the eigenvalues of a square matrix A are invariant under a linear
transformation.
Solution – To prove the invariance of the eigenvalues under a linear
transformation, we must show that the characteristic polynomials
I A and I P -1 A P
are identical.
43
Transformation of mathematical models with
MATLAB
P -1 I A P
P -1 P I A
Noting that the product of the determinants |P-1| and |P| is the
determinants of the product |P-1P|, we obtain:
I P -1 A P P -1 P I A
I A
Thus, we have proven that the eigenvalues of A are invariant under a linear
transformation.
Kwang-Hyun Cho
44