Engee documentation

poly2rc

Transformation of the prediction filter polynomial into reflection coefficients.

Library

EngeeDSP

Syntax

Function call

  • k,r0,errorFlag = poly2rc(a) — returns a vector k reflection coefficients of the lattice structure obtained from the vector a coefficients of the prediction filter.

  • k,r0,errorFlag = poly2rc(a,eFinal) — also returns autocorrelation with zero delay r0 based on the error of the final prediction eFinal, and the logical error flag errorFlag, possible when executing the function.

Arguments

Input arguments

# a — coefficients of the prediction filter

+ vector

Details

The coefficients of the prediction filter, set as a vector.

The value of the argument a It has the following limitations:

  • a[1] it can’t be equal to 0;

  • If a[1] not equal to 1, function poly2rc normalizes the prediction filter polynomial to a[1].

Типы данных

Float32, Float64

Support for complex numbers

Yes

# eFinal — the power of the final prediction error

+ 0 (default) | scalar

Details

The error power of the final prediction, given as a scalar.

Типы данных

Float32, Float64

Support for complex numbers

Yes

Output arguments

# k — reflection coefficients

+ vector

Details

The list of reflection coefficients returned as a column vector of length , where — the number of vector elements a.

# r0 — zero-delay autocorrelation

+ scalar

Details

Zero-delay autocorrelation, returned as a scalar.

# errorFlag — logical error flag

+ logical value

Details

A boolean error flag returned as a boolean value. This argument is used to indicate that an error or an incorrect situation occurred during the execution of the function.

  • errorFlag = false — no errors were found, the calculations were performed correctly.

  • errorFlag = true — an error occurred when executing the algorithm.

Examples

Determination of reflection coefficients by prediction filter polynomial

Details

Let’s say the prediction filter polynomial is given a and the error of the final prediction efinal, we determine the reflection coefficients of the corresponding lattice structure and the zero-delay autocorrelation.

import EngeeDSP.Functions: poly2rc

a = [1.0000 0.6149 0.9899 0.0000 0.0031 -0.0082]
efinal = 0.2
k, r0, errorFlag = poly2rc(a, efinal)

println("k = ", k, "\nr0 = ", r0)
k = [0.3090263579569403; 0.9800673984772592; 0.0031104252264590976; 0.008142727516998243; -0.0082;;]
r0 = 5.603228924655311

Limitations

If abs(k[i]) == 1 for anyone i Then finding the reflection coefficients is an ill-defined task. Function poly2rc returns some values NaN and issues a warning in such cases.

Recommendations

A simple and fast way to check if all the roots of a number lie a inside the unit circle, this is to check whether all the elements of the vector have k a value less than 1.

stable = all(abs.(poly2rc(a)) .< 1)

Algorithms

Function poly2rc implements the following recursive relation:



This relation is based on Levinson’s recursion [1]. To implement it, the function poly2rc the cycle runs along the vector a in reverse order after discarding its first element. For each iteration i Cycle function:

  1. Equates to k[i] to a[i].

  2. Applies the second ratio described above to elements with 1 by i vectors a.

    a = (a - k[i] * reverse(a)) / (1 - k[i]^2)

Literature

  1. Kay, Steven M. Modern Spectral Estimation. Englewood Cliffs, NJ: Prentice-Hall, 1988.