⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fixed_point.m

📁 a m file for matlab the secant method
💻 M
字号:
function rtn=fixed_point(fx,x0,tol,N)
% Fixed-Point Iteration
% The first parameter fx is a external function with respect to viable x.
% x0,x1 are initial iteration points.
% tol is the tolerance of the loop.
% N is the maximum number of iterations.
i=1;
while i<=N
    x=x0;
    f0=eval(fx);
    x1=f0;
    x=x1;f1=eval(fx);
    X=[i,x0,x1,f1];
      disp(X);
      if abs(x1-x0)<tol
          fprintf('The procedure was successful.')
          return
      else
          i=i+1; x0=x1;f0=f1;
      end
end
if i==N+1
    fprintf('The method failed after N iterations. ')
 end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -