Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(50 points) Create a Matlab function that, Takes as input: a function f, its derivative fderv, the endpoints of an interval a and b. Checks

image text in transcribed

(50 points) Create a Matlab function that, Takes as input: a function "f", its derivative fderv, the endpoints of an interval a and b. Checks if a b changes the value of a with the value of b and vice-versa. If a = b the function should error out using the "error("an explanation for failure) command of matlab. Generates an array x slicing the interval [a, b] with a sampling length of 0.001. Evaluates the function on the above array and gets a new array y. The evaluation array y is searched for any value between (-0.0001, 0.0001) and the relevant x points are recorded into a new array named "xguess. You can do this by using a for loop, and getting the length of the array y with "length(y). Hint: create a new empty array with "xguess=[]" before the loop and place every new item you find to the tail of the array with the syntax "xguess=[xgues, whatever new item] The attached myNewton Tol function is called for the inputs of this function and a tolerance of 0.0001, and the result recorded as "xNewton. The number xNewtol is compared with every entry of "xguess (again perhaps with a loop). If any entry of xguess is at a distance of 0.000001 or less function outputs 1, if not function outputs 0. Comment everything like we did in the lecture, and try to explain what you think this function is for

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