필터 지우기
필터 지우기

Difference between the usage of sum functions

조회 수: 3 (최근 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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by