matlab科学计数法输入,如何在Matlab中获得科学计数法的指数

本文探讨了在Matlab中如何获取数值的科学计数法指数部分,通过使用基本数学运算,如log10和floor函数来实现这一目标。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

Example:

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

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.

Thank you for your help.

解决方案

Basic math can tell you that:

floor(log10(N))

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

For instance, 99987123459823754 is 9.998E+016

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值