Question: Write a code for the bisection algorithm for finding a root of a real valued function. Implement your code as a Matlab function that utilizes

Write a code for the bisection algorithm for finding a root of a real valued function.

Implement your code as a Matlab function that utilizes a for loop, using the following input and outputs

Input =

f(x) - The real valued function for which you want to find the root.

a, b - An interval for which you think the root lies

tol - A tolerance

maxiter - A maximum number of iterations.

Output r - The approximate root of your function (|f(r)| < tol)

resarray - An array of the residuals at each step. The first line of your code should therefore read: function [r, resarray] = bisect(f,a,b,tol,maxiter)

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!