fg_03_02.m

来自「英文书《Digital Signal Processing with Examp」· M 代码 · 共 35 行

M
35
字号
% fg_03_02
% Chapter 3, fig. 3.2.  Correlation detection.
%
sp_fig(1)
% Signal at N/5 and 4N/5-600.
N=5000;
w=[-ones(1,50),ones(1,50)];
y=[w -w w];
signal=[zeros(1,N/5),y,zeros(1,3*N/5-600),y,zeros(1,N/5)];

size=16;
subplot(3,1,1);
plot([y,zeros(1,4700)],'color','k'); grid;
axis([0 N -1.5 1.5]);
set(gca,'fontsize',16);
ylabel('Signal');
title('Example of Correlation Detection');

randn('state',123);
noise=2*randn(1,N);
x=signal+noise;
subplot(3,1,2);
plot(x,'k'); grid;
axis([0 N -10 10]);
set(gca,'fontsize',16);
ylabel('Signal+noise');

%rxy=crosscorr([y,zeros(1,N-100)],x,0,N);
rxy=crosscorr(y,x,0,N);
subplot(3,1,3);
plot(rxy,'k'); grid;
set(gca,'fontsize',16);
xlabel('Sample number');
ylabel('\phi_{xy}(m)');

⌨️ 快捷键说明

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