how to change matlab answers type?

3 visualizaciones (últimos 30 días)
arian hoseini
arian hoseini el 29 de Dic. de 2021
Comentada: arian hoseini el 30 de Dic. de 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

Respuesta aceptada

Image Analyst
Image Analyst el 29 de Dic. de 2021
format longG
% or
format shortG

Más respuestas (1)

KSSV
KSSV el 29 de Dic. de 2021
Editada: KSSV el 29 de Dic. de 2021
  2 comentarios
Steven Lord
Steven Lord el 29 de Dic. de 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
y = 
d = double(y)
d = 495.2207
format long
d
d =
4.952207476509858e+02
vpa(y, 6)
ans = 
495.221
arian hoseini
arian hoseini el 29 de Dic. de 2021
thank u

Iniciar sesión para comentar.

Etiquetas

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by