Matlab实现——Recursive Trapezoidal Rule
来源:互联网 发布:linux history 倒序 编辑:程序博客网 时间:2024/06/05 17:00
rctrap.m
%Program 7.3 (Recursive Trapezoidal Rule).function T=rctrap(f,a,b,n,tol)%Input - f is the integrand input as a string ’f’% - a and b are upper and lower limits of integration% - n is the number of times for recursion% -tol is the tolerance%Output - T is the recursive trapezoidal rule listM=1;h=b-a;T=zeros(1,n+1);T(1)=h*(feval(f,a)+feval(f,b))/2;err=1;while(err>tol) for j=1:n M=2*M; h=h/2; s=0; for k=1:M/2 x=a+h*(2*k-1); s=s+feval(f,x); end T(j+1)=T(j)/2+h*s; err=abs(T(j)-T(j+1)); endend
fun.m
function f=fun(x)f=2*x-x.^2;
untitled.m
a=0;b=2;n=20;tol=5*10e-6;f='fun';T=rctrap(f,a,b,n,tol)
- Matlab实现——Recursive Trapezoidal Rule
- Matlab实现——Adaptive Quadrature Using Simpson’s Rule
- matlab event notify recursive
- HDU 5950——Recursive sequence
- recursive
- recursive
- recursive
- CIRCOS教程翻译 5.4——Rule
- CIRCOS教程翻译 5.5——Rule
- CIRCOS教程翻译 5.6——Rule
- CIRCOS教程翻译 5.7——Rule
- CIRCOS教程翻译 5.8——Rule
- Mycat之——配置文件rule.xml
- Mycat之——配置文件rule.xml
- caffe实现RNN(recursive Neural Network, recursive NN)
- HDU5950 Recursive sequence —— 矩阵快速幂
- rule
- rule
- 智力题——9.电线标号
- 在地图上画标注用到的资料
- 尾插法创建单链表
- Matlab实现——Euler's Method
- 智力题——10.分药
- Matlab实现——Recursive Trapezoidal Rule
- Matlab实现——Lagrange approximation
- visual studio 2010 directory configuration
- JDK使用InvocationHandler和Proxy实现动态代理
- Matlab实现——Clamped Cubic Spline
- ubuntu(Debian)中ISO相关控制命令
- PostgreSQL的数据存储(十一)---数据存储
- 当人生中转换角色时,我感受到我真的很幸福
- Matlab实现——Adams-Bashforth-Method