You are on page 1of 30

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 Matlab code to plot phase portraits

dx1 range for x1 range for x2

x1  x , x 2  [x1, x2] = meshgrid(-4:0.2:1, -2:0.2:2);


dt x1dot = x2;
x2dot = -0.6*x2-3*x1-x1.^2;
x 1  x 2 quiver(x1,x2,x1dot,x2dot)
xlabel('x_1')
x  x 2  0.6 x 2  3 x1  x 21 ylabel('x_2')
2.5

1.5

0.5
x =xdot

(-3,0) (0,0)
0
2

-0.5

-1

-1.5

-2

-2.5
-5 -4 -3 -2 -1 0 1 2
x =x
1
Example: Consider the undamped simple pendulum
Matlab code to plot phase portraits
  g sin   0
l L=1;g=9.81; range for x1 range for x2
[x1, x2] = meshgrid(-1:0.2:5, -2:0.2:2);
x1   , x 2     x1dot = x2;
l x2dot = -g/L*sin(x1);
g
θ    quiver(x1,x2,x1dot,x2dot)

g Equilibrium points: (0, 0) and (p, 0)


m 
   sin 
l Stable Unstable
3

1
2

0
x

-1

-2

-3
-2 -1 0 1 2 3 4 5
x1
0.1

0.05

2
0 (0,0)
x

-0.05

-0.1
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
x1
0.1

0.05

(p,0)
2

0
x

-0.05

-0.1
3.1 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.2
x1
     
For l=1 m
g   9.81sin 

   sin 
l
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 Nonlinear terms can be linearized l


  d  e 2  e 2
using the Maclaurin series. e1

e 1  e 2 f (0) f (0) 2
f (e)  f (0)  e e  m
1! 2!
e 2  9.81 sin e1
sin 0
cos(e1 )  cos0 
cos(0) 2
e1  e 
For θd=0 1 2
cose1   1
cos0
Higher order term

sin( e1 )  sin 0 


sin( 0) 2
e1  e 
1 2
sin e1   e1 clc;clear;
A=[0 1;-9.81 0];
e 1  e 2  e1   0 1  e1  eig(A)
e    9.81 0 e 
e 2  9.81 e1  2    2
ans =

0 + 3.1321i
0 - 3.1321i
A
Marginally stable
For θd=p
m sin( p  e1 )  sin pcose1   cospsin e1   e1
  d  e1  p  e1
e1
  d  e 2  e 2 e 1  e 2  e1   0 1  e1 
l e   9.81 0 e 
e 1  e 2 e 2  9.81 e1  2    2
e 2  9.81 sin p  e1  clc;clear; ans =
A=[0 1;9.81 0]; 3.1321

 e1 eig(A) -3.1321

Unstable
 e1   0 1  e1 
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 >>solve(‘64000*x1^2/(x1+2)=1.2’)
x 2  9x 2  64000  0.015 f
x1  2 x1d=0.00613, x2d=0
For the equilibrium condition

0  x 2d x1=x1d+e1=0.00613+e1

2 x2=x2d+e2=e2
x
0  9x 2 d  64000 1d
 0.015 * 80
x1d  2 Karagülle, System Modeling and Analysis
x 1  x 2 x1=x1d+e1=0.00613+e1
x12 x2=x2d+e2=e2
x 2  9x 2  64000  0.015 f
x1  2 f=fd+u

e 1  e 2
1 1 1
  2e
a e a a

e 2  9e 2  64000
x1d  e1 2  0.015 f d  u 
1

1

2
a  e 2 a 2 a 3
e

x1d  2  e1 
e 1  e 2 a
 1  2
x1d  2x1d e1  e12   0.015 f d  0.015 u
1
e 2  9e 2  64000  e
2x 2  x1d  
2 1
 1d

e1  e 2
 64000  2
x  2 x1d e 1   0.015 f d  0.015 u
64000
e2  9e 2    e
2 1  1d
 2  x1d 2  x1d  
e 1  e 2
 64000 x12d 128000x1d e1 64000 128000x1d e 21 
e 2  9e 2     e1x1d 
2   0.015 f d  0.015 u
 2 x
 1d 2  x1d 2  x1d 2
2  x1d  
2
0  x 2d
x12d
0  9x 2 d  64000  0.015 * fd
x1d  2
=0

e 1  e 2
64000 x12d 128000x1d e1 64000
e 2  9e 2   0.015 f d   e x 2  0.015 u
2  x1d 2  x1d 2  x1d 2 1 1d

=0  390.52 e1

e 1  e 2
e 2  9e 2  390.52 e1  0.015 u
clc;clear; ans =
 e 1   0 1   e1   0  A=[0 1;-390.52 -9];
e    390.52  9 e   0.015 u eig(A) -4.5000 +19.2424i
 2    2   -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 -3
x 10 Step Response Step Response
1.5 x 10
1.5

0.5

1

e
e

0.5

-0.5

-1
0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
time (sec) time (sec)
u(t)
2

