Engee documentation

corrmtx

A data matrix for estimating the autocorrelation matrix.

Library

EngeeDSP

Syntax

Function call

  • H,r = corrmtx(x,m) — returns a rectangular Greenhouse matrix H size (n+m)×(m+1) such that HTH is an estimate of the shifted autocorrelation matrix for the input vector x. Meaning n — length of the vector x, m — the order of the forecasting model, and HT — conjugate transposition H.

    It also returns an estimate of the autocorrelation matrix. r size (m+1)×(m+1), calculated as HTH.

  • H,r = corrmtx(x,m,method) — calculates the matrix H according to the method specified in the argument method.

Arguments

Input arguments

# x — input data

+ vector

Details

Input data set as a vector.

# m is the order of the prediction model

+ a positive real integer

Details

The order of the prediction model, given as a positive real integer.

# method — matrix calculation method

+ "autocorrelation" (by default) | "prewindowed" | "postwindowed" | "covariance" | "modified"

Details

The matrix calculation method specified by one of the following values:

  • "autocorrelation" (by default)

    H — this is a rectangular matrix Greenhouse in size (n+m)×(m+1), which generates an autocorrelation estimate for the data vector x length n obtained using data before and after windowing based on a forecasting model m- th order. The matrix can be used to estimate the parameters of an autoregressive model using the Yule method. — Walker.

  • "prewindowed"

    H — this is a rectangular matrix Greenhouse in size n×(m+1), which generates an autocorrelation estimate for the data vector x length n obtained using pre-windowing data based on a forecasting model m- th order.

  • "postwindowed"

    H — this is a rectangular matrix of Greenhouse size n×(m+1), which generates an autocorrelation estimate for the data vector x length n obtained using data after windowing based on a forecasting model m- th order.

  • "covariance"

    H — this is a rectangular matrix Greenhouse in size (n−m)×(m+1), which generates an autocorrelation estimate for the data vector x length n obtained using non-window data based on a forecasting model m- th order. The matrix can be used to perform autoregressive parameter estimation using the covariance method.

  • "modified"

    H — this is a modified rectangular matrix Greenhouse size 2(n−m)×(m+1), which generates an autocorrelation estimate for the data vector x length n obtained using forward and backward prediction error estimates based on the prediction model m- th order. The matrix can be used to perform autoregressive parameter estimation using a modified covariance method.

Output arguments

# H is the data matrix

+ the matrix

Details

The data matrix returned to determine the autocorrelation matrix. Size H depends on the matrix calculation method specified in the argument method.

# r is a biased autocorrelation matrix

+ the matrix

Details

The offset autocorrelation matrix returned as a rectangular Greenhouse matrix of size (m+1)×(m+1).

Examples

Modified data and autocorrelation matrices

Details

We will generate a signal consisting of three complex exponential functions, to which white Gaussian noise is added. Let’s calculate the data matrices and autocorrelations using a modified method.

import EngeeDSP.Functions: corrmtx, randn

n = 0:99
s = exp.(im * pi/2 .* n)' + 2 .* exp.(im * pi/4 .* n)' + exp.(im * pi/3 .* n)' + randn(1, 100)
m = 12
X,R = corrmtx(s,m,"modified")

Let’s plot the real and imaginary parts of the autocorrelation matrix.

A = repeat(1:m+1, 1, m+1)
B = repeat((1:m+1)', m+1, 1)
p1 = plot(A, B, real(R), st=:surface, title="Re(R)")
p2 = plot(A, B, imag(R), st=:surface, title="Im(R)")
plot(p1, p2, layout=(2,1))

corrmtx 1

Algorithms

The Greenhouse data matrix calculated using the function corrmtx, depends on the chosen method. The matrix determined by the autocorrelation method (by default) has the form:

In the matrix — the value of the input argument m, and — length of the input vector x. Variations of this matrix are used for the output argument H for each method:

  • "autocorrelation" (by default) — H .

  • "prewindowed"H the submatrix size , the first line of which is — , and the last line — .

  • "postwindowed"H the submatrix size , the first line of which is — , and the last line — .

  • "covariance"H the submatrix size , the first line of which is — , and the last line — multiplied by .

  • "covariance"H the matrix size , defined as follows:

Literature

  1. Marple S. Lawrence, Digital Spectral Analysis: With Applications, Prentice-Hall Signal Processing Series, Englewood Cliffs, N.J: Prentice-Hall, 1987.