Mercurial > matrix-functions
comparison toolbox/seqcheb.m @ 0:8f23314345f4 draft
Create local repository for matrix toolboxes. Step #0 done.
author | Antonio Pino Robles <data.script93@gmail.com> |
---|---|
date | Wed, 06 May 2015 14:56:53 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8f23314345f4 |
---|---|
1 function x = seqcheb(n, k) | |
2 %SEQCHEB Sequence of points related to Chebyshev polynomials. | |
3 % X = SEQCHEB(N, K) produces a row vector of length N. | |
4 % There are two choices: | |
5 % K = 1: zeros of T_N, (the default) | |
6 % K = 2: extrema of T_{N-1}, | |
7 % where T_k is the Chebsyhev polynomial of degree k. | |
8 | |
9 if nargin == 1, k = 1; end | |
10 | |
11 if k == 1 % Zeros of T_n | |
12 i = 1:n; j = .5*ones(1,n); | |
13 x = cos( (i-j) * (pi/n) ); | |
14 elseif k == 2 % Extrema of T_(n-1) | |
15 i = 0:n-1; | |
16 x = cos( i * (pi/(n-1)) ); | |
17 end |