exp2text

Converts exponential format to TeX format for annotating plots
1,3K descargas
Actualizado 30 mar 2016

Ver licencia

This should be a useful small function for anyone who doesn't like the classic "scientific notation" format and would like to have a more compact notation for their plots.
With exp2text you can convert any real or complex number to an appropriate exponential format using multiples of a power of 10 in a *10^ form instead of the classic 'E' exponential notation (see screenshot)

Number of desired significant digits can also be included as a parameter (default is 3)

Example shown in screenshot:

x=0.0014982; % Real Number Example
y=0.1341+0.325i; % Complex Number Example
figure
text(0.1,0.95,['\bf{Real Numbers:}'])
text(0.1,0.9,['Simple num2str: ',num2str(x)])
text(0.1,0.85,['Simple exp format: ',num2str(x,'%.3e')])
text(0.1,0.75,['exp2text: ',exp2text(x)])
text(0.1,0.55,['\bf{Complex Numbers:}'])
text(0.1,0.5,['Simple num2str: ',num2str(y)])
text(0.1,0.45,['Simple exp format: ',num2str(y,'%.3e')])
text(0.1,0.35,['exp2text: ',exp2text(y)])

Citar como

Vasilis Kapetanidis (2024). exp2text (https://www.mathworks.com/matlabcentral/fileexchange/13824-exp2text), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2009b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Visual Exploration en Help Center y MATLAB Answers.

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0

Update for BSD License.
minor change in example code