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

📄 scale.m

📁 基于Matlab的地震数据处理显示和测井数据显示于处理的小程序
💻 M
字号:
function [scaled,scale]=scale(a,b,type)
% Function scales columns of a so that they best match b.
% a and b must have the same number of columns.
% type indicates if one scale for all column is to be computed (type=1)
% or if each column should be scaled separately (any other value)
%	[scaled,scale]=scale(a,b,type)

ma=size(a,2); 
mb=size(b,2);
if ma ~= mb, 
   fprintf('ERROR in scale: input arrays have different number of columns (%d, %d)\n',ma,mb)
   return
end

cc=correlate(a,b); 
mcc=max(cc);
ac=sum(a.*a);
if type == 1,
   scale=sum(mcc')/sum(ac');
   scaled=scale*a;
else
   scale=mcc./ac;
   scaled=zeros(size(a));
   for ii=1:size(a,2);
      scaled(:,ii)=a(:,ii)*scale(ii);
   end
end

⌨️ 快捷键说明

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