Question: Need help fixing Matlab code for Bisection method. Also it need to have an error test to make sure a root is inside interval (a,b)

Need help fixing Matlab code for Bisection method. Also it need tohave an error test to make sure a root is inside intervalNeed help fixing Matlab code for Bisection method. Also it need to have an error test to make sure a root is inside interval (a,b) (a,b) MATLAB grader problems: HW 2_2 Write code to approximate V25 by

MATLAB grader problems: HW 2_2 Write code to approximate V25 by applying the a) bisection method and b) false position method to the equation x3 = 25. Code the algorithms on your own and submit to the grader website. The endpoints of the initial interval are the inputs. Determine the result accurate to at least to 5 sig figs. Coding problems: 1 function x = mybisectcuberoot25(a,b) %compute cube root of 25 using the bisection method %root = mybisectcuberoot25(a,b) mo 6 %INPUT a,b: two guesses that bracket the solution of x^3-25 = 0 7 %OUTPUT root: the solution (cube root of 25) 8 f=@(x) x^3-25; 9 % lower and upper limits 10 a=0; 11 b=8; % tolerance 13 tol=1e-5; 14 x=(a+b)/2; Er=Inf; iteration=0; while Er> xold=x; if f(a)*f(x) Test 1 (Pretest) > Test 2 (Pretest) > Test 3 (Pretest) > Test 4 (Pretest) Assertion failed. % Test 5 (Pretest) Assertion failed > Test 6 (Pretest) error checking: test for a,b must bracket a root > Test 7 (Pretest) MATLAB grader problems: HW 2_2 Write code to approximate V25 by applying the a) bisection method and b) false position method to the equation x3 = 25. Code the algorithms on your own and submit to the grader website. The endpoints of the initial interval are the inputs. Determine the result accurate to at least to 5 sig figs. Coding problems: 1 function x = mybisectcuberoot25(a,b) %compute cube root of 25 using the bisection method %root = mybisectcuberoot25(a,b) mo 6 %INPUT a,b: two guesses that bracket the solution of x^3-25 = 0 7 %OUTPUT root: the solution (cube root of 25) 8 f=@(x) x^3-25; 9 % lower and upper limits 10 a=0; 11 b=8; % tolerance 13 tol=1e-5; 14 x=(a+b)/2; Er=Inf; iteration=0; while Er> xold=x; if f(a)*f(x) Test 1 (Pretest) > Test 2 (Pretest) > Test 3 (Pretest) > Test 4 (Pretest) Assertion failed. % Test 5 (Pretest) Assertion failed > Test 6 (Pretest) error checking: test for a,b must bracket a root > Test 7 (Pretest)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!