)
t
(
x
4
2
0
-2
-4
0
带 噪 声 周 期 信 号 的 自 相 关
带 噪 声 周 期 信 号
1
0.5
0
-0.5
)
t
(
x
R
0.5
1
时 间 /s
1.5
2
-1
-2
-1
0
时 间 /s
1
2
%c 采用默认的长度,2N-1=1999, c 的序号向量为-999:999
>> N=1000;Fs=500;
>> n=0:N-1;
>> t=n/Fs;
>> Lag=100;
>> randn('state',0);
>> x=sin(2*pi*10*t)+0.6*randn(1,length(t));
>> [c,lags]=xcorr(x, 'unbiased');
>> subplot(2,2,1),plot(t,x);
>> xlabel('时间/s');ylabel('x(t)');title('带噪声周期信号');grid on;
>> subplot(2,2,2);plot(lags/Fs,c);
>> xlabel('时间/s');ylabel('Rx(t)');
>> title('带噪声周期信号的自相关');grid on;
)
t
(
x
4
2
0
-2
-4
0
带 噪 声 周 期 信 号 的 自 相 关
带 噪 声 周 期 信 号
1
0.5
0
-0.5
)
t
(
x
R
0.5
1
时 间 /s
1.5
2
-1
-0.2
-0.1
0
时 间 /s
0.1
0.2
%c 的值为 2*Lag+1=201,c 的序号向量为-100:100(-Lag:Lag)
>> N=1000;Fs=500;
>> n=0:N-1;
>> t=n/Fs;
>> Lag=100;
>> randn('state',0);
>> x=sin(2*pi*10*t)+0.6*randn(1,length(t));
>> [c,lags]=xcorr(x,Lag, 'unbiased');
>> subplot(2,2,1),plot(t,x);
>> xlabel('时间/s');ylabel('x(t)');title('带噪声周期信号');grid on;
>> subplot(2,2,2);plot(lags/Fs,c);
>> xlabel('时间/s');ylabel('Rx(t)');
>> title('带噪声周期信号的自相关');grid on;
N=1000;Fs=500;
>> n=0:N-1;
>> t=n/Fs;
>> Lag=100;
>> randn('state',0);
>> x=sin(2*pi*10*t)+0.6*randn(1,length(t));
>> [c,lags]=xcorr(x);
>> subplot(2,2,1),plot(t,x);
>> xlabel('时间/s');ylabel('x(t)');title('带噪声周期信号');grid on;
>> subplot(2,2,2);plot(lags/Fs,c);
>> xlabel('时间/s');ylabel('Rx(t)');
>> title('带噪声周期信号的自相关');grid on;