This value should be zero, why is it not zero?

>> X
X =
90 60 45 100 15 23 52 30 71 88
>> xbar
xbar =
57.4000
>> diffx
diffx =
32.6000 2.6000 -12.4000 42.6000 -42.4000 -34.4000 -5.4000 -27.4000 13.6000 30.6000
>> clear sum;
>> sum(diffx)
ans =
1.4211e-14
>>
1.4211e-14
>>

 採用された回答

Matt J
Matt J 2015 年 2 月 1 日
編集済み: Matt J 2015 年 2 月 1 日

1 投票

You generated the diffx data (and summed it) with inexact floating point arithmetic, as all computers do.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink Supported Hardware についてさらに検索

タグ

質問済み:

2015 年 2 月 1 日

編集済み:

2015 年 2 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by