summaryrefslogtreecommitdiff
path: root/macros/cheb.sci
diff options
context:
space:
mode:
authorbgtushar2017-11-23 19:30:44 +0530
committerbgtushar2017-11-23 19:30:44 +0530
commite9ab4b0b52db51be30f4ac3d07673c20b48da13c (patch)
tree8f4ce37de0a028350125acfce71cfe686e79ef24 /macros/cheb.sci
parent14ccddd315f0b97a78e965df1587835ac542e35a (diff)
parentf66d58166a67d6bc89b2a674119410ddaee53d46 (diff)
downloadFOSSEE-Signal-Processing-Toolbox-e9ab4b0b52db51be30f4ac3d07673c20b48da13c.tar.gz
FOSSEE-Signal-Processing-Toolbox-e9ab4b0b52db51be30f4ac3d07673c20b48da13c.tar.bz2
FOSSEE-Signal-Processing-Toolbox-e9ab4b0b52db51be30f4ac3d07673c20b48da13c.zip
Merge
Diffstat (limited to 'macros/cheb.sci')
-rw-r--r--macros/cheb.sci34
1 files changed, 34 insertions, 0 deletions
diff --git a/macros/cheb.sci b/macros/cheb.sci
new file mode 100644
index 0000000..db2df85
--- /dev/null
+++ b/macros/cheb.sci
@@ -0,0 +1,34 @@
+function res = cheb (n, x)
+//Calculates the nth-order Chebyshev polynomial at the point x.
+//Calling Sequence
+//cheb(n, x)
+//Parameters
+//n: Filter order
+//x: Point at which the Chebyshev polynomial is calculater.
+//Description
+//This is an Octave function.
+//Equation for Chebyshev polynomial is
+// / cos(n acos(x), |x| <= 1
+// Tn(x) = |
+// \ cosh(n acosh(x), |x| > 1
+//
+//x can also be a vector. In that case the output will also be a vector of same size as x.
+//Examples
+//x = [1 2 3 4]
+// cheb(10, x)
+//ans =
+//
+// 1.0000e+00 2.6209e+05 2.2620e+07 4.5747e+08
+
+funcprot(0);
+rhs = argn(2)
+if (rhs < 2 | rhs > 2)
+error("Wrong number of input arguments.")
+end
+
+select(rhs)
+
+ case 2 then
+ res = callOctave("cheb",n,x)
+ end
+endfunction