Transcript Slide 1

PLOTTING PHASE PORTRAITS WITH MATLAB:
Phase portraits is a useful graphical tool to understand the stable or unstable
behavior of the equilibrium points of a nonlinear systems.
Consider the previous example,
x  0.6 x  3 x  x 2  0
dx 1
x1  x , x 2 
dt
x 1  x 2
x  x 2  0.6 x 2  3 x1  x 21
Matlab code to plot phase portraits
range for x1
range for x2
[x1, x2] = meshgrid(-4:0.2:1, -2:0.2:2);
x1dot = x2;
x2dot = -0.6*x2-3*x1-x1.^2;
quiver(x1,x2,x1dot,x2dot)
xlabel('x_1')
ylabel('x_2')
2.5
2
1.5
1
(-3,0)
(0,0)
0
2
x =xdot
0.5
-0.5
-1
-1.5
-2
-2.5
-5
-4
-3
-2
-1
x =x
1
0
1
2
Example: Consider the undamped simple pendulum
Matlab code to plot phase portraits
  g sin   0
l
l
Equilibrium points: (0, 0) and (p, 0)
Unstable
Stable
g
   sin 

l
m
3
2
1
2
θ
x1   , x 2    
  
x
g
range for x1 range for x2
L=1;g=9.81;
[x1, x2] = meshgrid(-1:0.2:5, -2:0.2:2);
x1dot = x2;
x2dot = -g/L*sin(x1);
quiver(x1,x2,x1dot,x2dot)
0
-1
-2
-3
-2
-1
0
1
2
x1
3
4
5
0.1
x
2
0.05
(0,0)
0
-0.05
-0.1
-0.1
-0.08
-0.06
-0.04
-0.02
0
x1
0.02
0.04
0.06
0.08
0.1
0.1
x
2
0.05
(p,0)
0
-0.05
-0.1
3.1
3.11
3.12
3.13
3.14
3.15
x1
3.16
3.17
3.18
3.19
3.2
  
g
   sin 

l
For l=1 m
  
  9.81sin 

At the equilibrium, all derivatives are zero
0  d
d  0
0  9.81sin d
0 rad
d 
p rad
Consider the small perturbations around the equilibrium point θd=0
  d  e1  e1
  d  e 2  e 2
e1  e 2
e 2  9.81 sin e1
Nonlinear terms can be linearized
using the Maclaurin series.
f (e)  f (0) 
f (0)
f (0) 2
e
e 
1!
2!
e1
l
m
cos(e1 )  cos0 
For θd=0
cos0
sin(0) 2
sin(e1 )  sin 0 
e1 
e 
1
2
sin e1   e1
e1  e 2
e 2  9.81 e1
cose1   1
1  e1 
 e 1   0
e    9.81 0 e 
  2
 2 
A
For θd=p
  d  e1  p  e1
  d  e 2  e 2
e1  e 2
e 2  9.81 sinp  e1 
 e1
m
e1
l
sin 0
cos(0) 2
e1 
e 
1
2
Higher order term
clc;clear;
A=[0 1;-9.81 0];
eig(A)
ans =
0 + 3.1321i
0 - 3.1321i
Marginally stable
sin(p  e1 )  sinpcose1   cospsine1   e1
e 1  e 2
e 2  9.81 e1
 e1   0 1  e1 
e   9.81 0 e 
  2
 2 
clc;clear;
A=[0 1;9.81 0];
eig(A)
ans =
3.1321
-3.1321
Unstable
1  e1 
 e 1   0

e   9.81 0 e 
  2
 2 
Initial conditions
[0.1;0]
 e1   0 1  e1 
e   9.81 0 e 
  2
 2 
Initial conditions
[0.1;0]
Example:
Mathematical model of a nonlinear system is given by the equation
x2
2x  18x  128000
 0.03f
x  2
Where f(t) is the input and x(t) is the output of the system.
Find the equilibrium points for f=80 and linearize the system for small deviations
from the equilibrium points. Find the response of the system
The state variables are chosen as x1=x and x2=dx/dt=dx1/dt
x 1  x 2
x12
x 2  9x 2  64000
 0.015f
x1  2
>>solve(‘64000*x1^2/(x1+2)=1.2’)
x1d=0.00613, x2d=0
For the equilibrium condition
0  x 2d
x1=x1d+e1=0.00613+e1
0  9 x 2 d  64000
x
2
1d
x1d  2
x2=x2d+e2=e2
 0.015* 80
Karagülle, System Modeling and Analysis
x 1  x 2
x1=x1d+e1=0.00613+e1
x12
x 2  9x 2  64000
 0.015f
x1  2
x2=x2d+e2=e2
f=fd+u
e1  e 2
x1d  e1 
2
e 2  9e 2  64000
x1d  2  e1 
 0.015f d  u 
e 1  e 2
 1
 2
1
2

e 2  9e 2  64000

e
x

2
x
e

e
1d 1
1  0.015f d  0.015u
2 1  1d
 2  x1d 2  x1d  


e 1  e 2
 64000 64000  2
