MATLAB Answers

rounding to zero small numbers (NOT round function)

81 ビュー (過去 30 日間)
atabak mostafavi
atabak mostafavi 2019 年 10 月 30 日
コメント済み: Walter Roberson 2019 年 10 月 31 日
so i want matlab to consider every number below a certain level (for example 0.001) as zero in the whole script. while right now it returns some computation result even in 10e-15, is there any defult value for matlab ?

  0 件のコメント


回答 (1 件)

dpb 2019 年 10 月 30 日
No. ML basic numeric type is the floating point double which around zero has roughly the above magnitude of precision.
You'll have to set values less than your chosen threshold to zero explicitly.
The round function with the optional second option could be useful tool in this, but simply
will avoid the rounding that occurs in it. Of course, you'll want to use abs to get both positive and negative sides of the rounding that will likely occur.
You might also find ismembertol of use depending upon your actual code.

  9 件のコメント

表示 6 件の古いコメント
Walter Roberson
Walter Roberson 2019 年 10 月 31 日
What result are you getting, exactly, for which there is "no explicit solution" ? Do you mean the result of null() on the symbolic numeric array is the empty array? If so then as far as the routine can tell, the array is full rank.
atabak mostafavi
atabak mostafavi 2019 年 10 月 31 日
ok when I excute this:
I get this:
ans =
coeff_sol =
Empty sym: 1-by-0
Walter Roberson
Walter Roberson 2019 年 10 月 31 日
I would be interested to see what shows up for
dets = det(sym(B))
detn = double(dets)
However for large B this can take a fair while.
You might want to look at at how null space can be determined by SVD. That form would give you the flexibility to permit columns that you consider "close enough" to zero.


Community Treasure Hunt

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

Start Hunting!

Translated by