Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use matlab and post code. i also provided the templates for each method 2. Consider the function f(x)-x cos(x) [2 points] Using MATLASB, plot
Please use matlab and post code. i also provided the templates for each method
2. Consider the function f(x)-x cos(x) [2 points] Using MATLASB, plot the function over the interval -0.5 Sx S 1.4 [1 point] Verify that the function has a zero near x -0.74. What is the value of f at this x value?] a. b. Obtain approximations to the zero near x 0.74 using c. [5 points] The Bisection method, with starting interval [0.25,1]: d. [4 points] The Method of False Position with starting interval [0.25,1]: Note that you must devise convergence criteria for the methods that you use above. You may choose to define convergence as being when then value of f is close to zero, or if change in estimate of the root location (x) from step to step is close to zero. The criteria should be the same for both methods. 12 points) Report the number of steps that each method required to find the root location e. f [3 points] use tic and toe to time each routine, and report the execution time for each iterative procedure Program 22 (Bisection Method). To approximate a root of the equation f(x) 0 in the interva) la, b). Proceed with the method only if f(x) is continuous and f(a) and ftb) have opposite signs. function c,erryc]-biaect(f,a,b,delta) %input -t is the function input as a string ,f, - a and b are the left and right end points - delta is the tolernce %Output-c is the zero -etr is the error estimate for c ya feval(?,a); yb feval(f,b) if yaryb>0, break, end maxi-1tround log(b-a)-log delta))/log(2)): for k 1:naxi c (a+b)/2 yc tevalff.c): if yc #0 ac ; b c; yb-y: olse a-ci ya yc: end if b-a o f(a)sf (b) >0'), disp('Note: break, end for k-1:max1 dxeyb (b-a)/(yb-ya); c-b-dx; "feval (f ,c) ; if yc--o, break; elseif ybeyc>o b c yb-yc ; lse ya-yc dx-min(abs (dx),ac); if abs(dx)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started