2

e 2  9e 2  

e
x

2
x
e

e
 0.015f d  0.015u
1
1
d
1
1
1
d
2

 2  x1d 2  x1d  
e 1  e 2


 64000x12d 128000x1d e1
128000x1d e 21 
64000
2
  0.015f d  0.015u
e 2  9e 2  


ex 
2 1 1d
2
 2 x
2  x1d
2  x1d 
2  x1d  
1d

0  x 2d
x12d
0  9 x 2 d  64000
 0.015* fd
x1d  2
=0
e1  e 2
128000x1d e1
64000x12d
64000
e 2  9e 2 
 0.015f d 

e x 2  0.015u
2 1 1d
2  x1d
2  x1d
2  x1d 
=0
 390.52e1
e1  e 2
e 2  9e 2  390.52e1  0.015u
clc;clear;
1   e1   0  A=[0 1;-390.52 -9];
 e 1   0
e    390.52  9 e   0.015 u eig(A)
  2 

 2 
ans =
-4.5000 +19.2424i
-4.5000 -19.2424i
Stable system
Matlab code for step input with magnitude 2
clc;clear
a=[0 1;-390.52 -9];b=[0 0.015]';c=[1 0];d=0;
sys=ss(a,b,c,d);
t=[0:.025:2];
[y,t,x]=step(sys*2,t);
plot(t,y,'--','Linewidth',2);axis([0 2 0 0.00015]);grid;
xlabel('time (sec)');ylabel('Y output');title('Step Response')
c=[0 1]
-4
1.5
-3
Step Response
x 10
1.5
Step Response
x 10
1
1
e
e
1

0.5
0
0.5
-0.5
0
-1
0
0.2
0.4
0.6
0.8
1
time (sec)
1.2
1.4
1.6
1.8
2
0
0.2
0.4
0.6
0.8
1
time (sec)
1.2
1.4
1.6
1.8
2
u(t)
2
t
We can obtain the same result using Simulink.
e2
e1
e2
e1
Example:
Phase portrait of a linear system.
c
k
R
2

1
11
1
2
2 x

E1  m x 
2 m R    m  m x 2
2
22
2
R
2
2m
1 x 
1 2
E2  k  R   k x
2 R 
2
W  c x x
m
x(t)
d  E1  E 2
 Qx


dt  x  x
2 m x  k x  cx
2mx  cx  kx  0
x1=x
x2=dx/dt=dx1/dt
Initial conditions:
x1(0)=0.2
x 1  x 2
x 2  
c
k
x2 
x1
2m
2m
(dx/dt)t=0=x2(0)=1
x 1  x 2
x 2  
c
k
x2 
x1
2m
2m
At equilibrium
Matlab Code:
0  x 2d
m=10;c=2;k=1000;
[x1, x2] = meshgrid(-0.5:0.1:0.5, -2:0.2:2);
x1dot = x2;
x2dot = -c/(2*m)*x2-k/(2*m)*x1;
quiver(x1,x2,x1dot,x2dot)
0
c
k
0
x1
2m
2m d
Damping ratio
c
2
2



 0.007
282
.
84
2 km 2 1000* 2 *10
x1d  x d  0
x 2 d  x d  0
2
meş=2m
1.5
1
Initial
Equilibrium
xdot
0.5
0
-0.5
-1
-1.5
-2
-0.4
-0.2
0
x
0.2
0.4
0.6
Matlab Code:
Damping ratio
m=10;c=40;k=1000;
c
40
40



 0.141 [x1, x2] = meshgrid(-0.5:0.1:0.5, -2:0.2:2);
2 km 2 1000* 2 *10 282.84
x1dot = x2;
x2dot = -c/(2*m)*x2-k/(2*m)*x1;
quiver(x1,x2,x1dot,x2dot)
2
1.5
1
xdot
0.5
0
-0.5
-1
-1.5
-2
-0.4
-0.2
0
x
0.2
0.4
0.6
Matlab Code:
Damping ratio
c
150
150



 0.53
2 km 2 1000* 2 *10 282.84
m=10;c=150;k=1000;
[x1, x2] = meshgrid(-0.5:0.1:0.5, -2:0.2:2);
x1dot = x2;
x2dot = -c/(2*m)*x2-k/(2*m)*x1;
quiver(x1,x2,x1dot,x2dot)
2
1.5
1
xdot
0.5
0
-0.5
-1
-1.5
-2
-0.4
-0.2
0
0.2
0.4
0.6
Example:
x(t)
k
m
µ (Coulomb friction)
mx  kx  sgn x mg  0
x1=x
At equilbrium
x2=dx/dt=dx1/dt
0  x 2d
x 1  x 2
x 2  
k
sgn x 2 mg
x1 
m
m
sgn x 2 d mg
k
0   x1d 
m
m
mg
x 1d  x d  
k
x 2 d  x d  0
2
1.5
0.2 m
1
xdot
0.5
0
-0.5
-1
-1.5
-2
-0.4
-0.2
0
µ*g=0.1*9.81=0.981
k/m=500/10=50
x
0.2
0.4
0.6
m=60;k=500;mu=0.3;g=9.81;
[x1, x2] = meshgrid(-0.5:0.1:0.5, -2:0.2:2);
x1dot = x2;
x2dot = -(k/m)*x1-sign(x2)*mu*g;
quiver(x1,x2,x1dot,x2dot)
1
0.8
0.6
0.4
xdot
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
-0.4
-0.3
-0.2
-0.1
0
x
0.1
0.2
0.3
0.4
Example: Van der Pol Equation

