Why the results are different while using eig() to solve syms and double Jacobian matrix?
11 ビュー (過去 30 日間)
古いコメントを表示
Dearl all,
When I use eig to find the eigenvalues for a Jacobian matrix, the outputs are different if I define the Jacobian matrix as syms and double types. The order of each values are different in particular. I appreciate any clues for this difference:))
Many thanks,
JL
Here is an example:
% Create a syms J matrix and a dounble J matrix
JacobianSyms = vpa([1, 2, 3; 2, 1 8; 3, 8 9]);
JacobianDoub = double(JacobianSyms);
% Calculate their eigenvalues
[evs, eigenvaluesfromJacobianSyms] = eig(JacobianSyms)
[evd, eigenvaluesfromJacobianDoub] = eig(JacobianDoub)
0 件のコメント
採用された回答
Bruno Luong
2023 年 7 月 27 日
編集済み: Bruno Luong
2023 年 7 月 27 日
If I ask a set of 3 integer numbers > 1 so that 30 is the product, what do you tell me?
(5,3,2) or
(5,2,3) or
(3,5,2) or
(3,2,5) or
(2,5,3) or
(2,3,5)
?
It's the same thing with eigen value and vectors, the order is just arbitrary set. So when you ask two different implementations for eigen values/vectors, you'll get the order that is arbitrary set by this routine.
7 件のコメント
Bruno Luong
2023 年 7 月 28 日
編集済み: Bruno Luong
2023 年 7 月 28 日
BTW if you want to take the control and impose your order, for example sorted on real part of eigen value just do this
[V,D] =eig(A)
[~,p] = sort(real(diag(D)));
V = V(:,p)
D = D(p,p)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Linear Algebra についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!