From 6e1e4362783f68a8e8be1d199337c1ca831a2994 Mon Sep 17 00:00:00 2001 From: Brijeshcr Date: Fri, 10 Nov 2017 15:08:11 +0530 Subject: Brijesh functions --- macros/cheb.sci | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 macros/cheb.sci (limited to 'macros/cheb.sci') 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 -- cgit