MATLAB output is a bunch of numbers with operators not the exact number

조회 수: 2(최근 30일)
Fatemeh Salar
Fatemeh Salar 2022년 6월 20일
댓글: Fatemeh Salar 2022년 6월 20일
Hi,
When i ask MATLAB to solve a problem using syms and det , in output section it showes as series on formulas that needed to be calulated and not the exact value. How can I ask matlab to show the exavt number and not numers with operators ? for example instead of (25/6 - (5*13^(1/2))/6)^(1/2) shows 1.078 in commant window
A =
(25/6 - (5*13^(1/2))/6)^(1/2)
((5*13^(1/2))/6 + 25/6)^(1/2)
-(25/6 - (5*13^(1/2))/6)^(1/2)
-((5*13^(1/2))/6 + 25/6)^(1/2)
while it should be :
1.0780
2.6779
-1.0780
-2.6779

채택된 답변

Stephen23
Stephen23 2022년 6월 20일
double(A)

추가 답변(1개)

DGM
DGM 2022년 6월 20일
To be pedantic, those expressions are the exact result. The decimal values are an approximation.
That said, you should be able to use double() to convert the symbolic expressions to numeric.
  댓글 수: 1
Fatemeh Salar
Fatemeh Salar 2022년 6월 20일
Yes you're right, it just worked when I used double().. Thanks.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by