Finding x such that 1 is eigenvalue

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

John D'Errico
John D'Errico il 17 Giu 2018
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?

Più risposte (1)

James Tursa
James Tursa il 17 Giu 2018
Modificato: James Tursa il 17 Giu 2018
>> 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

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by