Write a matlab function for approximating the value of pi (certain equation)
1 次查看(过去 30 天)
显示 更早的评论
Hi.
Task:
Write a program that calculates the approximation of pi when it is given an upper limit of the sum 𝑁.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1353114/image.png)
Code that I'm trying to use:
function p = fun_my(n)
p = 0;
for k = 1:n
p = p + sqrt(8 + sum(16./((2*(1:n) - 1).^2 .* (2*(1:n) + 1).^2)));
end
Thanks for advance!
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!