How to remove the scientific notation such as -1.200340354078778e+11 from a matrix?

4 次查看(过去 30 天)
Hello,
I have a matrix A that have values such as (-1.200340354078778e+11), how to remove this I order to round the values to the nearest 5 decimal? I need this matrix A to multiply it by the double matrix B.
Regards
  2 个评论
Walter Roberson
Walter Roberson 2018-10-21
编辑:Walter Roberson 2018-10-21
What output would you want from (-1.200340354078778e+11) ? -120030000000 ? -120034035407.87800 ?
Your invsw entries range in absolute value from 4.75582810386029e9 to 1.86639023098654e12 . Do you want them rounded to 5 decimal points individually, or 5 relative to the 1e12 value? Should 4.75582810386029e9 become 4.7558e9 (5 decimal places for it) or to 0.00476e12 so that the number of trailing 0 align for the values ?

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2018-10-21
Use the format (link) function.
format short
q = -1.200340354078778e+11
q =
-1.2003e+11
The internal precision remains unchanged.
  3 个评论
Walter Roberson
Walter Roberson 2018-10-22
rounding the inverse of a matrix is typically bad mathematics. Matrix inverses are rather sensitive.
Your invsw is not the inverse of sw. Your sw only has rank 87 rather than 90.
>> max(max(sw * invsw))
ans =
99117485673797.8
That should be approximately 1 if the two are inverses.

请先登录,再进行评论。

更多回答(1 个)

madhan ravi
madhan ravi 2018-10-21
编辑:madhan ravi 2018-10-21
round((-1.200340354078778e+11),5)
Or
A=vpa((-1.200340354078778e+11))
round(A)
  3 个评论
madhan ravi
madhan ravi 2018-10-22
编辑:madhan ravi 2018-10-22
Exactly , it doesn’t change to sym as sir Walter mentioned. If you think it changes you can check class of the variable by typing whos A in command window

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by