フィルターのクリア

How to get the value of exponential power?

7 ビュー (過去 30 日間)
Muhammad Yasirroni
Muhammad Yasirroni 2019 年 4 月 15 日
編集済み: Muhammad Yasirroni 2019 年 4 月 15 日
Assume that after some computation, matlab give me an output:
a(1)=3.712e-12
a(2)=9.123e-13
How can i got the value of 12 and 13? Assume that a(1) and a(2) is in array a=[a(1) a(2)].
_
Edit: to avoid confussion, let me rearrange my question: "Can I get the 'index' (how many zeros in the right of the dot) of the first significant digit from data?". Is this is the only way?
n=1
a(1)=3.712e-12
while 1e1^-n>a(1)
n=n+1;
end
  2 件のコメント
Stephen23
Stephen23 2019 年 4 月 15 日
編集済み: Stephen23 2019 年 4 月 15 日
"How can i got the value of 12 and 13?"
You didn't: those are the powers of ten, they are not "values".
What you show are numbers written in E-notation, which is the a common way that scientists, engineers, and researchers write small/large numbers:
Muhammad Yasirroni
Muhammad Yasirroni 2019 年 4 月 15 日
編集済み: Muhammad Yasirroni 2019 年 4 月 15 日
Thank you. But, I already understand that. So, let me rearrange my question: "Can I get the 'index' (how many zeros in the right of the dot) of the first significant digit from data?"
p.s. I edit my question

サインインしてコメントする。

採用された回答

Stephen23
Stephen23 2019 年 4 月 15 日
編集済み: Stephen23 2019 年 4 月 15 日
Just use log10:
>> floor(log10(a))
ans =
-12 -13
The correct answer is [-12,-13], not [12,13] (because these are the powers of ten), but of course you can lose information if you want with abs.
  1 件のコメント
Muhammad Yasirroni
Muhammad Yasirroni 2019 年 4 月 15 日
Great. Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by