We can obtain the same result using Simulink.

e2 e2

e1 e1
Example:
Phase portrait of a linear system.
c 2
2 x

2 m R    m  m x 2
1 11 1
E1  m x 
 2

R
k 2 22 R 2
2
1 x  1 2
E2  k  R   k x
2m 2 R  2
W  c x x
m
x(t) x1=x
Initial conditions:
d  E1  E 2 x2=dx/dt=dx1/dt
   Qx x1(0)=0.2
dt  x  x
x 1  x 2 (dx/dt)t=0=x2(0)=1
2 m x  k x  cx
c k
2mx  cx  kx  0 x 2   x2  x1
2m 2m
At equilibrium Matlab Code:
x 1  x 2
0  x 2d m=10;c=2;k=1000;
[x1, x2] = meshgrid(-0.5:0.1:0.5, -2:0.2:2);
c k
x 2   x2  x1 0
c
0
k
x1
x1dot = x2;
2m 2m 2m 2m d x2dot = -c/(2*m)*x2-k/(2*m)*x1;
quiver(x1,x2,x1dot,x2dot)

Damping ratio x 1d  x d  0
c 2 2
    0.007 x 2 d  x d  0
2 km 2 1000 * 2 *10 282.84
2
meş=2m
1.5

1
Initial
0.5
Equilibrium
xdot

-0.5

-1

-1.5

-2
-0.4 -0.2 0 0.2 0.4 0.6
x
Damping ratio Matlab Code:
c 40 40 m=10;c=40;k=1000;
    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)

1.5

0.5
xdot

-0.5

-1

-1.5

-2
-0.4 -0.2 0 0.2 0.4 0.6
x
Damping ratio Matlab Code:
c 150 150 m=10;c=150;k=1000;
    0.53 [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)

1.5

0.5
xdot

-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
k sgn x 2 d mg
x 1  x 2 0   x1d 
m m
k sgn x 2 mg mg
x 2   x1  x1d  x d  
m m
k
x 2 d  x d  0
2

1.5

0.2 m 1

0.5

xdot
0

-0.5

-1

-1.5

-2
-0.4 -0.2 0 0.2 0.4 0.6

µ*g=0.1*9.81=0.981
k/m=500/10=50 x
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)

0.8

0.6

0.4

0.2
xdot

-0.2

-0.4

-0.6

-0.8

-1
-0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4
x
Example: Van der Pol Equation Mass-spring-damper system with a position
dependent damper.

  
m x  2 c x  1 x  k x  0
2
m=10, c=20, k=1000

x   x  1 x  x
2c 2 k
m m
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-spring-
damper 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 initial 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 conditions, 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.
http://video.search.yahoo.com/video/play;_ylt=A2KLqITlkkNT93AAUWv7w8QF;_ylu=X3oDMTByZWc0dGJtBHNlYwNzcgRzbGsDdmlkBHZ0aWQDBGdwb3MDMQ--
?p=limit+cycle+phenomenon&vid=3bf1c20190a32951e8e985d5241568bc&l=00%3A10&turl=http%3A%2F%2Fts2.mm.bing.net%2Fth%3Fid%3DVN.608040160876104229%26
pid%3D15.1&rurl=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1DK-zGLK6GQ&tit=F-
16+Limit+Cycle+Oscillation+Chase+Video&c=0&sigr=11aio97j7&sigt=118c8pd6m&pstcat=news&age=0&hsimp=yhs-
yhsifmclone1&hspart=Babylon&type=br101dm84bs02ts902af110000&tt=b

http://video.search.yahoo.com/video/play;_ylt=A2KLqIR6k0NTRksASRv7w8QF;_ylu=X3oDMTBzOGgyNGpnBHNlYwNzcgRzbGsDdmlkBHZ0aWQDBGdwb3MDMTU-
?p=limit+cycle+phenomenon&vid=2b927582be94ea615e8234a346996a60&l=00%3A24&turl=http%3A%2F%2Fts2.mm.bing.net%2Fth%3Fid%3DVN.608036699129383049%26pi
d%3D15.1&rurl=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqfkkiDsEXUA&tit=Piper+PA+30+Twin+Comanche+Aircraft+Tail+Flutter+Test+%281966%29+%7C+NAS
A+Dryden+Flight+Research&c=14&sigr=11aircatc&sigt=12p6ai0eg&age=0&hsimp=yhs-yhsifmclone1&hspart=Babylon&type=br101dm84bs02ts902af110000&tt=b

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., quantitative 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

1.5

0.5
x(t)

-0.5

-1

-1.5

-2

-2.5
0 5 10 15 20 25 30 35 40 45 50
Time (sec)
x (0)  2 , x (0)  3
x (0)  2.01 , x (0)  3.01
Velocity
6

2
xdot(t)

-2

-4

-6
0 5 10 15 20 25 30 35 40 45 50
Time (sec)
Small changes in initial conditions can cause recordable changes in the
output of the system.

You might also like