# MATERNCOV is the jMatern module of jLab.

``` MATERNCOV  Autocovariance of the Matern random process and variations.

[TAU,R]=MATERNCOV(DT,N,SIGMA,ALPHA,LAMBDA) returns the autocovariance
function R of a length N complex-valued Matern random process having
variance SIGMA^2, slope parameter ALPHA, and damping parameter LAMBDA.

[TAU,R]=MATERNCOV(...,'real') instead forms the covariance of a real-
valued Matern process.

DT is the sample interval.  Note that LAMBDA is understood to have the
same units as the inverse sample interval 1/DT.

TAU is an array of time lags at which R is computed, and is given by
TAU=DT*[0,1,...,N-1].

By definition, R is one-sided theoretical autocovariance at
non-negative time lags.  See below for the relationship between this
and the full, length (2N-1) theoretical autocovariance function.

Note that for LAMBDA=0, the case of fractional Brownian motion, R will
contain only INFs because the autocovariance function is unbounded.

The input parameters SIGMA, ALPHA, and LAMBDA, may all either be
scalars or arrays of the same length M.  If the latter, then the output
autocovariance function R will be a matrix with N rows and M columns.

[TAU,R]=MATERNCOV(DT,N,SIGMA,ALPHA,LAMBDA,NU,MU) returns the
autocovariance function of various extensions of the Matern process.
MATERNOISE(...,'composite') also works.  See MATERNSPEC for details.

See MATERNSPEC for a more thorough discussion of the Matern process.

For details on the Matern process and its autocovariance function, see:

Lilly, Sykulski, Early, and Olhede, (2017).  Fractional Brownian
motion, the Matern process, and stochastic modeling of turbulent
dispersion.  Nonlinear Processes in Geophysics, 24: 481--514.
__________________________________________________________________

Relationship to full autocovariance

For a time series of length N, the full autocovariance function RF is
length 2N-1, defined at time lags -N+1,-N+2...,-1,0,1,...,N-2,N-1.

The one-sided autocovariance R contains the full autocovariance RF at
positive time lags. Negative lags are given by Hermitian symmetry.

[TAUF,RF]=MATERNCOV(...,'full') returns the full (two-sided)
autocovariance RF and the corresponding two-sided time array TAUF.

RF is constructed from R as RF=[FLIPUD(CONJ(R(2:end,:));R].
__________________________________________________________________

Real-valued processes

By default MATERNCOV returns the autocovariance of a complex-valued
process.

MATERNCOV(...,'real') instead returns the autocovariance of a real-
valued process. This also works with any of extended versions.
__________________________________________________________________

Computational notes

The autocovariances for the generalized and composite Matern spectra do
not have analytic forms. Rather, these are approximated to high
precision by inverse Fourier transforming the oversampled spectrum with
10 x oversampling over a 10 x longer time period, and then decimating.

MATERNCOV(...,'general',M,P) or  MATERNCOV(...,'composite',M,P)
specifies the numerical oversampling parameters in the calculation.

The spectrum is then computed over a time window of M times the
required  duration, and P times the required sampling density, for a
total of M*P time more points.  These values may set to optimize the

This computation method is expected to minimize aliasing effects and
resolution errors.
__________________________________________________________________