how to change matlab answers type?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
arian hoseini
am 29 Dez. 2021
Kommentiert: arian hoseini
am 30 Dez. 2021
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 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
KSSV
am 29 Dez. 2021
Bearbeitet: KSSV
am 29 Dez. 2021
Read about format.
Try
format short
2 Kommentare
Steven Lord
am 29 Dez. 2021
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)
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!