Use Matlab 2.1 Newton\'s Method function [R, E] = myNewton (f, df, x0, tol) Type
ID: 3730792 • Letter: U
Question
Use Matlab
2.1 Newton's Method function [R, E] = myNewton (f, df, x0, tol) Type Function handle Function handle 1xl double 1xl double Input Description A function handle representing the func- tion f(z) A function handle to the derivative of f df The initia l estimate of the root tol A strictly positive scalar double Output A row vector of class double, where R(1) is the initial estimate x0, and R(k+1) is the estimate of the root of f after k itera- tions in the Newton Method 1xM double The absolute error of class double, where E(k) is the value of |f(R(k)) 1xM double Here you will program the Newton-Raphson root finding method with details specified as follows. Details e The function should return when E(end)Explanation / Answer
function [R,E]=myNewton(f,df,x0,tol)
R(1)=(x0);
E(1)=abs(f((x0)));
for i=1:100
x=x0-f(x0)/df(x0);
R(i+1)=x;
E(i+1)=abs(f(x));
if (E(i+1))<tol
break;
end
x0=x;
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.