如何在Matlab中获得科学计数法的指数 [英] How to get Exponent of Scientific Notation in Matlab

查看:1193
本文介绍了如何在Matlab中获得科学计数法的指数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当数字非常小时,Matlab会自动以科学计数法显示其格式.

When the numbers are really small, Matlab automatically shows them formatted in Scientific Notation.

示例:

A = rand(3) / 10000000000000000;

A =

  1.0e-016 *

    0.6340    0.1077    0.6477
    0.3012    0.7984    0.0551
    0.5830    0.8751    0.9386

是否有一些内置函数返回指数?像是getExponent(A) = -16?

Is there some in-built function which returns the exponent? Something like: getExponent(A) = -16?

我知道这是一个愚蠢的问题,但是我需要检查数百个矩阵,但似乎无法弄清楚.

I know this is sort of a stupid question, but I need to check hundreds of matrices and I can't seem to figure it out.

谢谢您的帮助.

推荐答案

基本数学可以告诉您:

floor(log10(N))

数字的对数基数10会告诉您该数字中小数点前大约有几位数字.

The log base 10 of a number tells you approximately how many digits before the decimal are in that number.

例如,999871234598237549.998E+016

log10(99987123459823754)16.9999441,其下限是16-基本上可以告诉您科学计数法的指数是16,非常接近17".

log10(99987123459823754) is 16.9999441, the floor of which is 16 - which can basically tell you "the exponent in scientific notation is 16, very close to being 17".

地板总是四舍五入,因此您不必担心小指数:

Floor always rounds down, so you don't need to worry about small exponents:

0.000000000003754 = 3.754E-012
log10(0.000000000003754) = -11.425
floor(log10(0.000000000003754)) = -12

这篇关于如何在Matlab中获得科学计数法的指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