Question: Test Cases: %% Function Name: roots % [out1] = roots([1 2 3 4 5], [-3 -2 -1 0 1], 1, 5) % out1 => 4

 Test Cases: %% Function Name: roots % [out1] = roots([1 2

Test Cases:

%% Function Name: roots

% [out1] = roots([1 2 3 4 5], [-3 -2 -1 0 1], 1, 5)

% out1 => 4

%

% [out1] = roots([1 10 100], [1 18 34], -5, 5)

% out1 => 0.51

%

% [out1] = roots([30 40 50 60], [-16 5 10 15], 20, 40)

% out1 => 36.33

Please use MatLab

Homework 11 - Ploting and Numerical Methods Function Name: roots Inputs 1. (double) A vector of x values 2. (double) A vector of y values 3. (double) A lower bound for the Inltial Interval 4. (double) An upper bound for the Inltial Interval 1. (double) The approxmate root of the function To find the root or a tunction means to find the value x of a tunction , where m)-0. Root finding algorithms provide a method of approximating the root of a function where there ls no analytical or closed form expression that can be used to determine the exact solution. Root inding algorthms have a variety of practical applications, especlally in engineering. Function Description: The blsection method is a root finding algorithm that, glven an Interval [a,b] that contains only one root, teratively cuts that Interval In half, keeping the hair that contains the root 1. Glven a set of x and y values, determine the coemclents of the highest order unique polynomlal that passes through all the polints. 2. Calculate the midpoint of the Interval using the following formula. loweriound + 3. Calculate the function values at the lower bound, the upper bound, and the midpoint 4. If the sign of the function value at the midpoint ls opposite of the sign of the function 5. Otherwise, If the sign of the function value at the midpoint ls opposite of the sign of the 6. Repeat steps 2 through 5 untl the absolute value of using the coemiclents determined In step 1 value at the lower bound, replace the upper bound with the midpolnt. function value at the upper bound, replace the lower bound with the midpoint. upper Bound lowerBound upperBound+lowerB the approximate error) Is less than 0.0001. Your final guess for the root will be the midpoint of the inal Interval Notes: The Inibal Interval is guaranteed to contain exacty one root. Round your final answer to two declmal places Hints: If the product of two numbers is negative, then they have the opposite sign

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!