Eig(A) returns long fractional answer instead of a single number

3 visualizaciones (últimos 30 días)
Tom Beekhuysen
Tom Beekhuysen el 19 de Jul. de 2020
Respondida: madhan ravi el 19 de Jul. de 2020
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?

Respuestas (3)

Bhupendra Prajapati
Bhupendra Prajapati el 19 de Jul. de 2020
You can use double(eig(A)).

Steven Lord
Steven Lord el 19 de Jul. de 2020
Editada: Steven Lord el 19 de Jul. de 2020
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.

madhan ravi
madhan ravi el 19 de Jul. de 2020
sympref('FloatingPointOutput',1) % run this once and you don’t have to call vpa() or double() every single time
doc sympref

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by