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!