How do I sum a series in Matlab without using a for loop?
显示 更早的评论

The following is the code I've written to solve this series (chose an arbitrary N value of 10)
n=0:10
sum((4./(8.*n+1)-2./(8.*n+4)-1./(8.*n+5)-1./(8.*n+6)).*(1.^n)/(16.^n))
This series should ideally give a rough approximation of pi but I keep getting 2.1396e-15. I'm not sure what exactly Matlab is summing up.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!