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

📄 cumquad.m

📁 基于Matlab的地震数据处理显示和测井数据显示于处理的小程序
💻 M
字号:
function ci = cumquad(y,x)
% Function computes the numerical approximation to the indefinite 
% integral y dx (corresponding to cumsum)
% y   ordinates 
% x   abscissas
% If only one input argument is given then x=1:1:size(y,1);
% if given, x must have the same number of rows as y
% and either the same number of columns or one column
%     (see also quad2)
%    ci = cumquad(y,x)

[ny,my]=size(y);
itransp=0;
if ny == 1 & my > 1
   itransp=1;
   y=y(:);
   [ny,my]=deal(my,ny);
   if nargin == 2
      x=x(:);
   end
end

dy=(y(1:ny-1,:)+y(2:ny,:))*0.5;

if (nargin == 2)
   [nx,mx]=size(x);

   if nx ~= ny
      size(x), size(y)
      error('ERROR in CUMQUAD: Input arrays have incompatible dimensions.')
   end

   dx=diff(x);
   if mx == 1 & my ~= 1
      dx=dx(:,ones(my,1));
   elseif mx ~= my,
      fprintf('ERROR in CUMQUAD: Input arrays have incompatible dimensions\n')
      size(x), size(y)
     return
   end
else
   dx=ones(ny-1,my);
end

ci=[zeros(1,my);cumsum(dx.*dy)];

if itransp
   ci=ci(:);
end
    

⌨️ 快捷键说明

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