MEIC

advertisement
MEIC 教學講義
M
E
C
National Taiwan Ocean University-Marine Engineering Intelligent Control (MEIC)
Takagi-Sugeno Fuzzy Modeling and Controller Design
Intelligent
Teacher: Wen-Jer Chang (張文哲)
█ Part 1: Linearization for Nonlinear Systems
在此單元,我們將介紹一將非線性系統線性化的數學方法並藉由電腦輔助計算。此份教學
文件所使用的 MATLAB 為 6.5 版。
In general, the T-S fuzzy systems can be divided into two categories: homogeneous T-S fuzzy
systems and affine T-S fuzzy systems. In the homogeneous T-S fuzzy systems, the consequent part of
the fuzzy systems are linear dynamic systems with no constant bias term. On the other hand, the
consequent parts of the linear dynamic systems of affine T-S fuzzy systems are affined by a constant
bias term for each rule. This chapter presents the system structures of affine T-S fuzzy systems. First,
we introduce the linearization technique for a general nonlinear autonomous open-loop system and
through the concept of convex hull the T-S fuzzy systems can be structured by several linear
sub-systems.
 1.1 Linearization for Nonlinear Systems。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
2
 1.2 Convex Sets。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 4
 1.3 Structural of Affine Takagi-Sugeno Fuzzy Systems。。。。。。。。。。。。。。。。。。。。
6
 1.4 An Example for the Nonlinear Pendulum System。。。。。。。。。。。。。。。。。。。。。
12
Appendix A。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 22
Appendix B。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 26
1
MEIC 教學講義
1.1 Linearization for Nonlinear Systems
Consider a nonlinear autonomous (not time-varying) open-loop system of the form
x  t   f  x  t  ,u  t  
(1.1)
with its equilibrium points as follows:

 0

1

 x , u  f  x , u   0 ,
 x , u  f  x , u   0 ,
*
*
*
*
for x*  0 and u*  0
*
*
*
*
for x  0 and / or u  0
*
(1.2)
*
where x* is the given operating point and u* is the control input corresponding to x* . Note that
x* and u* are not functions of time while x  t  and u  t  are functions of time. In generally, we
always choose the operating points on the equilibrium point 0 , i.e.,
 x , u    0, 0  . Hence, when
*
*
the operating points belong to 1 , i.e., x*  0 and/or u*  0 , we introduce the new state vector
 x  t   x  t   x* and the new input vector  u  t   u  t   u* . Substituting these new variables into
(1.1), we obtain the equivalent system as follows
 x  t   x*  f   x  t   x* , u  t   u* 
and the new equilibrium points are shifted to
(1.3)
 0, 0 0 .
The stabilization control problem is then to find a control law
2
MEIC 教學講義
 u  t   g  x  t 
(1.4)
such that, starting anywhere in a region around the equilibrium point 0 , the state vector  x  t 
converges asymptotically to 0 as t   . In term of the original state vector x  t  this means that
we want to design a control law such that x  t  asymptotically converges to the operating point x*
as t   .
In linear control theory, a particular linear system is obtained through the first-order Taylor
expansion in an operating point
x , u 
*
*
on the right-hand-side (R.H.S.) of (1.3). The class of linear
systems is described as follows:
 x  t   x*  f  x* ,u*   A x  t   B u  t 
or
xt  A xt  Bu t  a
(1.5)
where the Jacobian matrix A , B and vector a are defined as follows
A
 f  x  t  ,u  t  
 xt
, B
x  t   x* ,u  t  u*
 f  x  t  ,u  t  
 u t
, a  f  x* ,u*   A x*  B u* ,
x  t   x* ,u  t  u*
(1.6)
and x  t  n is the state vector of (1.5), u  t  m is the control input. Besides, a is the bias
term and it is assumed that a  0 if the operating point is an equilibrium point belong to 0 .
3
MEIC 教學講義
Remark 1.1: more detail about the Jacobian matrix are given in Appendix A.
1.2 Convex Sets
Before introducing the structure of T-S fuzzy systems, we first consider some definitions about
the convex sets. It is useful for the designers to study the T-S fuzzy modeling approach.
Definition 1.1: Convex Sets
Given two points a , b n , the set of all points x  1    a  b such that 0    1 is called
the (closed) line segment between a , b and denoted by a , b . A set C  n is called convex if it
contains any line segment between two points of itself. In other words, a set C  n is called convex
if 1    a  b  C whenever a , b  C , 0    1 .
□
Figure 1.1, shows a simple convex (a) and nonconvex sets (b-c). In which, the set (b) contains
some boundary points but not others, and it is not convex.
a
b
a
b
b
a 
a
 b
