📄 5-4.m
字号:
%例程5-4 计算随机信号的自协方差函数与互协方差函数
% 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 + -