EXAMPLE: Energy and stability of pendulum system
Figure 5 Pendulum system with parameters
Let
, denote the state variables. Then
equation (2)
is rewritten as
Equilibrium point
is obtained as
Therefore,
is one of the
Equilibrium point
. Besides, the
mechanical energy
of pendulum system
equation (3)
is
where the first term at right hand is called
kinetic energy
, the second one is called
potential energy
as is shown in
Figure 6
Figure 6 Mechanical energy of pendulum
When
, that the position of pendulum is six o'clock, and velocity of it is 0, then
. For any other state
there is
. The derivative of
with
equation (3)
as simultaneous equations in order to cancel derivatives of states, the following formula holds as
Assume
Matlab code of machanical energy is:
[X,Y] = meshgrid(-7:0.1:7,-10:0.1:10);
Z = Y.^2 + 9.8*(1-cos(X));
surf(X,Y,Z)
xlabel('angle')
ylabel('angular velocity')
Figure 7 Mechanical energy of pendulum (Matlab chart)
Matlab code of
is:
[X,Y] = meshgrid(-7:0.1:7,-10:0.1:10);
Z = -Y.^2;
surf(X,Y,Z)
xlabel('angle')
ylabel('angular velocity')
Figure 8 Derivative of pendulum mechanical energy (Matlab chart)
Note that
is a
positive-definite function
(PDF), (
), while
. Unlike single-variable functions, whose time-derivatives indicate monotonicity, multi-variable function as shown in
equation (5)
, whose time-derivative is utilized to exploit the stability of an equilibrium point.
[ref]
Generally,
which in a scalar (dot) product can be written as
Here, the first vector is the
gradient
of
, id est,
it’s always directed toward the greatest increase in
. The second vector is velocity vector, it is always tagent to the
phase trajectory
.
(a)
(b)
Figure 9 (a) Lyapunov function. (b) Phase trajectory.
Take pendulum system
equation (3)
again for example, the gradient and phase trajectory of which is obtained by Matlab code as below
[ref]
:
x=-pi:pi/20:pi;
y=x';
z = y.^2 + 9.8*(1-cos(x));
[px,py] = gradient(z);
figure
contour(x,y,z)
hold on
quiver(x,y,px,py)
hold off
xlabel('angle')
ylabel('angular velocity')
x=-pi:pi/20:pi;
y=x';
z = y.^2 + 9.8*(1-cos(x));
vx = y*ones(1,41);
vy=-9.8*sin(x)-y*ones(1,41);
figure
contour(x,y,z)
hold on
quiver(x,y,vx,vy)
hold off
xlabel('angle')
ylabel('angular velocity')
(a)
(b)
Figure 10 (a) Gradient chart. (b) Phase trajectory chart.
For
phase trajectory
and
state trajectory
of system
(2)
[ref]
[ref]
[ref]
[ref]
syms x(t)
[V] = odeToVectorField(diff(x, 2) == -diff(x,1) - 9.8*sin(x));
M = matlabFunction(V,'vars', {'t','Y'});
sol = ode45(M,[0 20],[2 2]);
z = linspace(0,20,1000);
x1 = deval(sol,z,1);
x2 = deval(sol,z,2);
figure
hold on;
plot(x1,x2);
xlabel('angle')
ylabel('angular velocity')
hold off;
figure
hold on;
fplot(@(x)deval(sol,x,1), [0, 20])
xlabel('time')
ylabel('angle')
hold off;
figure
hold on;
fplot(@(x)deval(sol,x,2), [0, 20])
xlabel('time')
ylabel('angular velocity')
hold off;
Figure 11 Phase portrait
Figure 12(a) angle trajectory
Figure 12(b) angular velocity trajectory
Test initial condition for
[5,5],[3.14,5],[3.14,0],[3.14,-5],[pi,0].
Back to
equation (6)
, when
, if
, there are chances that
is stable. Whatsoever,
When
, then
. Such that,
, when
. Therefore, such "equilibriums" are not stable.
Figure (13)
and
figure (14)
represent
mechnical energy
of pendulum system
(2)
and its time derivatives respectively. The matlab code is
...
fplot(@(x) 0.5*deval(sol,x,2).^2+9.8-9.8*cos(deval(sol,x,1)), [0, 20])
fplot(@(x) -deval(sol,x,2).^2, [0, 20])
Figure 13
Figure 14