e772.m

来自「matlab算法集 matlab算法集」· M 代码 · 共 23 行

M
23
字号
%------------------------------------------------------------------
% Example 7.7.2: Infinite Limit of Integration                     
%------------------------------------------------------------------
   clc
   clear
   N = 9;
   a = 0;
   b = 1;
   f = inline ('4/(pi*(4 + x.^2))','x');
   g = inline ('4/(pi*(1 + 4*z.^2))','z');
   fprintf ('Example 7.7.2: Infinite Limit of Integration\n');
   fprintf ('\n n      I(0,1)     percent error\n');
   fprintf ('--------------------------------\n'); 
   for n = 1 : N
      y = gausquad(a,b,n,f) + gausquad(a,b,n,g); 
      fprintf ('%2i %12.7f   %12.7f\n',n,y,100*(y-1));
   end
   fprintf ('--------------------------------\n'); 
   wait
%------------------------------------------------------------------

      

⌨️ 快捷键说明

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