Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write a function bisectionmethod that inputs a function f, two numbers a and b, an error tolerance tol, and a maximum number of iterations
1. Write a function bisectionmethod that inputs a function f, two numbers a and b, an error tolerance tol, and a maximum number of iterations N, and approximates a root c of f in [a, b using the bisection method. Your function should compute a bound err on the absolute error and halt when err N, whichever happens first. The function signature should be as follows: function [e, n, err] * bisection sethod(f, a, b, tol, N) U se your code to solve fir)- 0, f:(2x3 + 31-1)cosz-z, fr zel-1,11, with tol = 10-5 (a) What number n of iterations were needed? (b) What is the error bound upon termination? (c) What is the expected rate of convergence? (d) Plot the function f and the r-axis (y 0) on the same graph. (e) Solve f(x) 0 on the same interval using MATLAB's rootfinder fzero, and compare with your solution
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started