Finding x such that 1 is eigenvalue
1 回表示 (過去 30 日間)
古いコメントを表示
Harel Harel Shattenstein
2018 年 6 月 17 日
回答済み: John D'Errico
2018 年 6 月 17 日
Let A=[1 2 3;3 x 4; 1 2 5], find x such that 1 is eigenvalue of the matrix
syms x
det(A=[1 2 3;3 x 4; 1 2 5]-eye(3));
Which function can I use to find the roots of the polynomial I got
0 件のコメント
採用された回答
John D'Errico
2018 年 6 月 17 日
You are trying to do too much in one line. Making your code super compact does nothing, except make it unreadable. And it did not work here for you, as you found out.
First, you cannot assign something to a variable like A in the middle of a line of code.
If 1 is an eigenvalue of A, then it is true that det(A-1*eye(3)) must be zero.
syms x
A = [1 2 3;3 x 4; 1 2 5];
xsol = solve(det(A - eye(3)) == 0)
xsol =
5/3
Testing that result, we see that:
eig(subs(A,x,xsol))
ans =
1
10/3 - 178^(1/2)/3
178^(1/2)/3 + 10/3
So, you were close. What you did wrong was to try to do too much in one line of code. And then you failed to try to apply solve. Since your goal was to solve something, why not consider solve?
0 件のコメント
その他の回答 (1 件)
James Tursa
2018 年 6 月 17 日
編集済み: James Tursa
2018 年 6 月 17 日
>> syms x
>> det([1 2 3;3 x 4; 1 2 5]-eye(3))
ans =
5 - 3*x
>> solve(ans)
ans =
5/3
>> A = [1 2 3;3 5/3 4; 1 2 5]
A =
1.0000 2.0000 3.0000
3.0000 1.6667 4.0000
1.0000 2.0000 5.0000
>> eig(A)
ans =
7.7806
-1.1139
1.0000
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!