ans representation in decimal
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Andrew
am 1 Sep. 2020
Kommentiert: Andrew
am 1 Sep. 2020
Good day.
Houp, I could get some hint on how to change the formatting of answers in a live script.
syms ht_inpt(mass, dlt_t, spc_ht_mtr)
ht_inpt(mass, dlt_t, spc_ht_mtr)=mass*dlt_t*spc_ht_mtr;
mass=6*u.kg;
mass_t1=(20+273)*u.K;
mass_t2=(100+273)*u.K;
spc_ht_mtr=4190*u.J/(u.kg*u.K);
dlt_t=mass_t2-mass_t1;
ht_inpt=ht_inpt(mass, dlt_t, spc_ht_mtr)
ht_inpt=2011200 J
ht_inpt = unitConvert(ht_inpt,u.kJ)
ht_inpt=10056/5 kJ
How a document can be edited that all answers in it would be expressed with decimals?
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 1 Sep. 2020
Bearbeitet: Cris LaPierre
am 1 Sep. 2020
FYI the code you shared generates the following error
Unable to resolve the name u.kg.
Add the following to fix that:
u = symunit;
6 Kommentare
Cris LaPierre
am 1 Sep. 2020
[ht units] = separateUnits(ht_inpt);
format shortG
double(ht)
ans =
2011.2
If you want to include the units, you'd have to build a string.
ht_dec = sprintf('%.1f %s',double(ht),'kJ')
ht = '2011.2 kJ'
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox 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!