driver_ex2.m
来自「linear equation routines in matlab」· M 代码 · 共 30 行
M
30 行
clear all x0 = [10; 10; 10]; tolf = 1.e-10; tolx = 1.e-10; maxit = 100; % Newton's method [x, ithist, iflag] = newtnd( 'ex2', x0, tolf, tolx, maxit ); fprintf('\n Newton''s Method \n ') fprintf(' iter || x ||_2 || F(x) ||_2 || s ||_2 t\n ') for i = 1:size(ithist,1) fprintf('%4d &$ %13.8e $&$ %13.8e $&$ %13.8e $&$ %13.8e $\\\\ \n ', ithist(i,:)) end % Finite Difference Newton method [x, ithist, iflag] = fdnewtnd( 'ex2', x0, tolf, tolx, maxit ); fprintf('\n Finite Difference Newton''s Method \n ') fprintf(' iter || x ||_2 || F(x) ||_2 || s ||_2 t\n ') for i = 1:size(ithist,1) fprintf('%4d &$ %13.8e $&$ %13.8e $&$ %13.8e $&$ %13.8e $\\\\ \n ', ithist(i,:)) end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?