Need Help ?
Have a Question ?

(Solved): Write A MatLab Function For To Implement EACH Of The Following 3 Algorithms For Solving Equation F(x ...


Problem 1. (25pts) plement EACH of the the following 3 algorithms for solving equation Write a matlab function for to impleme

Write a MatLab function for to implement EACH of the following 3 algorithms for solving equation f(x) = 0: (i) bisection method; (ii) Newton's Method: (iii) Secant Method; use your codes to solve the following equation: f(x) = e^cos(x) + x^3 - 1.

Requirements:

(a) The stopping criterion for the iteration is EITHER the number of iterations reaches 50 OR the relative change od approximate solution is <= 10^-10

(b): For each solution method, print out every step of the following information: (i) current number of steps n; (ii) curretn approximate aolution x_n; (iii) currnet function value f(x_n); (iv) current error err(n)=|x_n - x_star|; where x_star is the roots found with fzero.

(c) For each solution method, make a plot of the error history err(n) vs. n in log scale by using matlab command semilogy.

Problem 1. (25pts) plement EACH of the the following 3 algorithms for solving equation Write a matlab function for to implement EACH of the the following 3 algo nethod; (iii) secant method; Use your codes to solve fr) = 0: (i) bisection method; (ii) Newton's method; (iii) secant method; Use your the following equation f(x) = cos(x) + 3-1 Requirements: (a): The stopping criterion for the iteration is EITHER the number of iterations reaches 50 OR the relative change of approximate solution is < 10-10, i.e., 2n+1 - Un <10-10 1+ lan (b): For each solution method, print out every step the floowing infomation: (i) current number of steps n; (ii) current approximate solution In; (iii) current function value f(n); (iv) current error err(n) = 2n - .; where s, is the roots found with fzero. (c): For each solution method, make a plot of the error history err(n) vs. n in log scale by using matlab command semilogy.

Expert Answer


assuming the initial guess as x=-1 and x=0 We have root of the given equation at x=-0.9334 --------%bisection function p = Bisection(f,a,b) % Provide the equation you want to solve with R.H.S = 0
We have an Answer from Expert Buy This Answer $6