how to change matlab answers type?
3 次查看(过去 30 天)
显示 更早的评论
i have a problem with matlab answers ...it always shows answers like this
(200*6151^(1/2))/3 - 14200/3
how can i fix that?i mean is there a setting or code for it?i tried double but it also show it like 4.952207476509866e+02 i want the answer like this 495.22
0 个评论
采纳的回答
更多回答(1 个)
KSSV
2021-12-29
编辑:KSSV
2021-12-29
Read about format.
Try
format short
2 个评论
Steven Lord
2021-12-29
The format function will work once the symbolic answer has been converted to double precision using double, but you could use vpa instead (especially if the symbolic answer cannot be converted to double because it includes a symbolic variable.)
y = (200*sym(6151)^(1/2))/3 - sym(14200)/3
d = double(y)
format long
d
vpa(y, 6)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!