Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

matlab please !!!!!! thank you Function Name: rootChopper Inputs: 1. 2. 3. 4. (double) A set of x data (double) A corresponding set of y

image text in transcribedimage text in transcribedmatlab please !!!!!! thank you

Function Name: rootChopper Inputs: 1. 2. 3. 4. (double) A set of x data (double) A corresponding set of y data (double) A lower bound on the x values (double) An upper bound on the x values Outputs: 1. (double) The x position of a root Background: Along your Pokmon adventures there were numerous obstacles, from the many different gyms to the fields of wild Pokmon; however, there was never so great an obstacle as the lone tree in your path. Unfortunately, the only Pokmon you have who knows cut is a little slow on the uptake and has missed the tree several times. You, being the MATLAB wizard/Pokmon trainer that you are, decide to make a function to find exactly where the roots of the tree are so that your Pokmon has no excuse to miss again! Function Description: The bisection method is a root finding algorithm that, given an interval [a,b] that contains only one root, iteratively cuts that interval in half, keeping the half that contains the root. 1. Given a set of x and y values, determine the coefficients of the highest order unique polynomial that passes through all the points 2. Calculate the midpoint of the interval using the following formula: lowerBound + upperBound midpoint 3. 4. 5. Calculate the function values at the lower bound, the upper bound, and the midpoint using the coefficients determined in step 1 If the sign of the function value at the midpoint is opposite of the sign of the function value at the lower bound, replace the upper bound with the midpoint Otherwise, if the sign of the function value at the midpoint is opposite of the sign of the function value at the upper bound, replace the lower bound with the midpoint upperBound -lowerBound upperBound + lowerBound 6. Repeat steps 2 through 5 until the absolute value of (the approximate error) is less than 0.0001. Your final guess for the root will be the midpoint of the final interval Function Name: rootChopper Inputs: 1. 2. 3. 4. (double) A set of x data (double) A corresponding set of y data (double) A lower bound on the x values (double) An upper bound on the x values Outputs: 1. (double) The x position of a root Background: Along your Pokmon adventures there were numerous obstacles, from the many different gyms to the fields of wild Pokmon; however, there was never so great an obstacle as the lone tree in your path. Unfortunately, the only Pokmon you have who knows cut is a little slow on the uptake and has missed the tree several times. You, being the MATLAB wizard/Pokmon trainer that you are, decide to make a function to find exactly where the roots of the tree are so that your Pokmon has no excuse to miss again! Function Description: The bisection method is a root finding algorithm that, given an interval [a,b] that contains only one root, iteratively cuts that interval in half, keeping the half that contains the root. 1. Given a set of x and y values, determine the coefficients of the highest order unique polynomial that passes through all the points 2. Calculate the midpoint of the interval using the following formula: lowerBound + upperBound midpoint 3. 4. 5. Calculate the function values at the lower bound, the upper bound, and the midpoint using the coefficients determined in step 1 If the sign of the function value at the midpoint is opposite of the sign of the function value at the lower bound, replace the upper bound with the midpoint Otherwise, if the sign of the function value at the midpoint is opposite of the sign of the function value at the upper bound, replace the lower bound with the midpoint upperBound -lowerBound upperBound + lowerBound 6. Repeat steps 2 through 5 until the absolute value of (the approximate error) is less than 0.0001. Your final guess for the root will be the midpoint of the final interval

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

(1 point) Calculate 3 sin x cos x dx.

Answered: 1 week ago

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago

Question

c. How is trust demonstrated?

Answered: 1 week ago

Question

Have issues been prioritized?

Answered: 1 week ago