フィルターのクリア

Difference between the usage of sum functions

1 回表示 (過去 30 日間)
Benedikt Wessel
Benedikt Wessel 2018 年 10 月 17 日
編集済み: madhan ravi 2018 年 10 月 17 日
Hey, can someone explain, why the results are different? And which way is the right one? Thanks.
X=A+B+C-D;
Sum1=sum(X)
Sum2=sum(A)+sum(B)+sum(C)-sum(D)

採用された回答

madhan ravi
madhan ravi 2018 年 10 月 17 日
SUM1 is the right one.
It calculates your resultant matrix’s sum
But the latter calculates the sum o each matrices and does the arithmetic operations but then also it depends on your wish.
  2 件のコメント
Benedikt Wessel
Benedikt Wessel 2018 年 10 月 17 日
Thanks!
madhan ravi
madhan ravi 2018 年 10 月 17 日
編集済み: madhan ravi 2018 年 10 月 17 日
you’re welcome you can also vote for the answer

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by