c
Fig. 1.1 some simple convex and non-convex sets. (a) is a convex set,
(b) and (c) are not convex set
4
MEIC 教學講義
a
b
b
a
Fig. 1.2 convex hull of two non-convex sets presented in Figure 1.1,
i.e., (b) and (c) of Figure 1.1.
Definition 1.2: Convex Combination
We call a point of the form 1 x1 
convex combination of the points x1 ,
  k xk , where 1 
  k  1 and  i  0 , i  1,
,k , a
,xk .
□
Definition 1.3: Convex Hull
The convex hull of a set C , denoted conv  C  , is the set of all convex combinations of points
contained in C :
conv  C   1 x1 
  k xk xi  C,  i  0, i  1,
, k , 1 
  k  1 . See Figure 1.2.
□
Definition 1.4: Sum Sets
The sum of two sets is defined as C1  C2   x1  x2 x1  C1 , x2  C2  . If C1 and C2 are convex,
then the sum sets C1  C2 is convex.
□
Definition presented above offers the key to an understanding of the T-S fuzzy systems. We will
5
MEIC 教學講義
demonstrate this point in the following sections. Now, the system structure of the affine T-S fuzzy
systems can be introduced by the following example.
1.3 Structural of Affine Takagi-Sugeno Fuzzy Systems
It is known that linear system (1.5) just valid around the operating point and one can only
guarantee the local stability of nonlinear systems. Recently, one solution for this problem has been
developed to study the global stability and stabilization issues by using the fuzzy approach. In general,
fuzzy systems can be divided into two categories:
1.
Mamdani fuzzy approach (non-model analysis)
2.
Takagi-Sugeno fuzzy approach (model-based analysis)
In this thesis, we consider the model-based T-S fuzzy system. The research for the Mamdani fuzzy
approach can be found out in [W.J. Wang]. To design a model-based fuzzy controller, we need a T-S
fuzzy system to replace the nonlinear system. Therefore, the construction of a T-S fuzzy system plays
an important and basic role in this thesis. In this chapter we discuss the issue of how to construct such
a T-S fuzzy system for the nonlinear system (1.1). Besides, T-S fuzzy systems can be divided into two
categories: homogeneous T-S fuzzy systems and affine T-S fuzzy systems. The details about them are
presented in following sections.
This section presents the system structure of the affine T-S fuzzy systems. The affine T-S fuzzy
systems can be used to overcome the problems in the homogeneous T-S fuzzy systems. Through the
following example, we will introduction the system structure of the affine T-S fuzzy system.
Example 1.1: Piecewise nonlinearity (affine T-S fuzzy systems)
Consider a nonlinear system presented as follows:
6
MEIC 教學講義
 f1  t  


 f 2  t 
 x1  t    2 x1  t   x1  t  x2  t  



2
 x2  t   2  x1  t    x2  t   u  t 
Choosing i-th operating points
x
*
1i
x  t   Ai x  t   Bi u  t   ai , i  1,
(1.7)
, x*2i , ui*  , one can get i-th linear sub-system such as:
(1.8)
,r
where
  f1  t 

 x1  t 
Ai  
 f t
 2
  x1  t 
 f1  t  

 x2  t    2  x2  t  x1  t  

,

1  x1  t  x1i*
 f 2  t    4 x1  t 

x2  t   x*2i
 x2  t  
  f1  t  


 u t   0 
 f1  t  

*
*
a

Bi  

and

 x1  t  x1i*  A i xi  Bi ui


i

u  t   u t u*
 f t
 f 2  t   x2  t  x*2i
 i
 2  
u  t   u*i
  u  t  
(1.9)
We choose several operating point at equilibrium points, i.e., operating point belong to 0 or 1 , and
some off-equilibrium points, i.e., f  x* , u*   0 , in order to cover the workspace. Thus, we have to
determine the equilibrium points for the nonlinear system (1.7). First, assume x1  t   0 and
x2  t   0 then solve the following equations:
2 x1*  x1* x*2  0

* 2
*
*
2  x1   x2  u  0
(1.10)
7
MEIC 教學講義
One can get the equilibrium points
x ,
*
1
x*2 , u*  as follows
x1*   1  u* 2 and x*2  2
(1.11)
Here, we assume u  t   0 and u*  0 . As well as, we choose four initial points
 0.01,
 5 ,
 0.01,
 5 ,
 0.01, 0
and
 0.01, 0
 x  0 , x 0
1
2
as
in the nonlinear system (1.7), which are
shown in Figure 1.3. Obviously, the state starting from four initial point will asymptotically converges
to the equilibrium points x1*  1 and x*2  2 as t   .
Now, we choose three operating points
x
*
1i
, x*2i , ui*  as 1, 2, 0  ,
 0, 0 , 0 
and
 1, 2, 0 .
Two equilibrium points belong to 1 and one off-equilibrium point, i.e., f  x* , u*   0 . Then, one
can obtain following parameters for three linear sub-systems:
 0 1
2
A1  
, a1    ,

 2 
 4 1
2 0 
0 
A2  
, a2    ,

0 1
0 
0 1
 2 
A3  
, a3    ,

 4 1
 2 
0
and B1  B 2  B3   
1 
(1.12)
The state flows of these three sub-systems are shown in Figure. 1.4 with u  t   0 . Part (a) is the flow
of nonlinear system. Parts (b-d) are the flow of three local linear systems, respectively. It is obvious
that the three linear sub-systems have the same state flows with the
8
MEIC 教學講義
Fig. 1.3 state flow of the nonlinear system (1.7) subject to u  t   0 .
nonlinear system around the operating points 1, 2, 0  ,
 0, 0 , 0 
and
 1, 2, 0 . Next, assume the
three linear sub-systems can be fuzzify seen as the range Xi such as mark a circular shape in Figure
1.5, where i  1, 2,3 . Moreover, according to the sum sets and convex hull presented in Definition 1.3
and Definition 1.4, one can get the minima convex set X f that contains three subsets Xi , as follows
and it is shown in Figure 1.5:
Xf  conv 
3
i 1
Xi 
(1.13)
or present as the following affine T-S fuzzy system
9
MEIC 教學講義
Fig. 1.4 state flow of nonlinear system and its three linear sub-systems.
Rule 1:
IF x1  t  is M11  x1  t   and x2  t  is N12  x2  t   THEN
x  t   A1 x  t   B1 u  t   a1
Rule 2:
(1.14)
IF x1  t  is M 22  x1  t   and x2  t  is N 22  x2  t   THEN
x  t   A 2 x  t   B2 u  t   a 2
Rule 3:
(1.15)
IF x1  t  is M 33  x1  t   and x2  t  is N 32  x2  t   THEN
x  t   A2 x  t   B2 u  t   a3
(1.16)
10
MEIC 教學講義
Xf
X1
X3
 1, 2 
1, 2 
 0, 0 
X2
Fig. 1.5 sum sets Xf  conv 
3
i 1
Xi 
in which M ij  x1  t   and N ij  x2  t   are membership functions and is shown in Figure 1.6. Besides,
in which the N 32  x2  t    N12  x2  t   . The defuzzification, i.e., Center of Gravity Defuzzification, is
carried out as
3
x  t    h i  x  t   A i x  t   B i u  t   a i 
(1.17)
i 1
where h i  z  t   
ωi  z  t  
3
 ω  z  t 
i 1
, hi  z  t   0 ,
3
 h  z  t   1
i 1
i
and
i
ωi  z  t     ij  z j  t    i  z  t  
1
(1.18)
j1
□
11
MEIC 教學講義
M 33
1
M 22
M11
N12
N 22
2
1
0
1
2
x1  t 
2
X3
1
x2  t 
X1
0
1
X2
Fig. 1.6 membership functions for the three linear sub-systems
1.4 An Example for the Nonlinear Pendulum System
Referring to Figure 1.7, we consider an open-loop pendulum system as follows:
θt  
g
k
sin  θ  t    θ  t 
l
m
(1.19)
where
l
is the length of the rod.
m
is the mass of the bob.
g
is the acceleration due to gravity.
k
is the friction.
t
is the angle by the rod and the vertical axis.
12
MEIC 教學講義

  3 2
 2
l

mg
0
Fig. 1.7 pendulum system
 System structure of the time-delay pendulum system:
In order to obtain a state model for the pendulum system (1.19), we set the state variables as
x1  t     t  and x2  t     t  . Then, the state equation is as follows:
x1  t   x2  t 
x2  t   
(1.20a)
g
k
sin  x1  t    x2  t 
l
m
(1.20b)
Considering the time delay effect in the actuality situation, we assume x2  t  is perturbed by time
delay and the modified pendulum system is given as:
13
MEIC 教學講義
x1  t     , t 
x2  t   
(1.21a)
g
k
sin  x1  t      , t 
l
m
(1.21b)
x2  t     t  for t    , 0
(1.21c)
where
  , t    x2  t   1    x2  t    t  
(1.22)
denoted a time-delay weighting function and   0,1 is the weighting coefficient. The limits 1 and
0 of  are corresponding to no delay term and to a completed delay term, respectively. If   1 ,
then  1, t    x2  t  , i.e., the time delay term  x2  t    t   is not considered. Besides,   t  is
the bounded time varying delay function in the state satisfying 0    t      , 0    t   ˆ  1 . The
quantity   t  is a vector-valued initial function on t    ,0 .
Substituting (1.22) into (1.21), we have the following Time-Delay Pendulum System (TDPS):
x1  t    x2  t   1    x2  t    t  
x2  t   
(1.23a)


g
k
sin  x1  t   
 x2  t   1    x2  t    t  
l
m
x2  t     t  for t    , 0
(1.23b)
(1.23c)
 Find the equilibrium points for the open-loop and closed-loop time-delay
pendulum system:
In order to find the nature equilibrium points of open-loop system (1.23), we substituting
14
MEIC 教學講義
x1  t   x1* , x2  t   x*2 , x1  t   0 , x2  t   0 and x2  t    t    x*2d
(1.24)
into (1.23) then we have:
0   x*2  1    x*2d


g
k
*
*
*
0   sin  x1    x2  1    x2d 
l
m

(1.25)


Moreover, if the TDPS (1.23) is stable then lim x2  t    t    x2  t   0 . In other words, x*2d  x*2
t 
as t   . Hence, (1.25) can be rewritten as
0  x*2


g
k *
*
0   sin  x1   x2
l
m

(1.26)
Thus, the nature equilibrium points
 , 0 . Besides,
x , x 
*
1
*
2
are located at
 n, 0
for n  0, 1 , i.e.,
 0, 0 
and
if we can apply a torque T  t  to the pendulum, this torque can be viewed as a
control input in the following controlled-TDPS:
x1  t    x2  t   1    x2  t    t  
x2  t   
(1.27a)


g
k
1
sin  x1  t   
 x2  t   1    x2  t    t    2 T  t 
l
m
ml
x2  t     t  for t    , 0
(1.27b)
(1.27c)
To find the new equilibrium points for the controlled-TDPS (1.27), we assume the controlled-TDPS
15
MEIC 教學講義
(1.27) is stable and substituting x1  t   x1* , x2  t   x*2 , x1  t   0 , x2  t   0 , x2  t    t    x*2 and
T  t   Tss into (1.27) then one has:
0  x*2


g
k * 1
*
0   sin  x1   x2  2 Tss
l
m
ml

(1.28)
or
Tss  gm l sin  x1* 
(1.29)
where Tss is the constant steady-state component. Obviously, in order to maintain
the new equilibrium points
 x , 0 ,
*
1
 x  t  , x  t 
1
2
to
the controller T  t  must have a constant steady-state
component that satisfies (1.29). Thus, we can conclude that the control object is to make states
 x  t  , x  t 
1
2
asymptotically approach to the equilibrium points
 x , 0  . Besides, the
*
1
x1* can be
chosen as 0 ,  or sin1 Tss gml  .
Remark 1.2: From (1.26) and (1.28), we know that if the TDPS is stable, then x2  t  asymptotically
approach to x*2  0 . In other words, we just have to consider the x1* in our controller design
procedure.
 Fuzzy controller design for the time-delay pendulum system with external
disturbance effect:
Referring to Figure 1.8, we add the external disturbance effect v  t  in the controller design.
Then, we can obtain the new state vector
16
MEIC 教學講義
 x1  t   x1*  x1  t  ,  x2  t   x*2  x2  t  ,
 x1  t    x1  t  ,  x2  t    x2  t  ,  x2  t    t    x*2d  x2  t    t  
(1.30)
and the new input vector  u  t   Tss  T  t  . It has to note that x*2  0 and x*2d  x*2 if the system is
stable. Substituting these new variables into controlled-TDPS (1.27), we obtain the following system
and denote it as controlled- Time-Delay Pendulum System with Disturbance (TDPSD):
 x1  t      x2  t   1      x2  t    t  
 x2  t  



(1.31a)


g
k
sin  x1*   x1  t    sin  x1*  
   x2  t   1      x2  t    t  
