Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to write this matlab function for bisection root finding method? Write a function with the following header: function [n iterations, root] = my root

How to write this matlab function for bisection root finding method? image text in transcribed
Write a function with the following header: function [n iterations, root] = my root bisection(f, a, b, tolerance) where: _ f is a function handle that represents a continuous real-valued function f de_ned on R. f takes a single input argument that is a scalar of class double (other than NaN, Inf, and -inf) and outputs a single output argument that is a scalar of class double (other than NaN, Inf, and -Inf). _ a and b are scalars of class double such that (b > a) and (f(a)*f(b) > my_function = @(x) x.^2 - 5; >> [n, root] = my_root_bisection(my_function, 2, 3, 1e-3) n = 12 root = 2.2361 >> f = @(var) cos(var/2); >> [n, root] = my_root_bisection(f, 3, 4, 1e-5) n = 10 root = 3.1416 >> f = @(x) cos(x)-x; >> [n, root] = my_root_bisection(f, -10, 10, 1e-4) n = 15 root = 0.7391

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

8. Provide recommendations for how to manage knowledge.

Answered: 1 week ago