フィルターのクリア

why does matlab give scientific notation if I use a variable in the operation?

1 回表示 (過去 30 日間)
Basílio Gonçalves
Basílio Gonçalves 2017 年 10 月 19 日
回答済み: Steven Lord 2017 年 10 月 19 日
t1 = 2.4735;
>> t1*2000
ans = 4.9471e+03
>> 2.4735*2000
ans = 4947
I would like to get the result from the operation using the variable t1 in decimals notation

回答 (2 件)

Walter Roberson
Walter Roberson 2017 年 10 月 19 日
I suspect that your t1 is not exactly 2.4735. You should try 4947/2000 - t1 to see the difference.

Steven Lord
Steven Lord 2017 年 10 月 19 日
Change the display format using the format command. Note that this does NOT change how the value is stored or used in computation, just how it is displayed. So keep Walter's Answer in mind.

カテゴリ

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