Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In MatLab Formula for Bn P5 (P2.2.8) 0 solutions submitted (max: Unlimited) posi

ID: 2267774 • Letter: I

Question

In MatLab

Formula for Bn

P5 (P2.2.8) 0 solutions submitted (max: Unlimited) positive number) and outputs bn and n, where " isthe smallest integer so that Ibn- Write a function that inputs e (epsilon, a small positive number) and outputsand , where n is the smallest integer so that Ton in P 2.2.8 on page 43, n approaches as n increases. Before submitting your function, test it in your local machine to make sure it does not result in any infinite loops The formula for ncan be found Your Function C Reset MATLAB Documentation function [bn,n]-p228b(epsilon) 2 %initialize variables while.. ) compute bn for integer n s end 6 Xpossible adjustment of n (depending on where you put nan+1 in the loop body) end

Explanation / Answer

Matlab function:

function [bn n] = p228b(epsilon)
s1 = 0;
s2 = 0;
k=0;
while 1==1
s1 = s1+((-1)^k/((5^(2*k+1))*(2*k+1)));
s2 = s2+(((-1)^k)/((239^(2*k+1))*(2*k+1)));
bn = (16*s1)-(4*s2);
if abs(bn-pi)<=epsilon %if error meets within the epsilon range loop breaks
break;
else
k=k+1;
end
end
n = k;
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote