Question: Write a MATLAB user-defined function that solves tor a root of an equation f(x) = 0 using the bisection method. Name the function function [x]

Write a MATLAB user-defined function that solves tor a root of an equation f(x) = 0 using the bisection method. Name the function function [x] = bisection(fun, a, b, maxtol, maxitr) The input argument fun is a name for the function that calculates f (x) for a given x (it is a dummy name for the function that is imported into bisection, a and b are two points that bracket the root, maxtol is the maximum tolerance and maxitr is the maximum number of iterations. The program will stop if either of the following conditions is met: The approximate error (abs (fun (x)) is less than the maximum tolerance (maxtol). The number of iterations exceeds the maximum number of iterations (maxitr) Output the following values at each iteration (k) using fprintf k, a, f (a), b, f (b), x Test your code using the values of maxto 1=0.01 and maxitr=20 to find the second to fifth normalized natural frequencies of the cantilever beam. Test your code to find all the roots of the following polynomial and compare your results to those obtained using roots. f(x) = x^3 - 8x^2 + 16
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
