I am getting output of simple math equations
36.0801*1.1462-181.04*(-.13341-.05423*K))/36.0801
(53973921897849552896*K)/198352447406604296875 + 720263206506893453689/396704894813208593750.
i am not getting the decimal form!
i need the answer in decimal form so as to perform more calculations

 채택된 답변

Ahmed Rashid
Ahmed Rashid 2016년 6월 2일

0 개 추천

You can use
syms K
A = (36.0801*1.1462-181.04*(-.13341-.05423*K))/36.0801;
d = 5; % decimal accuracy;
vpa(A,d)

댓글 수: 3

Walter Roberson
Walter Roberson 2016년 6월 2일
Correct.
However, the result is still going to be in terms of the symbolic variable K, and so is going to have to be a symbolic expression; it cannot be converted into double. There is no circumstance you are likely to run into under which a symbolic expression in floating point representation can be any more useful for further calculation than the same symbolic expression in rational form.
If the K was not there, then there might be reason to use double(A) instead of vpa(A), as there are cases where you need a double for calculation where a symbolic constant in rational form will not work. But this is not one of the cases, so the poster might as well leave the result unconverted until the poster has a numeric K value to substitute in.
If you want to evaluate the expression you can use
syms K
A = (36.0801*1.1462-181.04*(-.13341-.05423*K))/36.0801;
subs(A, K, 1) % K = 1;
M Gokul
M Gokul 2016년 6월 2일
thank you I found out that. Vpa has to be used wen using symbolic var thanks very much

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

추가 답변 (0개)

카테고리

태그

질문:

2016년 6월 1일

댓글:

2016년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by