필터 지우기
필터 지우기

array addition

조회 수: 2 (최근 30일)
God'sSon
God'sSon 2011년 5월 18일
Hello,
I am trying to perform simple array addition inside of my code but I am getting wrong answers because of the negative sign which is suppose to cancel out during the addition still remains in the final answer. can anyone please help.
a =
1.0879
0.0000
-0.0000
0.0000
0.0000
0.0000
-0.0000
0.1072
b =
-0.0879
-0.0000
0.0000
-0.0000
0.0000
-0.0000
0.0000
0.8928
c = a+b
ans 1.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 1.0000

채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 5월 18일
c(abs(c)<100*eps)=0
  댓글 수: 4
Andrei Bobrov
Andrei Bobrov 2011년 5월 18일
Please read the <http://matlab.wikia.com/wiki/FAQ> part
"Why is 0.3 - 0.2 - 0.1 (or similar) not equal to zero?"
God'sSon
God'sSon 2011년 5월 18일
thanks

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by