blob: db2df85b2aa799aa0e33981ccf8104211b46c464 (
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
|
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
|