필터 지우기
필터 지우기

I want to solve the Lyapunov equation with matlab

조회 수: 5 (최근 30일)
khawla mrad
khawla mrad 2024년 2월 27일
편집: Torsten 2024년 2월 28일
Why, when I calculate R, I don't find -I? Thank you."
% Définition des matrices du système
A = [0 1;0 0];% Remplacez ... par la matrice A de votre système
B=[2;5];
K=[-0.131 -1.6874];
Ak=A+B*K;
E = [1 2;0 0]; % Remplacez ... par la matrice E de votre système
I = eye(size(A)); % Matrice identité de même taille que A
Q = [1 0 ;0 1]; % Remplacez ... par une matrice Q définie positive
% Fonction pour résoudre l'équation de Lyapunov avec la condition E
lyapunov_solve = @(P) (Ak'*P*E + E'*P*Ak + I)
lyapunov_solve = function_handle with value:
@(P)(Ak'*P*E+E'*P*Ak+I)
% Initialisation de P
P0 = Q; % Vous pouvez également utiliser une autre initialisation si nécessaire
% Résolution de l'équation de Lyapunov avec la condition E
options = optimoptions('fsolve', 'Display', 'off'); % Options pour fsolve
Ps= fsolve(lyapunov_solve, P0, options)
Ps = 2×2
1.0881 -0.2826 -0.2826 1.0000
% Vérification de la positivité de P
if all(eig(Ps) > 0)
disp('La matrice P est définie positive.');
else
disp('La matrice P n''est pas définie positive.');
end
La matrice P est définie positive.
R =Ak'*Ps*E + E'*Ps*Ak
R = 2×2
-0.2000 -0.4000 -0.4000 -0.8000

답변 (2개)

Torsten
Torsten 2024년 2월 27일
Use MATLAB's "lyap" or "dlyap".
  댓글 수: 1
Christine Tobler
Christine Tobler 2024년 2월 28일
If you don't have Control Systems Toolbox, you can also look at the more generic sylvester function in base MATLAB.

댓글을 달려면 로그인하십시오.


Torsten
Torsten 2024년 2월 28일
편집: Torsten 2024년 2월 28일
You can also do it this way, but your system does not seem to have a solution:
% Définition des matrices du système
A = [0 1;0 0];% Remplacez ... par la matrice A de votre système
B=[2;5];
K=[-0.131 -1.6874];
Ak=A+B*K;
E = [1 2;0 0]; % Remplacez ... par la matrice E de votre système
I = eye(size(A)); % Matrice identité de même taille que A
Q = [1 0 ;0 1]; % Remplacez ... par une matrice Q définie positive
% Fonction pour résoudre l'équation de Lyapunov avec la condition E
P = sym('P',[2 2]);
eqns = Ak'*P*E + E'*P*Ak + I == 0;
[A,b] = equationsToMatrix(eqns)
A = 
b = 
sol = A\b
Warning: Solution does not exist because the system is inconsistent.
sol = 
lyap(Ak.',I,[],E.')
Error using lyap
The solution of this Lyapunov equation does not exist or is not unique.

카테고리

Help CenterFile Exchange에서 Matrix Computations에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by