As far as I know, there is no built-in function.m in MATLAB for directly performing the Lyapunov stability analysis. If you are referring to the Lyapunov candidate function, there is no standard technique to construct such a function for a given system, because the system must have a mathematical framework that lends itself to the formation of the Lyapunov function.
I haven't read the suggested paper, but here is an example. If and , then we can design so that the system becomes
.
This system is a special class of 2nd-order systems that is commonly seen in some mechanical motion systems and electrical RLC circuits. For this kind of system, the stability can always be proven without applying the LaSalle invariance principle by constructing the Quadratic Lyapunov Function
where is a positive symmetric matrix that can be designed based on the matrix formula given in the code.
syms x(t) y(t) k2 k3
% Assumptions
assume(k2 > 0 & k3 > 0)
assume([x(t) y(t)], 'real')
assumptions
% System
dx = y;
dy = - k3*x - k2*y;
% Definitions
v = [x; y]
P = [1/2*k2^2+k3 1/2*k2; 1/2*k2 1] % positive-definite matrix
% Lyapunov candidate function
V = v.'*P*v
% Differentiate V along trajectories of the System
dV = diff(V, t)
dV = subs(dV, {diff(x,t), diff(y,t)}, {dx, dy});
dV = simplify(dV)
% Test
tf = isAlways(dV(t) <= 0)