blob: 19eed2ae193eeb6e1479bffccdd4b24996db0c48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
function [a, efinal] = rc2poly(kr, R0)
//rc2poly function convert reflection coefficients to prediction polynomial.
// Calling Sequence
// a = rc2poly(kr)
// [a, efinal] = rc2poly(kr,R0)
// Parameters
// kr: Refelection coefficient.
// R0: the zero lag autocorrelation, R0.
// a: Return the prediction polynomial.
// efinal: Return the final prediction error.
// Examples
//X = [7 6 5 8 3 6]
// [a, efinal] = rc2poly(X)
//
// See also
//
// Author
// Jitendra Singh
//
if or(type(kr)==10) then
error ('Input arguments must be double.')
end
if (size(kr,1) > 1) & (size(kr,2) > 1)
error ('The reflection coefficients must be stored in a vector.')
end
kr=kr(:);
if argn(2)<2 & argn(1)==2 then
error ('Zero lag autocorrelation, R0, not specified.')
end
if argn(2)<2 then
e=0;
else
e=R0;
end
ee(1) = e.*(1-kr(1)'.*kr(1));
a=kr(1);
for i=2:length(kr)
a = [a + a(i-1:-1:1)*kr(i) kr(i)]
ee=ee.*(1-kr(i)'.*kr(i));
end
a=[1 a];
efinal=ee;
endfunction
|