stabilityex.m

来自「国外专家做的求解LMI鲁棒控制的工具箱,可以相对高效的解决LMI问题」· M 代码 · 共 37 行

M
37
字号
clc
echo on
%*********************************************************
%
% Lyapunov analysis using semidefinite programming
%
%*********************************************************

% Create a stable matrix
A = [-1 2;0 -2];
pause % Strike any key to continue. 

% Create symmetric matrix (full syntax)
P = sdpvar(2,2,'symmetric'); 
pause % Strike any key to continue. 

% Add SETs for stability
F = set(P>eye(2)) + set(A'*P+P*A<0)
pause % Strike any key to continue. 

% Find feasible solution, minimize trace(P)
solution = solvesdp(F,trace(P));
pause % Strike any key to continue. 

% Extract numerical solution
P_feasible = double(P);

% Check solution
eig(P_feasible)
eig(A'*P_feasible+P_feasible'*A)
pause % Strike any key to continue. 

% Checking the constraints can also be done with
checkset(F)

pause % Strike any key to continue. 
echo off

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?