Numerical Garbage value in Matrix

조회 수: 1 (최근 30일)
Muhammad
Muhammad 2018년 10월 17일
편집: John D'Errico 2018년 10월 17일
Hi, I have two n*n matrices and I am computing their sum. The sum is
[124.449917129290 + 0.00000000000000i -43.6298898009808 - 7.10542735760100e-15i -43.6298898009808 + 7.10542735760100e-15 i 124.449917129290 + 0.00000000000000i]. The bold value should be zero as I am using this result in an optimization problem and these 7^(-15) terms are introducing numerical garbage in my optimization problem. Any suggestions on how to make these terms exact zero when I perform the sum of matrices?
  댓글 수: 2
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 10월 17일
Can you clarify more, why zero, its doesn't affect in sum value, (+ and - equal value cancel each other)?
Muhammad
Muhammad 2018년 10월 17일
Hi, Sorry, the sum is a matrix Sum = [124.44+0i -43.629-7.105e-15i; -43.623+7.105e-15i 124.44+0i]... The thing is my matrix is quite big and it is just a snippet of my resultant matrix. As I am utilizing in SDP programming, these tiny imaginary values should be zero. Otherwise, deterministic solvers see the coefficient range as being from a very small value (^-15) to a very large value (which is dependant on other parameters). That's why it should be zero. Any suggestions now on how to deal with this problem?

댓글을 달려면 로그인하십시오.

답변 (1개)

John D'Errico
John D'Errico 2018년 10월 17일
편집: John D'Errico 2018년 10월 17일
help real
Better yet, compare the results of abs(real(A)) to abs(imag(A)). As long as the imaginary part is small, just delete it, replacing the value with real(A).
If abs(imag(A)) is ever too large, then raise a stink, since then you arguably have a problem that cannot just be dismissed as floating point trash. But at least then you know if there was a problem.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by