Floating Number without "e"?
古いコメントを表示
Hello everyone!
I'm a begginer in Matlab struggling to plot a graph. I'm having a hard difficult with my decimal numbers, because I have a very small one. My program is returning like "2.917974892076614e-04" and I didn't want this notation. I need the normal number, even if it is rounded - no problem!
Well, can I round the number to the maximum value acceptable by the var type? Or can I stop my program from writing like this and make it return the original number?
採用された回答
その他の回答 (1 件)
Ameer Hamza
2018 年 5 月 19 日
編集済み: Ameer Hamza
2018 年 5 月 19 日
If you want to calculate or display very small or very large numbers without using e notation then use vpa
digits(20) % set how many digits to use after the decimal point
vpa(0.0000537523327672541)
ans =
0.000053752332767254096626
Also as you can see that there is a little difference between value inside vpa() and the number displayed by the MATLAB. That is because of finite precision of floating point numbers in MATLAB. The detailed discussion and the method to avoid this can be found here.
2 件のコメント
giovanacgois
2018 年 5 月 19 日
Ameer Hamza
2018 年 5 月 19 日
Why do you want "0.0001" your actual number is 0.00005..., If you want to round the number then use
vpa(round(x,4))
カテゴリ
ヘルプ センター および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!