Showing that Newtons method is quadratic convergent in Matlab
조회 수: 7 (최근 30일)
이전 댓글 표시
I'm trying to show that Newtons Method is quadratic convergent, i.e that e_(i+1)/e^2_(i) < infinity, where i = iterations, and e = error. I'm having trouble writing this out in Matlab Code, this is what I have so far
--------
function x = newtH(f, d, x0)
c = x0;
tol = 10^-10;
count = 0;
x = x0;
y = f(x);
while abs(y) > tol
count = count + 1;
x = x - y/d(x);
y = f(x);
end
count
q = ['Number of iterations near the point x0 = ', num2str(c),', for Newtons method is = ', num2str(count), '. And the root is: '];
disp(q)
end
댓글 수: 0
답변 (1개)
Steven Lord
2021년 9월 30일
Before you implement this in code, how would you implement Newton's method (with error data collection, to assess convergence) in words? Try writing the algorithm's steps down as comments. Once you're sure you have all the steps you need, then implement each step below its corresponding comment. If you're not sure how to implement a step, break it into substeps (again described in words as comments) that you can implement.
As you've written the code you showed above, the word "error" likely will not appear frequently enough in your comments to give you the information you need to illustrate convergence. [Using your notation, there is no variable e in your function.]
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!