l
m
1
u t  vt
ml2
(1.31b)
 x2  t     t  for t    , 0
(1.31c)
The control problem for the system (1.31) is to find a control law  u  t  such that the state vector
 x  t  converges asymptotically to 0 as t   . In term of the original state vector x  t  this
means that we want to design a control law such that x  t  asymptotically converges to the
equilibrium point
 x , 0
*
1
as t   .
17
MEIC 教學講義
x1*
control
object

 x1  t 

x 0
*
2
x1  t 

 x2  t 

x2  t 
pendulum system
fuzzy
controller
u t

T t
t

Tss  gml sin  x1* 
steady-state
component
adding
delay and
noise effect
t


dt
t
Controller
Fig. 1.8 control for the pendulum system
According to the above discussion, the purpose of our control problem is to make
 x  t  , x  t     , 0 
1
2
as t   . In other words, the control object is to maintain a constant angle
for x1*   . Thus, the controlled-TDPSD (1.31) can be rewritten as follows:
 x1  t      x2  t   1      x2  t    t  
 x2  t  



(1.32a)


g
k
sin     x1  t    sin    
   x2  t   1      x2  t    t  
l
m
1
u t  vt
ml2
(1.32b)
 x2  t     t  for t    , 0
(1.32c)
Besides, since sin     x1  t    sin   x1  t   , (1.32) is equivalent to
 x1  t      x2  t   1      x2  t    t  
 x2  t  


(1.33a)


g
k
sin   x1  t    sin    
   x2  t   1      x2  t    t  
l
m
18
MEIC 教學講義

1
u t  vt
ml2
(1.33b)
 x2  t     t  for t    , 0
(1.33c)
Let us consider a numerical example for g  9.8 m/s 2 , l  2.5 m , m  1 kg , k  0.2 N/m and
  0.85 . In order to obtain the TD-ATSFSD for the pendulum system (1.33), it is necessary to apply
the linearization technique presented in section 1.1. Besides, we assume that the torque T  t  work in
the range of x1  t   0 , 360  . In term of the pendulum system (1.33) this means that the controller
 u  t  work in the range of  x1   180 , 180  . This condition has been shown in Figure 1.9.
Hence, we choose three linearization points as follows:
 x

,  xd ,  u  
oper1
  88
  x ,  xd ,  u oper2   0
 x

,  xd ,  u  
oper3
0 0
  88
0 0 ,
(1.34)
0 0  and
(1.35)
0 88
0 88
0 0
(1.36)
Then, three corresponding linear subsystems can be constructed by the above three operating points.
In which,
  x ,  xd ,  u oper 2
is the equilibrium point and the others are the off-equilibrium points.
Through the above three linearization points and defining membership functions as Figure 1.10, one
can obtain the TD-ATSFSD for the pendulum system (1.33), which is composed by three rules as
follows (see Appendix B):
19
MEIC 教學講義
 x1  0
x1  180
x1  92
x1  268
 x1  88
 x1  88
Torque T  t  Work Space
Fuzzy Controller  u  t 
Work Space
x1  0 , 360 
 x1   180 , 180 
Fig. 1.9 controller work space  x1  t   180  x1  t 
M 31
M 21
M11
 x1  t 
180
88
45
0 45
88
180
Fig. 1.10 membership function of x1  t 
Rule i:
IF  x1  t  is M i1 THEN
 x  t   Ai  x  t   Aid  x  t    t    Bi  u  t   ai  E v  t  , i  1, 2, 3 , x  t   Xi , i ˆI
 x2  t     t  for t    , 0 ,
(1.37)
For Rule 1 we have
0.85 
 0
0 0.15 
 0 
 0 
0 
A1  
, A1d  
, B1  
, a1  
and E    .




0.171 0.17 
0 0.03
0.25
 4.6344 
1 
(1.38a)
20
MEIC 教學講義
For Rule 2 we have
0.85 
 0
0 0.15 
 0 
0 
0 
, A 2d  
, B2  
, a 2    and E    .
A2  



 4.9 0.17 
0 0.03
0.25
1 
0 
(1.38b)
For Rule 3 we have
0.85 
 0
0 0.15 
 0 
 0 
0 
, A3d  
, B3  
, a3  
and E    .
A3  




0.171 0.17 
0 0.03
0.25
 4.6344 
1 
(1.38c)
Given a pair of
  x  t  ,  u  t   , the final outputs of the TD-ATSFSD (1.37) are inferred as follows:
