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!