Question: Write MATLAB code g(x)=x+a*f(x) f(x)=(e^x)+(x^2)-x-4 function f(x) is stored in fogp1.m (c) (1) Create a file gopgi.m to calculate the function glir, a) (see Preparation,

Write MATLAB code

g(x)=x+a*f(x)

f(x)=(e^x)+(x^2)-x-4

function f(x) is stored in fogp1.m

Write MATLAB code g(x)=x+a*f(x) f(x)=(e^x)+(x^2)-x-4 function f(x) is stored in fogp1.m (c)

(c) (1) Create a file gopgi.m to calculate the function glir, a) (see Preparation, ex. 7c) function [y] =gopg1(x,a) % input: x, a % output: y y= .....; (2) Create a file sucsub1.m and write a program that calculates the solution using the method of successive substitution. Calculate the values of g(x, a) by making multiple calls to the function gopg1(x, a). Take xo = 1.3 as starting value and try several values for a, including the optimal value that you found (Preparation, ex. 7c). (3) Print the iteration counter at each iteration step, as well as the approximation of the solution. Is your optimal value of a indeed the optimal one? (4) Estimate the error at each iteration by using successive solutions (Preparation, ex. 5a) and use the estimates to determine a stop criterion. The requested accuracy is tol = 10-8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!