A contradiction between built-in functions lpc and filter
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am using built-in function * lpc* to return the coefficients of a forward linear predictor by minimizing the predictor error; for example:
x = [1,2,4,8]
[a, e] = lpc(x,1)
% print results
a = 1.000000 -0.4941176
e = 16.0617
I thought it should have output `a=1.00, -2`, because I was using a 1-order linear predictor, it was easy to estimate that x(t) = 2*x(t-1).
Something might be wrong because of my superficial understanding. Then I read the `lpc.m` source code, and its comment says:
% Xp(n) = -A(2)*X(n-1) - A(3)*X(n-2) - ... - A(N+1)*X(n-N)
So, a(2) should be -2;
Then I went on reading lpc help document and its example codes, such as:
noise = randn(50000,1);
x = filter(1,[1 1/2 1/3 1/4],noise);
x = x(45904:50000);
a = lpc(x,3)
it printed the result of a with [1.000000000000000 0.488260222978665 0.337341624006294 0.255574741469446] it was exactly equal to the coefficients in filter function.
However, I read the source code of filter.m, it was using another AR model:
% a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)
% - a(2)*y(n-1) - ... - a(na+1)*y(n-na)
but lpc's output result agreed with filter's, how could that happen?
Is there something wrong with me or built-in functions? You known, I need your help. Thanks a lot.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Signal Modeling finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!