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일

0 개 추천

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

Thanks!
madhan ravi
madhan ravi 2018년 10월 17일
편집: madhan ravi 2018년 10월 17일
you’re welcome you can also vote for the answer

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2018년 10월 17일

편집:

2018년 10월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by