Converting values in eigenvector to rational forms that include square roots
조회 수: 19 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2020년 10월 14일
[V,D] = eig(sym(A))
if you have the symbolic toolbox.
V ./ [norm(V(:,1)), norm(V(:,2)), norm(V(:,3))]
채택된 답변
Prudhvi Peddagoni
2020년 10월 19일
편집: Walter Roberson
2020년 10월 19일
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.
댓글 수: 3
Prudhvi Peddagoni
2020년 10월 20일
you can convert matrix A to symbolic matrix like this
A=sym(A);
then you can use this symbolic matrix to as the input for eig function.
Walter Roberson
2020년 10월 20일
편집: Walter Roberson
2020년 10월 20일
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!