Finding x such that 1 is eigenvalue

1 次查看(过去 30 天)
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

采纳的回答

John D'Errico
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?

更多回答(1 个)

James Tursa
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

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by