📄 corr.m
字号:
function c = corr(a,b)
% Correlation of vectore "a" and "b". The resulting
% vector is length length(a)+length(b)-1
%
na = length(a);
nb = length(b);
if na ~= numel(a) | nb ~= numel(b)
error('"a" and "b" must be vectors.');
end
% "filter" is substantially faster if the first argument to filter
% the shorter of the two.
if na > nb
if nb > 1
a(na+nb-1)=0;
end
c=filter(b(end:-1:1),1,a);
else
if na > 1
b=b(end:-1:1);
b(na+nb-1)=0;
end
c=filter(a,1,b);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -