在MATLAB中找到未知矩阵的所有元素?

发布于 2025-02-05 21:20:38 字数 336 浏览 2 评论 0原文

我有一个4x4矩阵,我必须求解这个lyapnov方程,并找到满足以下方程的未知矩阵。

a = [0 1 0 0;0 0 -1 0;0 0 0 1;0 0 5 0];

f = [-1 1 0 0;-1 -1 0 0;0 0 -1.5 0.5;0 0 -0.5 -1.5];


b = [0;1;0;-2];

k = [1 0 1 0];

给出了方程式a t -tf = b k。

a*t - t*f = b*k ;

其中t = 4x4未知矩阵。您能帮我找到矩阵 t 吗?

I have a 4x4 matrix given and I have to solve this lyapnov equation and find the unknown matrix which satisfies the below equation .

a = [0 1 0 0;0 0 -1 0;0 0 0 1;0 0 5 0];

f = [-1 1 0 0;-1 -1 0 0;0 0 -1.5 0.5;0 0 -0.5 -1.5];


b = [0;1;0;-2];

k = [1 0 1 0];

The equation is given at - tf = bk.

a*t - t*f = b*k ;

where t = 4x4 unknown matrix . Can you help me find matrix t ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不羁少年 2025-02-12 21:20:38

您也可以使用符号数学来创建线性方程系统,然后解决此系统:

% Your variables
a = [0 1 0 0;0 0 -1 0;0 0 0 1;0 0 5 0];
f = [-1 1 0 0;-1 -1 0 0;0 0 -1.5 0.5;0 0 -0.5 -1.5];
b = [0;1;0;-2];
k = [1 0 1 0];

% The unknows:
t = sym('t', [4 4]);

% Create the symbolic system of linear equation
eq = a*t - t*f == b*k;

% Equation to matrix 
[A,b] = equationsToMatrix(eq);

% Solve the system and get a numeric solution
sol = double(reshape(A\b,[4,4])).'

% sol =
%
%    0.0690   -0.3276   -0.0853   -0.1973
%    0.2586    0.3966    0.2267    0.2533
%   -0.3448    0.1379   -0.5333    0.2667
%    0.2069   -0.4828    0.6667   -0.6667

You could also use symbolic math to create a system of linear equation and then solve this system:

% Your variables
a = [0 1 0 0;0 0 -1 0;0 0 0 1;0 0 5 0];
f = [-1 1 0 0;-1 -1 0 0;0 0 -1.5 0.5;0 0 -0.5 -1.5];
b = [0;1;0;-2];
k = [1 0 1 0];

% The unknows:
t = sym('t', [4 4]);

% Create the symbolic system of linear equation
eq = a*t - t*f == b*k;

% Equation to matrix 
[A,b] = equationsToMatrix(eq);

% Solve the system and get a numeric solution
sol = double(reshape(A\b,[4,4])).'

% sol =
%
%    0.0690   -0.3276   -0.0853   -0.1973
%    0.2586    0.3966    0.2267    0.2533
%   -0.3448    0.1379   -0.5333    0.2667
%    0.2069   -0.4828    0.6667   -0.6667
迷途知返 2025-02-12 21:20:38

您应该知道矩阵f是可逆的,我们可以使用dlyap,例如以下

t = dlyap(a,inv(f),-b*k/f)

或更简单的

t = lyap(a,-f,-b*k)

t =

    0.0690   -0.3276   -0.0853   -0.1973
    0.2586    0.3966    0.2267    0.2533
   -0.3448    0.1379   -0.5333    0.2667
    0.2069   -0.4828    0.6667   -0.6667

验证这一点

>> a*t-t*f-b*k

ans =

   1.0e-15 *

         0         0    0.0555         0
         0         0         0   -0.0555
    0.0833         0    0.1110         0
         0    0.1110         0         0

You should be aware that matrix f is invertable, we can use dlyap like below

t = dlyap(a,inv(f),-b*k/f)

or a simpler one

t = lyap(a,-f,-b*k)

which gives

t =

    0.0690   -0.3276   -0.0853   -0.1973
    0.2586    0.3966    0.2267    0.2533
   -0.3448    0.1379   -0.5333    0.2667
    0.2069   -0.4828    0.6667   -0.6667

To verify this

>> a*t-t*f-b*k

ans =

   1.0e-15 *

         0         0    0.0555         0
         0         0         0   -0.0555
    0.0833         0    0.1110         0
         0    0.1110         0         0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文