2c
x   x
m
Mass-spring-damper system with a position
dependent damper.

k
 1 x  x
m
2


m x  2 c x 1 x  k x  0
2
m=10, c=20, k=1000
2c 2
2c
k
x   x x  x  x
m
m
m
2 * 40 2
2 * 20
1000
x  
x x 
x 
x
10
10
10
x  8 x 2 x  4x  100x
The Van der Pol equation can be regarded as describing a mass-springdamper system with a position-dependent damping coefficient 2c(x2-1) (or,
equivalently, an RLC electrical circuit with a nonlinear resistor). For large
values of x, the damping coefficient is positive and the damper removes
energy from the system. This implies that the system motion has a convergent
tendency. However, for small values of x, the damping coefficient is negative
and the damper adds energy into the system. This suggest that the system
motion has a divergent tendency. Therefore, because the nonlinear damping
varies with x, the system motion can neither grow unboundly nor decay zero.
Instead, it displays a sustained oscillation independent of initiao conditions.
This so-called limit cycle is sustained periodically releasing energy into and
absorbing energy from the environment, through the damping term. This is in
contrast with the case of conservative mass-spring system, which does not
exchange energy with its environment during its vibration.
Slotine and Weiping, Applied Nonlinear Control.
Of course, sustained oscillations can also be found in linear systems, in the
case of marginally stable linear systems (such as a mass-spring system
without damping) or in the response to sinusoidal inputs. However, limit
cycles in nonlinear systems are difefrent from linear oscillations in a number
of fundamental aspects. First, the amplitude of the self-sustained excitation is
independent of initial consitions, while the oscillation of a marginally stable
linear system has its amplitude determined by its initial conditions. Second,
marginally stable linear systems are very sensitive to changes in system
parameters (with a slight change capable of leading either to stable
convergence or to instability), while limit cycles are not easily affected by
parameter changes.
Limit cycles represent an important phenomenon in nonlinear systems. They
can be found in many areas of engineering and nature. Aircraft wing
fluttering, a limit cycle caused by the interaction of aerodynamic forces and
structural vibrations, is frequently encountered and is sometimes dangerous.
Slotine and Weiping, Applied Nonlinear Control.
0
0.2
Limit cycle
(0.2,0)
0
0.6
Limit cycle
(0.6,0)
2
0.6
Limit cycle
(0.6,2)
Important Behaviors of Nonlinear Systems:
Bifurcations:
As the parameters of nonlinear dynamic systems are changed, the stability of
equilibrium point can change and so can the number of equilibrium points.
Values of these parameters at which the qualitative nature of the system’s
motion changes are known as critical or bifurcation values.The phenomenon
of bifurcation, i.e., quantitaive change of parameters leading to qualitative
change of system properties, is the topic of bifurcation theory.
Let us consider the system described by the co-called undamped Duffing
equation (mass-spring system with a hardening spring).
x   x  x 3  0
Pitchfork bifurcation
Hopf bifurcation
Slotine and Weiping, Applied Nonlinear Control.
Chaos:
For stable linear systems, small differences in initial conditions can only cause
small differences in output. Nonlinear systems, however, can display a
phenomenon called chaos, by which we mean that the system output is
extremely sensitive to initial conditions. The essential feature of chaos is the
unpredictability of the system output. Even if we have an exact model of a
nonlinear system and an extremely accurate computer, the system’s response
in the long-run still cannot be well predicted.
As an example of chaotic behavior, let us consider the simple nonlinear system
x  0.1 x  x 5  6 sin t
which may represent a lightly-damped, sinusoidally forced mechanical structure
undergoing large elastic deflections. Consider two almost identical initial
conditions, namely x(0)=2, (dx/dt)0=3 and x(0)=2.01, (dx/dt)0=3.01. Due to the
strong nonlinearity in x5, the two responses are radically different after some
time.
Slotine and Weiping, Applied Nonlinear Control.
x(0)  2 , x (0)  3
x(0)  2.01, x (0)  3.01
Displacement
2.5
2
1.5
1
x(t)
0.5
0
-0.5
-1
-1.5
-2
-2.5
0
5
10
15
20
25
Time (sec)
30
35
40
45
50
x(0)  2 , x (0)  3
x(0)  2.01, x (0)  3.01
6
Velocity
4
xdot(t)
2
0
-2
-4
-6
0
5
10
15
20
25
30
Time (sec)
35
40
45
50
Small changes in initial conditions can cause recordable changes in the
output of the system.