summaryrefslogtreecommitdiff
path: root/macros/rc2ac.sci
blob: 7d59af52ad6da0c1f1d2e218e331585eb54dc07b (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
function R=rc2ac(k, R0)

//rlevinson function convert reflection coefficients to autocorrelation sequence.
// Calling Sequence
// a = rc2ac(k, R0)

// Parameters
// k: input argument reflection coefficients.
// R0: input argument zero lag autocorrelation
// R: return  autocorrelation sequence.

// Examples
//X = [7 6 5 8 3 6]
// R = rc2ac(X, 0.3)

// See also
//
// Author
// Jitendra Singh
//             
          
 // load rc2poly and rlevinson before running this function         
 
       if or(type(k)==10) then
    error ('Input arguments must be double.')
end 
     
 if (size(k,1) > 1) & (size(k,2) > 1)
    error ('The reflection coefficients must be stored in a vector.')
end
     
    
     if argn(2)<2 then // checking of number of input arguments, if argn(2)<2 execute error.
              error ('Not enough input argument, define zero lag autocorrelation, R0.')
    end 
    if or(k(2:$)==1) then
        error('Algorithm failed for this case. At least one of the reflection coefficients is equal to one.')
    end
  
    [a, efinal]=rc2poly (k, R0);
    R=rlevinson(a, efinal)    
          
          
endfunction