how to calculate Somme of vector elements ?
30 次查看(过去 30 天)
显示 更早的评论
i would like to calculate the somme k=1:10^5 of 1/k^2,using the command sum, can anyone help me ?
0 个评论
采纳的回答
madhan ravi
2018-10-21
编辑:madhan ravi
2018-10-21
k=1:10.^5;
sum(1./(k.^2))
6 个评论
Bruno Luong
2018-10-28
编辑:Bruno Luong
2018-10-28
"is there any method to verify the obtained result ?"
s = sum(1./(k.^2))
s / (pi^2/6)
That gives
s =
1.6449
ans =
1.0000
Seems alright to me.
更多回答(1 个)
mohamed
2024-3-28
I need instructions that I write in MATLAB, to give me the result of this sum
2 个评论
mohamed
2024-3-29
Thanks dude, just forgot to mention that "x" changes from 0 to 2, and t is the time
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!