how to get decimal answers?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MEKDES KASSA
il 6 Ago 2022
Risposto: Walter Roberson
il 7 Ago 2022
i have been using a for loop but the result comes in long digits of fraction?
i want to have the result in decimal. how can i avoid fraction answers?
1 Commento
dpb
il 6 Ago 2022
format short, format compact
may suit.
If you want/need a specific output, then you'll have to format/write it yourself.
Show us code/and what you're getting that you don't like; we can't see your terminal from here...
Risposta accettata
Star Strider
il 6 Ago 2022
If you are using the Symbolic Math Toolbox, use the double function if the expressions do not contain symbolic variables. If they do contain symbolic variables, numeric values must be supplied for them first, using the subs function. (The vpa function will also provide strictly numeric results, however the result will still be a symbolic variable.)
0 Commenti
Più risposte (1)
Walter Roberson
il 7 Ago 2022
sympref('FloatingPointOutput',true);
I personally do not recommend this approach, as I find that there are many cases where the symbolic form is more informative.
0 Commenti
Vedere anche
Categorie
Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!