Using loop to solve a summation
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Is this correct

m=0
for m=0:1200
x=sum(1/factorial(m))
end
0 Commenti
Risposte (2)
Star Strider
il 7 Feb 2019
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))
0 Commenti
Kevin Phung
il 7 Feb 2019
Modificato: Kevin Phung
il 7 Feb 2019
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 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!