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 𝑁.
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 で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!