【matlab互相关运算】求两个数组相关性
x = input('输入数组1 ');
y = input('输入数组2 ');
n1 = length(y)-1;
n2 = length(x)-1;
r = conv(x,fliplr(y));
k = (-n1):n2';
subplot(211)
stem(k,r);
xlabel('Lag index');
ylabel('Amplitude');
r1=xcorr(x,y);
subplot(212)
stem(k,r1);
xlabel('Lag index');
ylabel('Amplitude');