?? 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)
[na,ma]=size(a); [nb,mb]=size(b);
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 + -