poly2rc
Transformation of the prediction filter polynomial into reflection coefficients.
| Library |
|
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
|
| Типы данных |
|
| 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.
| Типы данных |
|
| Support for complex numbers |
Yes |
Output arguments
# 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:
-
Equates to
k[i]toa[i]. -
Applies the second ratio described above to elements with
1byivectorsa.a = (a - k[i] * reverse(a)) / (1 - k[i]^2)