MATLAB Answers

Converting values in eigenvector to rational forms that include square roots

16 views (last 30 days)
Randy Chen
Randy Chen on 14 Oct 2020 at 3:11
Commented: Randy Chen about 3 hours ago
I tried computing the eigen vectors and eigen values for a 3x3 matrix, but the result is given in fractions after I used format rational. How can I change the format so as to get values in my matrix that include square root ? (i.e, sqrt(2)/2 )
Here are my codes:
A = [3 1 1 ;1 0 2;1 2 0];
>> [V,D] = eig(A)
V =
0.0000 0.5774 -0.8165
0.7071 -0.5774 -0.4082
-0.7071 -0.5774 -0.4082
D =
-2.0000 0 0
0 1.0000 0
0 0 4.0000

  1 Comment

Walter Roberson
Walter Roberson on 14 Oct 2020 at 3:34
[V,D] = eig(sym(A))
if you have the symbolic toolbox.
V ./ [norm(V(:,1)), norm(V(:,2)), norm(V(:,3))]

Sign in to comment.

Answers (1)

Prudhvi Peddagoni
Prudhvi Peddagoni about 16 hours ago
Edited: Walter Roberson about 16 hours ago
Hi,
you need to use sym command to convert matrix A to a symbolic variable. you can find the examples of sym command usage and the documentation here.
Hope this helps.

  1 Comment

Randy Chen
Randy Chen 9 minutes ago
could you please show the codes how to convert my matrix A and get symbolic values? I read through the documentation but still don't understand it

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!