summaryrefslogtreecommitdiff
path: root/macros/rc2is.sci
blob: a41a79ec76d82e4443735f7eb4b8137fd3851bb4 (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
function isin = rc2is(k)
// Convert reflection coefficients to inverse sine parameters
// 
// Calling Sequence
// isin = rc2is(K) 
// 
// Parameters
// k: input reflection coefficients. Needs to be an array of real numbers between -1 and 1
// isin: inverse sine parameters corresponding to the reflection coefficients in input
//
// Description
// This function returns the inverse sine parameters corresponding to the input reflection coefficients K.
// output array has isin(i) = 2/pi*asin(k(i))
//
// Example
// k = [0.3090 0.9801 0.0031 0.0082 -0.0082];
// isin = rc2is(k)      //Gives inverse sine parameters
//
// See also 
// is2rc
// rc2poly
// rc2ac
// rc2lar
//
// Authors
// Parthe Pandit
//
// Bibliography
// J.R. Deller, J.G. Proakis, J.H.L. Hansen, "Discrete-Time Processing of Speech Signals", Prentice Hall, Section 7.4.5
//modified function to handle char i/p and also changed error statements to match those of MATLAB by Debdeep Dey
//convert char i/p to their respective ascii values
if(type(k)==10) then
    w=k;
    k=ascii(k);
    k=matrix(k,size(w));
end
// errchk1
if (~isreal(k)),
 error('Inverse sine parameters not defined for complex reflection coefficients.');
end           

if max(abs(k)) >= 1,
    error('All reflection coefficients should have magnitude less than unity.');
end

isin = (2/%pi)*asin(k);

endfunction