?? samp9_3.m
字號:
%Samp9_3
clf;N=1000; Fs=500; %數據長度和采樣頻率
n=0:N-1;t=n/Fs; %時間序列
Lag=200; %最大延遲單位
x=sin(2*pi*10*t); %周期信號x
y=0.5*sin(2*pi*10*t+90*pi/180); %與x有90o相移的信號y
[c,lags]=xcorr(x,y,Lag,'unbiased'); %求無偏互相關
subplot(2,1,1);plot(t,x,'r'); %繪制x信號
hold on;plot(t,y,':'); %在同一幅圖中繪y信號
legend('x信號', 'y信號')
xlabel('時間/s');ylabel('x(t) y(t)');
title('原始信號');grid on;
hold off
subplot(2,1,2),plot(lags/Fs,c,'r'); %繪制x,y的互相關
xlabel('時間/s');ylabel('Rxy(t)');
title(' 信號x和y的相關');grid on
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -