levinson : Levinson-Durbin recursion
Syntax
a = levinson(r)
a = levinson(r, n)
[a, e] = levinson(r, n)
[a, e, k] = levinson(r, n)
Description
The Levinson-Durbin recursion is an algorithm for finding an all-pole IIR filter with a prescribed deterministic autocorrelation sequence. It has applications in filter design, coding, and spectral estimation. The filter that levinson produces is minimum phase.
a = levinson(r) finds the coefficients of a length(r)-1 order autoregressive linear process which has r as its autocorrelation sequence. r is a real or complex deterministic autocorrelation sequence. If r is a matrix, levinson finds the coefficients for each column of r and returns them in the rows of a. n=length(r)-1 is the default order of the denominator polynomial A(z); that is, a = [1 a(2) ... a(n+1)]. The filter coefficients are ordered in descending powers of z–1.
H(z) = 1/A(z)
A(z) = 1 + a(2)z^(−1) + ⋯ + a(n+1)z^(−n)
a = levinson(r,n) returns the coefficients for an autoregressive model of order n.
[a,e] = levinson(r,n) returns the prediction error, e, of order n.
[a,e,k] = levinson(r,n) returns the reflection coefficients k as a column vector of length n.
Example
>> data = [2, 2, 0, 0, -1, -1, 0, 0, 1, 1];
>> [r, lg] = xcorr(data, 'biased');
>> r(lg<0) = []
r =
1.2000 0.6000 0.0000 -0.3000 -0.6000 -0.3000 -0.0000 0.2000 0.4000 0.2000
>> [ar, e] = levinson(r, 3)
ar =
1.0000 -0.6250 0.2500 0.1250
e =
0.7875
출처 : <https://kr.mathworks.com/help/signal/ref/levinson.html>
Python
lazy_lpc Module : Linear Predictive Coding (LPC) module
github for AudioLazy : <https://github.com/danilobellini/audiolazy>
AudioLazy 0.6 Docs : <http://pythonhosted.org/audiolazy/index.html>
Module contents
ParCorError Error when trying to find the partial correlation coefficients (reflection
coefficients) and there’s no way to find them.
toeplitz Find the toeplitz matrix as a list of lists given its first line/column.
levinson_durbin Solve the Yule-Walker linear system of equations.
lpc This is a StrategyDict instance object called lpc. Strategies stored: 5.
parcor Find the partial correlation coefficients (PARCOR), or reflection
coefficients, relative to the lattice implementation of a given LTI FIR
LinearFilter with a constant denominator (i.e., LPC analysis filter, or
any filter without feedback).
parcor_stable Tests whether the given filter is stable or not by using the partial
correlation coefficients (reflection coefficients) of the given filter.
Find the Line Spectral Frequencies (LSF) from a given FIR filter.
lsf_stable Tests whether the given filter is stable or not by using the Line
Spectral Frequencies (LSF) of the given filter. Needs NumPy.
levinson_durbin(acdata, order=None)
acdata – Autocorrelation lag list, commonly the acorr function output.
order – The order of the resulting ZFilter object. Defaults to len(acdata) - 1.
Example
>>> data = [2, 2, 0, 0, -1, -1, 0, 0, 1, 1]
>>> acdata = acorr(data)
>>> acdata
[12, 6, 0, -3, -6, -3, 0, 2, 4, 2]
>>> ldfilt = levinson_durbin(acorr(data), 3)
>>> ldfilt
1 - 0.625 * z^-1 + 0.25 * z^-2 + 0.125 * z^-3
>>> ldfilt.numerator
[1, - 0.625, 0.25, 0.125]
>>> ldfilt.error # Squared! See lpc for more information about this
7.875
출처 : <http://pythonhosted.org/audiolazy/lazy_lpc.html#audiolazy.lazy_lpc.levinson_durbin>
댓글 없음:
댓글 쓰기