Eig(A) returns long fractional answer instead of a single number
조회 수: 1 (최근 30일)
이전 댓글 표시
Eig(A) returns
(22/(9*(- 5/3 + (8623^(1/2)*1i)/27)^(1/3)) + ((8623^(1/2)*1i)/27 - 5/3)^(1/3) - 3)^(1/2)
instead of
-0.7462i
Is there a way to change it so decimal answers appear?
댓글 수: 0
답변 (3개)
Steven Lord
2020년 7월 19일
편집: Steven Lord
2020년 7월 19일
If the symbolic expression doesn't contain a symbolic variable and you're okay with approximating it in double precision, call double on it.
If it does contain a symbolic variable or your need a numeric approximation to higher than double precision, use the vpa function.
If you don't need to define A as a symbolic expression, define it as a double array and call eig on that numeric array.
댓글 수: 0
madhan ravi
2020년 7월 19일
sympref('FloatingPointOutput',1) % run this once and you don’t have to call vpa() or double() every single time
doc sympref
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!