Using loop to solve a summation

Antworten (2)

Star Strider
Star Strider am 7 Feb. 2019

1 Stimme

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 am 7 Feb. 2019
Bearbeitet: Kevin Phung am 7 Feb. 2019

0 Stimmen

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 Kommentare

Colby Jennings
Colby Jennings am 15 Apr. 2021
why x if there is no x in the equation
Ishmael Asad
Ishmael Asad am 23 Apr. 2021
x is just the variable that will store that whole summation

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 7 Feb. 2019

Kommentiert:

am 23 Apr. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by