【发布时间】:2018-10-15 02:57:50
【问题描述】:
我得到一个 3x3 矩阵 [0.4, 0.1, 0.2; 0.3,0.7。 0.7; 0.3、0.2、0.1]。问题是找到稳态向量。但是,我应该使用 Matlab 来解决它,但我无法获得正确的答案。我们应该使用公式 A(x-I)=0。我可以手动解决它,但我不知道如何将它输入到 Matlab 中。非常感谢任何帮助。
【问题讨论】:
我得到一个 3x3 矩阵 [0.4, 0.1, 0.2; 0.3,0.7。 0.7; 0.3、0.2、0.1]。问题是找到稳态向量。但是,我应该使用 Matlab 来解决它,但我无法获得正确的答案。我们应该使用公式 A(x-I)=0。我可以手动解决它,但我不知道如何将它输入到 Matlab 中。非常感谢任何帮助。
【问题讨论】:
我会假设你的意思是x(A-I)=0,因为你写的东西对我来说真的没有意义。我写的方程式暗示x*A^n=x 这通常是稳态的意思。方程的解为A的左特征向量,特征值为1。
您可以使用eig函数获取A的特征向量和特征值。
A = [0.4, 0.1, 0.2; 0.3, 0.7, 0.7; 0.3, 0.2, 0.1];
% Get the eigenvalues (D) and left eigenvectors (W)
[~,D,W] = eig(A);
% Get the index of the eigenvalue closest to 1
[~,idx] = min(abs(diag(D)-1));
% Get associated eigenvector
x = W(:,idx).';
检查解决方案
>> all(abs(x*(A-eye(size(A)))) < 1e-10)
ans =
logical
1
【讨论】: