フィルターのクリア

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 Center および File ExchangeIntroduction 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