Mercurial > matrix-functions
comparison toolbox/smoke.m @ 2:c124219d7bfa draft
Re-add the 1995 toolbox after noticing the statement in the ~higham/mctoolbox/ webpage.
author | Antonio Pino Robles <data.script93@gmail.com> |
---|---|
date | Thu, 07 May 2015 18:36:24 +0200 |
parents | 8f23314345f4 |
children |
comparison
equal
deleted
inserted
replaced
1:e471a92d17be | 2:c124219d7bfa |
---|---|
1 function A = smoke(n, k) | |
2 %SMOKE Smoke matrix - complex, with a `smoke ring' pseudospectrum. | |
3 % SMOKE(N) is an N-by-N matrix with 1s on the | |
4 % superdiagonal, 1 in the (N,1) position, and powers of | |
5 % roots of unity along the diagonal. | |
6 % SMOKE(N, 1) is the same except for a zero (N,1) element. | |
7 % The eigenvalues of SMOKE(N, 1) are the N'th roots of unity; | |
8 % those of SMOKE(N) are the N'th roots of unity times 2^(1/N). | |
9 % | |
10 % Try PS(SMOKE(32)). For SMOKE(N, 1) the pseudospectrum looks | |
11 % like a sausage folded back on itself. | |
12 % GERSH(SMOKE(N, 1)) is interesting. | |
13 | |
14 % Reference: | |
15 % L. Reichel and L.N. Trefethen, Eigenvalues and pseudo-eigenvalues of | |
16 % Toeplitz matrices, Linear Algebra and Appl., 162-164:153-185, 1992. | |
17 | |
18 if nargin < 2, k = 0; end | |
19 | |
20 w = exp(2*pi*i/n); | |
21 A = diag( [w.^(1:n-1) 1] ) + diag(ones(n-1,1),1); | |
22 if k == 0, A(n,1) = 1; end |