3


 x  t    h i   x1  t   Ai  x  t   Aid  x  t    t    Bi  u  t   ai  E v  t 
i 1
 x2  t     t  for t    , 0
(1.39)
Here, the following PDC fuzzy controller is used to control the fuzzy system (1.39).
Rule i:
IF  x1  t  is M i1
THEN
 u  t   Fi  x  t   μi , i  1, 2, 3
(1.40)
The output of the PDC type fuzzy controller (1.40) is determined by the following summation
3
 u  t    h i   x1  t   Fi  x  t   μi 
(1.41)
i 1
Substituting (1.41) into (1.39), one can obtain the corresponding closed-loop system
21
MEIC 教學講義
3

3

 x  t    h i   x1  t   h j   x1  t   Gij x  t   gij  Aid  x  t    t    E v  t 
i 1 j1
3
3
  h i   x1  t   h j   x1  t  
i 1 j1
 G  G ji
  ij
2


 g ij  g ji
 xt  

 2
  A id  A jd

2
 


  x  t    t    E v  t 


 x2  t     t  for t    , 0
(1.42)
Appendix A
 Linearization for the Nonlinear Mathematical Dynamic Equations
The object of linearization is to derive a linear model whose response will agree closely with that
of nonlinear model. Although the responses of the linear and nonlinear models will not agree exactly
and may differ significantly under some conditions, there will generally be a set of inputs and initial
conditions for which the agreement will be satisfactory. The linearization approach introduced in this
section is based on the small signal linearization method. We first consider the linearization of a single
element law that is a nonlinear function of a single variable. One can express such an element law as
an algebraic function f  x  . It is assumed that the operating point is x  x 0 . Rewriting the nonlinear
function f  x  as a Taylor series gives
f  x0   x   f  x0  
d f  x
dx
 x O  f 
(A1)
x  x0
where O  f  denotes the higher-order terms of the Taylor series of nonlinear function f . The small
signal equation of (A1) is given as
22
MEIC 教學講義
f  x0   x   f  x0  
d f  x
dx
x
x x
(A2)
0
Thus, the small signal equivalent linearization is obtained by replacing all nonlinear elements by their
slopes at the operating points, as shown in Figure 1-11, and by keeping linear components unchanged.
f  x
d f  x
dx
f  x   x
f  x0 
0
x  x0
operating point
x0 x0   x
Fig. 1-11 Linearization of a nonlinear function around the operating point
Extending the linearization technique in the above statements to more general state-space
dynamic models requires careful notation, but no fundamentally different methods. Given a nonlinear
set of state-space dynamic equations as follows:
X t  FX t , U t , t 
(A3a)
Y t  G X t , U t , t 
(A3b)
where X  t    x1
x2
xn 
T
denotes the state vector; U  t   u1 u2
23
um 
T
denotes the
MEIC 教學講義
input vector; and Y  t    y1
yp 
y2
T
denotes the output vector. For a slightly cleaner
notation in the following, the time-dependence of every vector is omitted. It is assumed that the ith
equation of (A3a) can be represented as the following nonlinear equation:
d xi
 fi  x1 , x2 ,
dt
, xn , u1 , u2 ,
, um , t 
(A4)
Applying the Taylor series approach, the above equation can be expanded as
d 0
 xi   xi   fi  x10 , x20 ,
dt
+
, xn0 , u10 , u20 ,
 fi
f
 x1  i  x2 
 x1 0
 x2 0

, um0 , t 
 fi
f
f
 xn  i  u1  i  u2 
 xn 0
 u1 0
 u2 0

 fi
 um  O  f 
 um 0
(A5)
where the term
 fi
 fi
t has been omitted on the assumption that either
 0 or that variations
t 0
t 0
with respect to t are not of interest, as can be justified in a context which is beyond the scope of this
discussion since time-invariant systems are of principle importance. Note that (A5) is the ith row of
(A3a). Thus, (A3a) can be expanded by using the same process as follows:
d 0 d
X  X  F  X 0 , U 0 , t 
dt
dt
  f1

  x1
+

  fn

  x1
0
0
  f1
 f1 


 xn 0    x1    u1



 



x
 f n   n    f n


 xn 0 
  u1
0
0
24
 f1 

 um 0    u1 
 O F

 



 f n   um 

 um 0 
(A6)
MEIC 教學講義
where the vectors X 0 and U 0 correspond to a solution of F  X  t  , U  t  , t   0 . The above
equation is often written more compactly as
d 0 d
 F 
 F 
