Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
(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
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