Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve by matlab please!! Problem 2 : The bisection method The purpose of this exercise is to apply the bisection method and study its convergence

Solve by matlab please!! image text in transcribed
Problem 2 : The bisection method The purpose of this exercise is to apply the bisection method and study its convergence Write a function with name bisectionMethod with input a function f, a left end-point a, a right end-point b and a tolerance level tol. Your function should do the following: Check that a 0. If not, should print an error message and stop execution. Return the vector midPoints that contains all midpoints generated by the bisection method applied to f with an initial interval a, b Return the vector fMidPoints that contains the corresponding function values on all midpoints generated by the bisection method applied to f, with an initial interval [a, b]. Create a figure with the graph of in a, b] AND the first and last midpoints of the bisection method marked with red marks on the x-axis. (You can use any marker style you prefer.) Print a message in the standard output, stating o the number of iterations needed to reach a solution to f(x)-0 within a tolerance of tol o the approximation to the solution of f(x)-0 caleulated by the bisection method In your prob2), call your bisectionMethod function to find the real roots of the following functions: (a) cosx -x, starting with [0,1], with tol-10-6 (b) x sin x, starting with three different intervals (one per run) and tol-10-6. Each interval should have a length of '/2 and contain a different root of x sin x AND to find (e) v7 (Note: you are asked to use the bisection method to find this, do NOT use sqrt!)

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

1. Why do people tell lies on their CVs?

Answered: 1 week ago

Question

2. What is the difference between an embellishment and a lie?

Answered: 1 week ago