📄 newton.m
字号:
function [x,k] = newton(fdf,x0,tol,kmax)
% Solve f(x)=0 by Newton-Raphson's method.
% f(x) and f'(x) given by [f,df] = fdf(x)
% Starting point x0.
% Iterate until correction is smaller than tol
% or the number of steps exceeds kmax
% Version 11.12.2003. INCBOX
k = 0; x = x0; % initialize
[f, df] = feval(fdf, x); h = f/df;
while (abs(h) > tol) & (k < kmax)
k = k+1; x = x - h;
[f, df] = feval(fdf, x); h = f/df;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -