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

📄 normcorr.m

📁 基于Matlab的地震数据处理显示和测井数据显示于处理的小程序
💻 M
字号:
function [cc,index]=normcorr(a,b)
% Function computes maximum normalized correlation coefficients
% INPUT  
% a 	matrix
% b     vector sliding by a (length of b does not exceed number of rows in a)
% OUTPUT
% cc    maximum correlation coefficients
% index shift at which this maximum is attained

[la,ba]=size(a);
lb=length(b);

if ba == 1 & la == lb	% a and b are vectors with the same number of elements
  cc=b(:)'*a/((norm(b)+eps)*(norm(a)+eps));
  index=0;
  return

else
  aa=[zeros(1,size(a,2));cumsum(a.*a)];
  bb=b(:)/(norm(b)+eps);

  cc=zeros(la-lb+1,ba);
  for ii=1:la-lb+1
    cc(ii,:)=bb'*a(ii:ii+lb-1,:)./(sqrt(aa(ii+lb,:)-aa(ii,:))+eps);
  end
  if size(cc,1) > 1
    [cc,index]=max(cc);
    index=index-1;
  else
    index(1:ba)=0;
  end
end


⌨️ 快捷键说明

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