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

📄 difflim.m

📁 关于数值计算的matlab程序代码,包含了很多的实用的算法.程序全部可以直接用的,有详细的英文注释.
💻 M
字号:
function  [L,n]=difflim(f,x,toler)%Input  - f is the function input as a string 'f'%       - x is the differentiation point%       - toler is the desired tolerance%Output - L=[H' D' E']: H is the vector of step sizes%                       D is the vector of approximate derivatives%                       E is the vector of error bounds%       - n is the coordinate of the "best approimation"%  NUMERICAL METHODS: Matlab Programs% (c) 2004 by John H. Mathews and Kurtis D. Fink%  Complementary Software to accompany the textbook:%  NUMERICAL METHODS: Using Matlab, Fourth Edition%  ISBN: 0-13-065248-2%  Prentice-Hall Pub. Inc.%  One Lake Street%  Upper Saddle River, NJ 07458max1=15;h=1;H(1)=h;D(1)=(feval(f,x+h)-feval(f,x-h))/(2*h);E(1)=0;R(1)=0;for n=1:2   h=h/10;   H(n+1)=h;   D(n+1)=(feval(f,x+h)-feval(f,x-h))/(2*h);   E(n+1)=abs(D(n+1)-D(n));   R(n+1)=2*E(n+1)*(abs(D(n+1))+abs(D(n))+eps);endn=2;while((E(n)>E(n+1))&(R(n)>toler))&n<max1   h=h/10;   H(n+2)=h;   D(n+2)=(feval(f,x+h)-feval(f,x-h))/(2*h);   E(n+2)=abs(D(n+2)-D(n+1));   R(n+2)=2*E(n+2)*(abs(D(n+2))+abs(D(n+1))+eps);   n=n+1;endn=length(D)-1;L=[H' D' E'];

⌨️ 快捷键说明

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