How to get rid of exp in answer
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Sergey Dukman
am 9 Jun. 2015
Kommentiert: Roger Stafford
am 9 Jun. 2015
I have evaluated a polynomial of the 6th order.
One of the calculated coefficients has a value of -4.1275e-05 (format short g).
How can I represent this answer as a "normal" number without exp?
0 Kommentare
Akzeptierte Antwort
Roger Stafford
am 9 Jun. 2015
Use 'fprintf' with the fixed-point format type %f. For example with your value you could use fprintf('%12.9f',value) to get -0.000041275
2 Kommentare
Roger Stafford
am 9 Jun. 2015
The % on the left and f on the right mean fixed-point type format. The 12 is the total field width and the 9 is the number of digits after the decimal point. You can read all about the format specs in the site:
http://www.mathworks.com/help/matlab/ref/fprintf.html
Note that these format specs for matlab's fprintf are very similar to those of the C language for printf.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Polynomials 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!