


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



This assignment has portions to be handed in electronically and portions to be submitted on paper. Electronic portions are marked [Electronic] and written portions are marked [Written]
. All of the MATLAB functions you write should have the exact name as specified in the assignment. You will later use a MATLAB program, CheckMP4.p, to submit these functions. This assignment is intended to serve the following purposes:
You are encouraged to plot these functions with MATLAB to see what it looks like before you start to work on your assignment.
NOTE:
You should not use any MATLAB built-in function for root finding such as fzero in this assignment. Note also that the lecture notes contain examples of similar MATLAB codes which you can take as reference.
f (x) = 2x^ − 8
Our goal is to examine the behavior of the bisection method when finding the root of f (x) = 0.
(a) [Electronic] Write a MATLAB function [V, FV] = myBisect(a, b, eps) which meets the following requirements:
In this case, we notice that f (a) has a different sign from f (h1), and so we choose this interval to be the new interval. Likewise, if f (h1) and f (h2) had opposite signs, we would have chosen [h 1 , h2], and if f (h2) and f (b) had opposite signs we would have chosen [h 2 , b]. Give a formula for the “trisection method”’s accuracy after n iterations. Explain why this method is not better than the bisection method in terms of the number of function evaluations.
G(x) =
(x^3 − 4 x^2 + 7x)
Our goal is to solve the fixed point problem G(x) = x.
i. Given the initial points x 0 = 1, x 1 = 1.1, plot a graph of f (x) at the points of (xi; f (xi)), where 1 ≤ i ≤ n, and xi is the i-th approximation to the root you obtained above with the Secant method. Hand in a printout of this plot. ii. Do the xi’s converge with x 0 = 1, x 1 = 1.1? Explain why or why not. iii. Do the xi’s converge with x 0 = 10, x 1 = 10.1? Explain why or why not.
NOTES:
Please note that problems 2 and 3 have been updated since the very first post! You should submit your functions by running the checker program, CheckMP4.p, when they are all completed.
To run the program, download ”CheckMP4.p” posted on CS 257 homepage to your root direc- tory on an EWS UNIX workstation. This should be the same directory in which your three function files are located. Run the checker from inside MATLAB by typing CheckMp4 at the command prompt.
The checker will test your functions, and if they are correct, it will submit an email containing your functions to the graders. Please do not run the checker more than once if your files are correct. You must run the checker from your EWS account, so that the email submission can be properly identified.
Each function must work exactly to our specifications; no partial credit will be given.
Don’t forget to submit your solutions to the written portions either in class or to the TA office by the due date.