提问人:narip 提问时间:8/19/2023 更新时间:8/19/2023 访问量:28
当Lyapunov解不是唯一的时,如何强制matlab输出任何解?
How to force matlab output any solution when the Lyapunov solution is not unique?
问:
我想求解以下形式的李雅普诺夫方程
我在 Matlab 中使用了这段代码: 但是,Matlab 显示错误消息:如何强制它输出任何一个解决方案?Lambda = lyap(Cbar,Cbar,-2*Cbarprime);
The solution of this Sylvester equation does not exist or is not unique.
答:
0赞
narip
8/19/2023
#1
我们可以使用以下代码,该代码是从官方函数修改而来的,将矩阵 dA+dB' 中的一些元素(实际上是零元素)更改为 inf。sylvester
function X = mysylvester(A,B,C)
% Solve the equation A*X + X*B = C
A = (A + A') / 2;
B = (B + B') / 2;
[QA, dA] = eig(A, 'vector');
[QB, dB] = eig(B, 'vector');
CC = QA'*C*QB;
tmp = dA + dB';
idx = find(abs(tmp) <= 0.00001);
tmp(idx) = inf;
X = CC ./ tmp;
X = QA*X*QB';
end
评论