?? 5-4.m
字號:
%例程5-4 計算隨機信號的自協(xié)方差函數(shù)與互協(xié)方差函數(shù)
% e.g.5-4.m for example5-4 to test function of xcov;
clear;
N=256;
f=.1;
t=[0:N-1];
a1=3;
a2=4;
Mlag=N/4;
% Generate two sine waves plus white noise respectively
x=a1*sin(2*pi*f*t)+a2*randn(1,N);
y=a2*sin(2*pi*f*t)+a1*randn(1,N);
subplot(2,2,1);
plot(x(1:N/2));
grid on;
title('Original signal x');
subplot(222);
plot(y(1:N/2));
grid on;
title('Original signal y');
% Estimate the biased autocovariance of random process x
auto_cx=xcov(x,Mlag,'biased');
subplot(223);
plot((-Mlag:Mlag),auto_cx);
title('Autocovariance of x');
% Estimate the biased cross-covariance of random processes x and y
cross_cxy=xcov(x,y,Mlag,'biased');
subplot(224);
plot((-Mlag:Mlag),cross_cxy);
title('Cross-Covariance of x and y');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -