필터 지우기
필터 지우기

how to add two sums by using loops?

조회 수: 2 (최근 30일)
rising falcon
rising falcon 2015년 10월 27일
댓글: Image Analyst 2015년 10월 29일
what commond will be use for this ∑_(j=1)^5▒∑_(i=1)^2▒(i+j)
  댓글 수: 3
rising falcon
rising falcon 2015년 10월 27일
편집: rising falcon 2015년 10월 28일

how to solve it by using loops? ∑_(j=1)^5▒〖j+〗 ∑_(i=1)^2▒i

Stephen23
Stephen23 2015년 10월 27일
편집: Stephen23 2015년 10월 27일
MATLAB has more efficient ways of doing many mathematical operations, without requiring loops. Read the link that I gave.
Can you please explain the syntax that you use to write the sum, or upload an image so we can see the original.

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

답변 (1개)

the cyclist
the cyclist 2015년 10월 27일
I didn't fully understand the question, but maybe you want a structure like
NI = 5;
NJ = 10;
sum = 0;
for ii=1:NI
for jj=1:NJ
sum = sum + 3;
end
end
Be aware that there are often vectorized methods that will be more efficient for calculation.
  댓글 수: 3
the cyclist
the cyclist 2015년 10월 27일
Is this homework? I don't want to solve the whole problem for you. It should be VERY easy for you to adapt what I have written.
Image Analyst
Image Analyst 2015년 10월 29일
One thing to change is the name of the variable. Don't use sum because it's the name of an important built-in function.

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

카테고리

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