X  X  F  X0 , U0 , t     X    U  O  F 
dt
dt
 X  0
 U  0
(A7)
The leftmost term on the left-hand side of (A7) equals the leftmost term on the right-hand side.
Furthermore, provided that the desired solution differs from X 0 and U 0 by an amount small
enough to allow the higher-order terms to be ignored, then the following equation describes the
deviations of the solutions from X 0 and U 0 :
d
 F 
 F 
X    X    U
dt
 X  0
 U  0
(A8)
 F 
The matrix   is called the Jacobian matrix of F  X  t  , U  t  , t  with respect to X , and
 X 
 F 
 U  is called the Jacobian matrix of F  X  t  , U  t  , t  with respect to U . As before, the
subscript means that the entries are evaluated at the known solution x1  x10 ,
, xn  xn0 , u1  u10 ,
, um  um0 .
Similarly, Equation (A3b) can be expanded as follows:
 G 
 G 
Y0  Y  G  X0 , U0 , t     X    U  O  G 
 X  0
 U  0
(A9)
Thus, the part describing the deviations from the solution is, on dropping the higher-order terms, as
follows:
25
MEIC 教學講義
 G 
 G 
Y    X    U
 X  0
 U  0
(A10)
Equations (A8) and (A10) are called the linearization of (A3a) and (A3b) respectively, at X0  t  and
U0  t  . As well as, the pair of vectors X0  t  , U0  t  is then called the operating point of the
system.
Appendix B
 MATLAB code for Figure 1.3
