特征值和特征向量的方程组 [英] System of equations for Eigenvalues and Eigenvectors
问题描述
特征值和特征向量可以通过以下等式从张量T导出.
An Eigenvalue and Eigenvector can be derived from the Tensor T by the below equation.
我试图得到一个特征值,特征向量和张量T的方程组,以推导T.
I am trying to get a system of equations for Eigenvalues, Eigenvectors and the Tensor T to derive T.
T
矩阵方程为:
(T(i,k)-L(r)*I) * A(r,k) = 0
第一个条目应该是:
[(T11-L1)*A11 T12*A12 T13*A13 T14*A14 ]
[T21*A11 (T22-L1)*A12 T23*A13 T24*A14 ]
[T31*A11 T32*A12 (T33-L1)*A13 T34*A14 ]
[T41*A11 T42*A12 T43*A13 (T44-L1)*A14]
推荐答案
First, let's declare the symbolics easier using sym
:
T = sym('T%d%d', [4 4]);
A = sym('A%d%d', [4 4]);
L = sym('L', [4 1]);
原始代码有几个问题; 1. f
在每次内部迭代中都会被替换. 2..内部结果应为标量,因此I
不得出现在此处. (请注意,您也可以像 eye(4)
这样定义I
手动编写.)
There are several problems with the original code; 1. f
is being replaced in each inner iteration. 2. The inner result should be scalar and thus I
must not appear there. (Note that you can also define I
like eye(4)
instead of writing it manually.)
这是更正的版本:
f = cell(4,1); % Initialize equation system
for r = 1:k
for k = 1:4
for i = 1:4
f{r}(i,k) = T(i,k) * A(r,k);
end
end
f{r} = f{r} - L(r)*diag(A(r,:));
end
f{i}
将是ith
切片.
注意:正如@Schorsch所指出的(Matlab还显示了警告),总是尝试使用除i
(或j
)之外的其他变量名. ,因为它们代表 虚构单元 .
Note: As @Schorsch pointed out (and Matlab also shows a warning) always try to use another variable name other than i
(or j
), since they represent the imaginary unit.
只是为了好玩,您可以使用 repmat
删除两个内部循环:
Just for fun you can use repmat
to remove the two inner loops:
for r = 1:4
f{r} = T .* repmat(A(r,:), [4 1]) - L(r)*diag(A(r,:));
end
这篇关于特征值和特征向量的方程组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!