Finding x such that 1 is eigenvalue

조회 수: 1 (최근 30일)
Harel Harel Shattenstein
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

채택된 답변

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