Using loop to solve a summation

답변 (2개)

Star Strider
Star Strider 2019년 2월 7일

1 개 추천

No, because you need to subscript ‘m’ and sum ‘x’ in each iteration.
However you do not need the loop:
m=0:1200;
x=sum(1./factorial(m))
Kevin Phung
Kevin Phung 2019년 2월 7일
편집: Kevin Phung 2019년 2월 7일

0 개 추천

No, you need to increment m with each step and add each partial sum.
This is what you need:
x= 0
for m = 0:1200
x = x + 1/factorial(m(i))
end

댓글 수: 2

Colby Jennings
Colby Jennings 2021년 4월 15일
why x if there is no x in the equation
Ishmael Asad
Ishmael Asad 2021년 4월 23일
x is just the variable that will store that whole summation

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2019년 2월 7일

댓글:

2021년 4월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by