clear
d0=-5; dt=0.5; df=5;
[x1 x2]=meshgrid(d0:dt:df,d0:dt:df);
dx1=2*x1-x1.*x2;
u=0;
dx2=2*(x1.*x1)-x2+u;
quiver(x1,x2,dx1,dx2,4),xlabel('x1'),ylabel('x2');
hold on
clear
clc
t0=0;
tf=20; % i.c.
dt=0.001;
t=t0:dt:tf;
x1=zeros(length(t),1);
x2=zeros(length(t),1);
x1_ini=[0.01 -0.01 0.01 -0.01]; % i.c.
x2_ini=[-5 -5 0 0];
for k=1:length(x1_ini)
26
MEIC 教學講義
x1(1)=x1_ini(k);
x2(1)=x2_ini(k);
for i=1:length(t)-1
x1dot=2*x1(i)-x1(i)*x2(i);
x1(i+1)=x1(i)+dt*x1dot;
x2dot=2*(x1(i)^2)-x2(i);
x2(i+1)=x2(i)+dt*x2dot;
end
plot(x1,x2),axis([-5,5,-5,5]),hold on
plot(x1_ini(k),x2_ini(k),'r*')
end
title('dx1=2x1-x1x2
dx2=2(x1^2)-x2'),...
xlabel('x1'),ylabel('x2')
 MATLAB code for Figure 1.4
clear
clc
syms x1 x2 u;
w=[2*x1-x1*x2;...
2*(x1^2)-x2+u]
v=[x1 x2];
p=[u];
A=simplify(jacobian(w,v))
B=simplify(jacobian(w,p))
A1=subs(A,{x1,x2},{1,2})
A2=subs(A,{x1,x2},{0,0})
A3=subs(A,{x1,x2},{-1,2})
B1=subs(B,{},{})
B2=subs(B,{},{})
B3=subs(B,{},{})
a1=subs(w,{x1,x2,u},{1,2,0})-A1*[1;2]-B1*[0]
a2=subs(w,{x1,x2,u},{0,0,0})-A2*[0;0]-B2*[0]
a3=subs(w,{x1,x2,u},{-1,2,0})-A3*[-1;2]-B3*[0]
%%% for nonlinear system %%%%%%%%%%%%%%%%%%%%%%%%%
27
MEIC 教學講義
d0=-3; dt=0.4; df=3;
[x1 x2]=meshgrid(d0:dt:df,d0:dt:df);
dx1=2*x1-x1.*x2;
u=0;
dx2=2*(x1.*x1)-x2+u;
subplot(2,2,1),
quiver(x1,x2,dx1,dx2,5),axis([d0,df,d0,df]),xlabel('x1 (t)'),ylabel('x2 (t)'),
title('(a): nonlinear system'),hold on,plot(0,0,'r:o',1,2,'r:square',-1,2,'r:^')
%%%%% for operating point (1,2,0) %%%%%%%%%%%%
[x11 x12]=meshgrid(d0:dt:df,d0:dt:df);
dx11=-x12+2;
u=0;
dx12=4*x11-x12+u-2;
subplot(2,2,2),
quiver(x11,x12,dx11,dx12,3),axis([d0,df,d0,df]),xlabel('x1 (t)'),ylabel('x2 (t)'),
title('(b): operating point on (1,2,0)'),hold on,plot(1,2,'r:square')
%%%%% for operating point (-1,2,0) %%%%%%%%%%%%
[x31 x32]=meshgrid(d0:dt:df,d0:dt:df);
dx31=x32-2;
u=0;
dx32=-4*x31-x32+u-2;
subplot(2,2,3),
quiver(x31,x32,dx31,dx32,3),axis([d0,df,d0,df]),xlabel('x1 (t)'),ylabel('x2 (t)'),
title('(d): operating point on (-1,2,0)'),hold on,plot(-1,2,'r:^')
%%%%% for operating point (0,0,0) %%%%%%%%%%%%
[x21 x22]=meshgrid(d0:dt:df,d0:dt:df);
dx21=2*x21;
u=0;
dx22=-x22+u;
28
MEIC 教學講義
subplot(2,2,4),
quiver(x21,x22,dx21,dx22,3),axis([d0,df,d0,df]),xlabel('x1 (t)'),ylabel('x2 (t)'),
title('(c): operating point on (0,0,0)'),hold on,plot(0,0,'r:o')
 MATLAB code for Section 1.4
clear
clc
g=9.8;
l=2;
m=1;
k=0.2;
de=0.85;
%%%%%%%%%%%%%%%%%%%%%%%%%
x1_op1=92*pi/180;
x2_op1=0;
x1d_op1=0;
x2d_op1=0;
u_op1=0;
x1_op2=180*pi/180;
x2_op2=0;
x1d_op2=0;
x2d_op2=0;
u_op2=g*m*l*sin(x1_op2);
x1_op3=268*pi/180;
x2_op3=0;
x1d_op3=0;
x2d_op3=0;
u_op3=0;
oper_1=[x1_op1,x2_op1,x1d_op1,x2d_op1,u_op1];
oper_2=[x1_op2,x2_op2,x1d_op2,x2d_op2,u_op2];
oper_3=[x1_op3,x2_op3,x1d_op3,x2d_op3,u_op3];
shift_x=oper_2;
29
MEIC 教學講義
%%%%%%%%%%%%%%%%%%%%%%%%%%
new_oper_1=shift_x-oper_1;
new_oper_2=shift_x-oper_2;
new_oper_3=shift_x-oper_3;
%%%%%%%%%%%%%%%%%%%%%%%%%%
syms x1 x2 x1d x2d u;
delay=de*x2+(1-de)*x2d;
w=[delay;...
(g/l)*(sin(x1_op2-x1)-sin(x1_op2))-(k/m)*delay+(1/(m*(l^2)))*u];
v=[x1 x2];
p=[x1d x2d];
q=[u];
A=simplify(jacobian(w,v));
Ad=simplify(jacobian(w,p));
B=simplify(jacobian(w,q));
A1=subs(A,{x1},{new_oper_1(1)});
A1d=subs(Ad,{0},{0});
B1=subs(B,{0},{0});
a1=subs(w,{x1,x2,x2d,u},{new_oper_1(1),new_oper_1(2),new_oper_1(4),new_oper_1(5)})...
-A1*[new_oper_1(1);new_oper_1(2)]-A1d*[new_oper_1(3);new_oper_1(4)]-B1*new_oper_1(5);
A2=subs(A,{x1},{new_oper_2(1)});
A2d=subs(Ad,{0},{0});
B2=subs(B,{0},{0});
a2=subs(w,{x1,x2,x2d,u},{new_oper_2(1),new_oper_2(2),new_oper_2(4),new_oper_2(5)})...
-A2*[new_oper_2(1);new_oper_2(2)]-A2d*[new_oper_2(3);new_oper_2(4)]-B2*new_oper_2(5);
A3=subs(A,{x1},{new_oper_3(1)});
A3d=subs(Ad,{0},{0});
B3=subs(B,{0},{0});
a3=subs(w,{x1,x2,x2d,u},{new_oper_3(1),new_oper_3(2),new_oper_3(4),new_oper_3(5)})...
-A3*[new_oper_3(1);new_oper_3(2)]-A3d*[new_oper_3(3);new_oper_3(4)]-B3*u_op3;
30
Download