how to change matlab answers type?

6 ビュー (過去 30 日間)
arian hoseini
arian hoseini 2021 年 12 月 29 日
コメント済み: arian hoseini 2021 年 12 月 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

採用された回答

Image Analyst
Image Analyst 2021 年 12 月 29 日
format longG
% or
format shortG
  1 件のコメント
arian hoseini
arian hoseini 2021 年 12 月 30 日
best solution ever.thank u

サインインしてコメントする。

その他の回答 (1 件)

KSSV
KSSV 2021 年 12 月 29 日
編集済み: KSSV 2021 年 12 月 29 日
  2 件のコメント
Steven Lord
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
y = 
d = double(y)
d = 495.2207
format long
d
d =
4.952207476509858e+02
vpa(y, 6)
ans = 
495.221
arian hoseini
arian hoseini 2021 年 12 月 29 日
thank u

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by