Small matrix values
22 次查看(过去 30 天)
显示 更早的评论
Hallo,
for a given matrix is there an efficient way in matlab to make its small values (e.g. smaller than 0.001) set as zero?
Thanks in advance
0 个评论
采纳的回答
Andrei Bobrov
2011-12-5
e.g. A - your matrix
A(abs(A)<1e-3)=0
2 个评论
Walter Roberson
2011-12-5
A(abs(real(A))<0.001 | abs(imag(A))<0.001) = 0;
Note though that if you had a number such as 12345+0i then this would be set to 0, because you asked for the value to be set to 0 if *either* the real or imaginary part were small. You might wish to change the | to &
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!