Question: Plz solve this problem with the script it provides. Thank you. Fixed point method O solutions submitted ( max: Unlimited) Write a MATLAB function, called


Plz solve this problem with the script it provides. Thank you.
Fixed point method O solutions submitted ( max: Unlimited) Write a MATLAB function, called fixed_point_iteration that inputs a function, 8, an initial guess x_@, an error tolerance, tol, and a maximum number of iterations, N, and outputs the fixed point of g, obtained using the fixed point iteration, starting with x_0. Your function should have an error defined by E = |x_n-x_{n-1} ], and stop when the error is less than the tolerance, or if the number of iterations exceeds N - whichever happens first. Your function header should look something like: function [C, n,err] = fixed_point_iteration (8,0, tol,N) 1, with an accuracy of 10-0 for x in [-1, 1]. State your initial guess, and how many iterations it took. Use the code you just developed to find the solution to the equations x= e-* and r= Plot on the same graph, y = g(x) and y = x. Here is the fixed-point solution and n the number of iterations the method takes. To avoid function/variable override, let g = e^{-x} and g1 = 1/(1+x). Furthermore, when you call the fixed_point_iteration function, do the following: [C, n, err] = fixed_point_iteration (8,xo, tol,N) [c1,61, err1] = fixed_point_iteration(g1,x01, tol,N1) The MATLAB function for e* is exp(-x). Script C Reset MATLAB Documentation 1 g = @(x) sin(x); 2 g1 = @(x) 1./x; x0 = 0.5; 5 tol = 1.e-10; 6 N = 10; 8 x01 = 0.2; 9 N1 = 100; 11 figure(1); 12 plot([-1.0.1:1),8([-1.0.1:1]), [-1.0.1:1],[-1:0.1:1],'--'); 14 figure(2) plot([-1:0.1:1],g1([-1:0.1:1]), [-1:0.1:1],[-1:0.1:1],'--'); [C, n,err] = fixed_point_iteration(g,xe, tol,N) [c1, n1, erri] = fixed_point_iteration (g1,x01, tol,N1) %% Function fixed point function [c, n,err] = fixed_point_iteration(g,xe, tol,N) % Complete the rest of the code here or see the code in the code file 24 end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
