📄 covariog.m
字号:
function c=covariog(X,maxtau);
%COVARIOG Computes covariograms.
% c=covariog(x,maxtau) calculates the covariogram for each
% column of the T x n matrix X where
%
% c(tau,:)=cov( X(t,:), X(t-tau,:) ), tau=-maxtau,...,maxtau
%
% Thus, the ith column of c is the covariogram for the ith
% column of X, i=1,...n.
% Ellen R. McGrattan, 11-13-87
%
[T,n]=size(X);
if T-maxtau<=0;
str='The number of observations in the time series must be larger than tau';
error(str);
end;
for i=1:n;
for j=1:maxtau+1;
vcov=cov([X(j:T,i),X(1:T-j+1,i)]);
c(j,i)=vcov(2,1);
end;
end;
c=[c(maxtau+1:-1:2,:);c];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -