create a user defined function

4 views (last 30 days)
chase seay
chase seay on 11 Apr 2017
Commented: Rik on 11 Apr 2017
Craft a UDF that performs the following tasks. 1. Accepts as an input argument a 4-element vector containing: - the lower bound for the search interval - the upper bound for the search interval - a value of f(x) close enough to zero to accept x as an approximate value for a root - the maximum number of iterations before termination of execution. 2. Calls another UDF, myFunction, saved in a different m-file, to compute values of the independent variable from values of the dependent variable. No credit will be earned for this assignment if you do not use the specified function name. 3. Reports to the CW one of the two possible outcomes. a) If a root is found, the approximate value of the root and the corresponding value of the function, b) That an approximate value for a root has not been found after -- iterations where the hyphens are the number of iterations conducted. The file you submit to the dropbox should have only the UDF that performs the bisection. [10] HINT: You may wish to use a while-construct to terminate execution. NOTE: Although this method is considered slow compared to other numerical methods for finding the root of a function, after only 20 iterations the length of the search interval will be less than 1 millionth of its starting length!
  2 Comments
KSSV
KSSV on 11 Apr 2017
Home work problem...what have you tried?
Rik
Rik on 11 Apr 2017
You can find guidelines for posting homework on this forum here.

Sign in to comment.

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!