Help with Homework Question

Hi, I am really stuck on this question and have no idea how to do it. Can someone please help..
Formula for true relative error is (pi- Calculated pi)/pi

1 件のコメント

Amit
Amit 2014 年 1 月 30 日
Again, A homework problem need to be done by you. First it's unethical for someone else to do your homework.
Post your effort or idea on how to solve it, then others will help you.

サインインしてコメントする。

回答 (1 件)

Moussa Attati
Moussa Attati 2022 年 10 月 21 日

0 投票

function [PI,RelativeErr] = pi_func(n)
P=0;
for i = 1 : n
PI =4*(((-1)^(i-1))*1/(2*i-1))+P ;
P = PI;
end
RelativeErr=1-(PI/pi) ;
end

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

質問済み:

2014 年 1 月 30 日

回答済み:

2022 年 10 月 21 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by