summaryrefslogtreecommitdiff
path: root/macros/poly2lsf.sci
diff options
context:
space:
mode:
authorSunil Shetye2018-07-25 17:32:17 +0530
committerSunil Shetye2018-07-26 23:50:17 +0530
commitcdd55940b7a287810e423017c42e7c965815c468 (patch)
treed802563d2d507039354a3cf48e75465b7e7a8d76 /macros/poly2lsf.sci
parent1251f70aa3442736ce6fd9c4fb7fbce412af5a52 (diff)
downloadFOSSEE-Signal-Processing-Toolbox-cdd55940b7a287810e423017c42e7c965815c468.tar.gz
FOSSEE-Signal-Processing-Toolbox-cdd55940b7a287810e423017c42e7c965815c468.tar.bz2
FOSSEE-Signal-Processing-Toolbox-cdd55940b7a287810e423017c42e7c965815c468.zip
code changes by Shashikiran Yadalam during FOSSEE Fellowship 2018
Diffstat (limited to 'macros/poly2lsf.sci')
-rw-r--r--macros/poly2lsf.sci26
1 files changed, 15 insertions, 11 deletions
diff --git a/macros/poly2lsf.sci b/macros/poly2lsf.sci
index 69288f3..3140992 100644
--- a/macros/poly2lsf.sci
+++ b/macros/poly2lsf.sci
@@ -9,9 +9,13 @@ function lsf=poly2lsf(a)
// k: define the prediction polynomial.
// lsf: returns corresponding line spectral frequencies.
// Examples
-//X = [0.5 0.3 0.8 0.9 0.4 0.05];
+//
+//EXAMPLE
+//X=[1 0.6149 0.9899 0 0.0031 -0.0082]
// lsf = poly2lsf(X)
-// See also
+//EXPECTED OUTPUT:
+//lsf =0.7841731 1.5605415 1.8776459 1.8984313 2.3592523
+
//
// Author
// Jitendra Singh
@@ -59,17 +63,17 @@ if (p-fix(p./2).*2)~=0 then // Odd order
na = length(aa);
if na > n
P = 0;
-
+
else
P= filter(pp, aa, [1 zeros(1,n-na)]);
if m ~= 1
P = P(:);
end
end
-
+
Q = qq;
else // Even order
-
+
aa=[1 -1];
[m,n] = size(pp);
n = max(m,n);
@@ -77,29 +81,29 @@ else // Even order
(aa);
if na > n
P = 0;
-
+
else
P= filter(pp, aa, [1 zeros(1,n-na)]);
- if m ~= 1
+ if m ~= 1
P = P(:);
end
end
-
+
aa=[1 1];
[m,n] = size(qq);
n = max(m,n);
na = length(aa);
-
+
if na > n
Q = 0;
-
+
else
Q= filter(qq, aa, [1 zeros(1,n-na)]);
if m ~= 1
Q = Q(:);
end
end
-
+
end
r_p = roots(P); r_q = roots(Q);