Engee documentation

arcov

The parameters of the autoregression model with all poles are the covariance method.

Library

EngeeDSP

Syntax

Function call

  • a,e = arcov(x,p) — returns normalized autoregression parameters (AR) a, corresponding order models p for the input array x, where x It is assumed to be the output of an AR system controlled by white noise. This method minimizes the error of direct prediction using the least squares method.

    It also returns the calculated variance. e input white noise.

Arguments

Input arguments

# x — input array

+ vector | the matrix

Details

An input array specified as a vector or matrix.

Типы данных

Float32, Float64

Support for complex numbers

Yes

# p — the order of the model

+ a positive integer scalar

Details

The order of the model, given as a positive integer scalar. Meaning p there should be less than the number of elements or rows in x.

Типы данных

Float32, Float64

Output arguments

# a — normalized autoregression parameters

+ vector string | the matrix

Details

Normalized autoregression parameters returned as a vector or matrix. If x — the matrix, then each row a corresponds to the column x. Argument a has p+1 column and contains autoregression parameters in descending order of degrees .

# e is the white noise variance of the input signal

+ scalar | vector string

Details

The white noise variance of the input signal, returned as a scalar or string vector. If x — the matrix, then for each element e corresponds to the column x.

Examples

Estimation of parameters using the covariance method

Details

We use the vector of coefficients of the polynomial to generate the autoregression process. 4-th order by filtering 1024 white noise samples. Reset the random number generator to get reproducible results. We use the covariance method to estimate the coefficients.

import EngeeDSP.Functions: randn,filter,arcov

A = [1 -2.7607 3.8106 -2.6535 0.9238]
y = filter(1,A,0.2*randn(1024,1))
arcoeffs = arcov(y,4)[1]
1×5 Matrix{Float64}:
 1.0  -2.77456  3.8419  -2.68565  0.936713

Generate 50 implementations of the process, changing the variance of the input noise each time. Let’s compare the variance calculated using covariance with the actual values.

nrealiz = 50
order = 4
noisestdz = rand(1, nrealiz) .+ 0.5
randnoise = randn(1024, nrealiz)
noisevar = zeros(1, nrealiz)

for k in 1:nrealiz
    y = filter(ones(1), A, noisestdz[k] * randnoise[:, k])
        arcoeffs,noisevar[k] = arcov(y, order)

end

p=scatter(vec(noisestdz.^2), vec(noisevar),
        marker=:x,
        markerstrokecolor=:blue,
        xlabel="Input",
        ylabel="Estimated",
        title="Noise Variance",
        label="Single channel loop",
        legend=false)

arcov 1

Let’s repeat the procedure using the multi-channel syntax of the function.

Y = filter(1,A,noisestdz.*randnoise)

coeffs,variances = arcov(Y,4)

scatter!(p,noisestdz.^2, variances,
        marker=:circle,
        markercolor=:transparent,
        markerstrokecolor=:green,
        markersize=10)

arcov 2

Additional Info

An autoregression model of the order of p

Details

In the autoregression model of the order ( ) the current output is a linear combination of the previous ones outputs plus a white noise input signal. Weights on previous ones The outputs minimize the average quadratic error of the autoregression prediction.

Let a stationary, broadly random process obtained by filtering the white noise of the variance using the system function . If — spectral power density , then

Since the covariance method characterizes the input data using a model with all poles, the correct choice of the model order is very important.