newtonsys.m
来自「用matlab写的一些数值算法」· M 代码 · 共 15 行
M
15 行
function [x,k] = newtonsys(fdf,x0,tol,kmax)
% Solve system f(x)=0 by Newton-Raphson's method.
% f(x) and J(x) given by [f,J] = fdf(x)
% Starting point x0.
% Iterate until norm of correction is smaller than tol
% or the number of steps exceeds kmax
% Version 11.12.2003. INCBOX
k = 0; x = x0; % initialize
[f, J] = feval(fdf, x); h = J\f;
while (norm(h) > tol) & (k < kmax)
k = k+1; x = x - h;
[f, J] = feval(fdf, x); h = J\f;
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?