How to add a Sequence of Estimates to my Newton Raphson Code? please help!!

조회 수: 1 (최근 30일)
Matthew
Matthew 2012년 11월 19일
My code works BUT I need to add 1 more thing:
  1. output- a vector containing the sequence of estimates including the initial guess x0,
function [ r, n ] = myNewton( fHan,dfHan,x0,fTol, itermax )
i = 1;
while abs(fHan(x0)) >= fTol
r(i) = x0;
n(i) = abs(fHan(x0));
i = i+1;
x0 = x0-((fHan(x0))/(dfHan(x0)));
end
for j = 1:itermax;
dx = fHan(r) / dfHan(r);
r = r - dx
if r < fTol
return
end
end
if abs(fHan(x0)) < fTol
r(i) = x0;
n(i) = abs(fHan(x0));
end
end
how do I go about doing this? thanks!!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Newton-Raphson Method에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by