📄 scale.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 + -