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!