function cov = ma2covv(ma,Peps,ncov)

%function cov = ma2covv(ma,Peps,ncov)
%   Transforms Moving Average parameters MA into a covariancefunction cov
%   ncov is the number of covariances
%   For a zero-mean process, the covariance function has been defined as
%   R(s)(.) = E{X[n+s]<X[n],.>},
%   or, in old-fashioned notation:
%   R(s) = E{X[n+s]X[n]'} where X[n] is a column vector.

%S. de Waele, March 2003.


s = kingsize(ma);
order = s(3)-1;
dim = s(1); I = eye(dim);

if nargin <  3, ncov = order; end
Peps_mapl = timesv(Peps,transposeLTI(ma)); % = Peps*MA'
cov = convv(ma,Peps_mapl);                 % = MA*Peps*MA'
cov = cov(:,:,1+order:end);
%Create covariance function with proper length
if ncov>order
   cov = cat(3,cov,zeros(dim,dim,ncov-order));
end
if ncov<order
	cov = cov(:,:,1+order);   
end
Sable
github-repos/MATLAB/Sable-mcbench-benchmarks/mcbench-benchmarks-ba13b2f0296ef49491b95e3f984c7c41fccdb6d8/3680-automatic-spectral-analysis/AutomaticSpectra/Vectors/conversions/ma2covv.m
mcbench-benchmarks
github-repos/MATLAB/Sable-mcbench-benchmarks
ba13b2f0296ef49491b95e3f984c7c41fccdb6d8