数值计算方法第五章第二节 复化求积公式.pptVIP

  • 71
  • 0
  • 约3.66千字
  • 约 39页
  • 2018-05-14 发布于四川
  • 举报

数值计算方法第五章第二节 复化求积公式.ppt

第 二 节 复化求积公式 Example 1 Approximate the integral Using the Composite Trapezoidal rule and Composite Simpson’s rule x=eps:0.01:pi; y=sin(x)./x; plot(x,y); legend(f(x)=sin(x)/x); function rs= trapezoid(f,a,b,n) h = (b-a)/n; r= (feval(f,a)+feval(f,b))/2 ; for j = 1:n-1 x=a+j*h ; r= r+ feval(f,x); end rs = r* h; n=8, tp=1.84784230644461 n=16, tp=1.85091414036536 n=32, tp=1.85168137241373 n=64, tp=1.85187313510989 n=128, tp=1.85192107295303 n=256, t

文档评论(0)

1亿VIP精品文档

相关文档