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 Commento

Amit
Amit il 30 Gen 2014
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.

Accedi per commentare.

Risposte (1)

Moussa Attati
Moussa Attati il 21 Ott 2022
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

Categorie

Scopri di più su Get Started with MATLAB in Centro assistenza e File Exchange

Richiesto:

il 30 Gen 2014

Risposto:

il 21 Ott 2022

Community Treasure Hunt

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

Start Hunting!

Translated by