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

📄 corr_conv.m

📁 calculate the correlation and convolution
💻 M
字号:
%Compare the calculations of convolution and correlation of two arrays..

x = [1 2 4 -2 3 -6];
y = [-1 2 4 -3 5];
xy_corr = xcorr(x,y);
y = -y;
y = fliplr(y);
xy_conv = conv(x,y);
lth = max(length(xy_corr),length(xy_conv));

if 1,
%     stem(1:lth+1,xy_corr,1:lth+1,xy_conv);
    legend('Correlation','Convolution')
    title('Comparation')
% %       stem(1:lth,xy_corr)
      stem(1:lth,xy_corr,'bo--')
      hold on
      stem(1:lth-1,xy_conv,'rx')
%       hold on
%       stem(xy_conv,'kx')
end

    

⌨️ 快捷键说明

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