# SpaceTimeCovMat

## PURPOSE [R,tau] = SpaceTimeCovMat(X,MaxLag);

## SYNOPSIS function [R,tau] = SpaceTimeCovMat(X,MaxLag);

## DESCRIPTION ```[R,tau] = SpaceTimeCovMat(X,MaxLag);

R=SpaceTimeCovMat(X,MaxLag) estimates the polynomial covariance matrix
R[tau] from M-channel data x[n] such that
R[tau] = E{ x[n] x^H[n-tau] }
Each of the M rows of X represents a time series, and each column
represents the M-element vector x[n] at a specific sample index n. The
time series are assumed to have zero mean such that R is a covariance
rather than a correlation matrix.

The evaluation of the covariance is restricted to lag values within the
interval [-Maxlag;+MaxLag]. The output can also be interpreted as a
polynomial or cross spectral density matrix
R(z) = R_{-MaxLag} z^MaxLag + ... + R_{-1} z + R0 +
+ Rz^{-1} + ... + R[MaxLag]z^{-MaxLag}
whereby the returned format is
R(:,:,1) = R_{-MagLag};
...
R(:,:,MaxLag) = R_{-1};
R(:,:,MaxLag+1) = R_{0};
R(:,:,MaxLag+2) = R_{1};
...
R(:,:,2*MaxLag+1) = R_{Maxlag}
The space-time covariance matrix is parahermitian, such that
R(:,:,1) = R(:,:,2*MaxLag+1)';
...
R(:,:,MaxLag) = R(:,:,MaxLag+2)';
holds.

[R,tau]=SpaceTimeCovMat(X,MaxLag) additionally returns the lag para-
meters tau=(-MaxLag:MaxLag), such that e.g. MIMODisplay(tau,R) can
display the various auto-and cross-correlation functions contained in R.

Input parameters:
X       M x L data matrix
MaxLag  maximum lag value calculated

Output parameter:
R       M x M x (2*MaxLag+1) polynomial covariance matrix
tau     2*MaxLag+1 index vector for lag values```

## CROSS-REFERENCE INFORMATION This function calls:
This function is called by:

## SOURCE CODE ```0001 function [R,tau] = SpaceTimeCovMat(X,MaxLag);
0002 %[R,tau] = SpaceTimeCovMat(X,MaxLag);
0003 %
0004 %   R=SpaceTimeCovMat(X,MaxLag) estimates the polynomial covariance matrix
0005 %   R[tau] from M-channel data x[n] such that
0006 %       R[tau] = E{ x[n] x^H[n-tau] }
0007 %   Each of the M rows of X represents a time series, and each column
0008 %   represents the M-element vector x[n] at a specific sample index n. The
0009 %   time series are assumed to have zero mean such that R is a covariance
0010 %   rather than a correlation matrix.
0011 %
0012 %   The evaluation of the covariance is restricted to lag values within the
0013 %   interval [-Maxlag;+MaxLag]. The output can also be interpreted as a
0014 %   polynomial or cross spectral density matrix
0015 %      R(z) = R_{-MaxLag} z^MaxLag + ... + R_{-1} z + R0 +
0016 %                  + Rz^{-1} + ... + R[MaxLag]z^{-MaxLag}
0017 %   whereby the returned format is
0018 %      R(:,:,1) = R_{-MagLag};
0019 %      ...
0020 %      R(:,:,MaxLag) = R_{-1};
0021 %      R(:,:,MaxLag+1) = R_{0};
0022 %      R(:,:,MaxLag+2) = R_{1};
0023 %      ...
0024 %      R(:,:,2*MaxLag+1) = R_{Maxlag}
0025 %   The space-time covariance matrix is parahermitian, such that
0026 %      R(:,:,1) = R(:,:,2*MaxLag+1)';
0027 %      ...
0028 %      R(:,:,MaxLag) = R(:,:,MaxLag+2)';
0029 %   holds.
0030 %
0031 %   [R,tau]=SpaceTimeCovMat(X,MaxLag) additionally returns the lag para-
0032 %   meters tau=(-MaxLag:MaxLag), such that e.g. MIMODisplay(tau,R) can
0033 %   display the various auto-and cross-correlation functions contained in R.
0034 %
0035 %   Input parameters:
0036 %      X       M x L data matrix
0037 %      MaxLag  maximum lag value calculated
0038 %
0039 %   Output parameter:
0040 %      R       M x M x (2*MaxLag+1) polynomial covariance matrix
0041 %      tau     2*MaxLag+1 index vector for lag values
0042
0043 % S Weiss, Univ of Strathclyde, 20/6/2006
0044
0045 % parameters and initialisation
0046 [M,L] = size(X);
0047 if MaxLag>=L,
0048    error('maximum lag cannot exceed length of data');
0049 end;
0050 R = zeros(M,M,2*MaxLag+1);
0051 Lm = L - 2*MaxLag;
0052
0053 % correlation
0054 Xref = X(:,MaxLag+1:MaxLag+Lm);     % fixed component
0055 for tau = 1:2*MaxLag+1,
0056   Xshift = X(:,tau:tau+Lm-1);       % delayed component
0057   R(:,:,2*MaxLag+2-tau) = Xref*Xshift'/Lm; % corr.
0058 end;
0059 tau = (-MaxLag:MaxLag);
0060
0061 % enforce parahermitian property
0062 R = (R + ParaHerm(R))/2;```

Generated on Wed 03-Dec-2014 19:38:11 by m2html © 2005