Question: Write a MATLAB script to find one root of the following equation between 0 and 1 , with a maximum number of 1 0 0

Write a MATLAB script to find one root of the following equation between 0 and 1, with a maximum number of 100 steps and a tolerance of 10-6.
h(x)=e-x-x2-x
For information about using the Newton-Raphson Method, reffer to slides 1-18 of Module_02.
Script ?o.
% Here, write your script for the problem statemenet above. Your script MUST be properly and completely commented to receive full credit.
% Define variables and functions as instructed below.
% The anonymous functions for f(x),dfxdx, and d2fxdx2 must be named: h,dhdx, and dh2dx2, respectively.
% The anonymous fuynctions for g(x) and dgxdx must be named: g and dgdx, respectively.
% Store the initial solution in an array variable named ini_x.
% The variable for the maximum number of iterations must be called max_itr.
% Use a variable called iter to count your iterations inside the loop.
% Use a variable called Tol to determine the tolerance for the calculations.
% Define a variable called Cnv to check if your calculations are converging inside the loop.
% After the solution is completed, print out the root using the fprintf command in the following format:
% Root: {tab}12.3456{next line}
% Note that MATLAB is case-sensitive. Variables MUST be defined as instructed above, or points will be deducted.
% For this exercise, you need a while-loop only.
Write a MATLAB script to find one root of the

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 Programming Questions!