sums with for loop

3 次查看(过去 30 天)
I am beginner in matlab, and i struggly to resolve some exercice. can I have some advice according to this task?
1-1/3+1/5-1/7+1/9-..-1/1003

采纳的回答

David Hill
David Hill 2022-10-29
n=1:502;
s=sum((-1).^(n+1)./(2*n-1))
s = 0.7849
  7 个评论
Torsten
Torsten 2022-10-29
Maybe of interest:
syms n
s = simplify(symsum((-1)^n/(2*n+1),0,Inf))
s = 
Alonso Mukendi Kalonji
I get it!
Thank you very much!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Function Creation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by