Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
MATLAB-CODE Sine transform<br />
function s = sinetrans(y)<br />
n = length(y)+1;<br />
sinevals = imag(exp(i*pi/n).^(1:n-1));<br />
yt = [0 (sinevals.*(y+y(end:-1:1)) + 0.5*(y-y(end:-1:1)))];<br />
c = fftreal(yt);<br />
s(1) = dot(sinevals,y);<br />
for k=2:N-1<br />
if (mod(k,2) == 0), s(k) = -imag(c(k/2+1));<br />
else, s(k) = s(k-2) + real(c((k-1)/2+1)); end<br />
end<br />
⎛<br />
⎞<br />
C c y I 0 · · · · · · 0<br />
c y I C c y I .<br />
T =<br />
⎜ 0 . .. ... . ..<br />
⎟<br />
⎝ . c y I C c y I⎠ ∈ Rn2 ,n 2 ,<br />
0 · · · · · · 0 c y I C<br />
⎛<br />
⎞<br />
c c x 0 · · · · · · 0<br />
c x c c x .<br />
C =<br />
⎜ 0 . .. ... ...<br />
⎟<br />
⎝ . c x c c x ⎠ ∈ Rn,n .<br />
0 · · · · · · 0 c x c<br />
j<br />
n+1 n+2<br />
1 2 3<br />
c x<br />
c y<br />
c y<br />
c x<br />
i<br />
△<br />
Application:<br />
diagonalization of local translation invariant linear operators.<br />
5-points-stencil-operator on R n,n , n ∈ N, in grid representation:<br />
T : R n,n ↦→ R n,n ,<br />
X ↦→ T(X)<br />
(T(X)) ij := cx ij + c y x i,j+1 + c y x i,j−1 + c x x i+1,j + c x x i−1,j<br />
Ôº¼ º<br />
Sine basis of R n,n :<br />
B kl = ( sin( n+1 π ki) sin( π<br />
n+1 lj)) n<br />
i,j=1 . (7.4.2)<br />
n = 10: grid function B 2,3 ➣<br />
1<br />
0.5<br />
0<br />
−0.5<br />
−1<br />
1<br />
2<br />
3<br />
4<br />
10<br />
5<br />
9<br />
6<br />
8<br />
7<br />
7<br />
6<br />
5<br />
8<br />
4<br />
9<br />
3<br />
2<br />
10<br />
1<br />
Ôº½½ º<br />
with c,c y ,c x ∈ R, convention: x ij := 0 for (i,j) ∉ {1,...,n} 2 .<br />
X ∈ R n,n<br />
↕<br />
grid function ∈ {1, . ..,n} 2 ↦→ R<br />
25<br />
20<br />
15<br />
10<br />
5<br />
0<br />
1<br />
2<br />
3<br />
4<br />
5<br />
5<br />
4<br />
3<br />
2<br />
1<br />
(T(B kl )) ij = c sin( n πki) sin(π n lj) + c y sin( π n ki)( sin( n+1 π l(j − 1)) + sin( π<br />
n+1 l(j + 1))) +<br />
c x sin( n πlj)( sin( n+1 π k(i − 1)) + sin( π<br />
n+1k(i + 1)))<br />
= sin( π n ki) sin(π n lj)(c + 2c y cos( n+1 π l) + 2c x cos( n+1 π k))<br />
Hence B kl is eigenvector of T ↔ T corresponding to eigenvalue c + 2c y cos( n+1 π 2c x cos( n+1 π Algorithm for basis transform:<br />
X =<br />
n∑<br />
k=1 l=1<br />
n∑<br />
y kl B kl ⇒ x ij =<br />
n∑<br />
sin( n+1 π ki) ∑ n<br />
k=1 l=1<br />
y kl sin( π<br />
n+1 lj) .<br />
MATLAB-CODE two dimensional sine tr.<br />
Identification R n,n ∼ = R n2 , x ij ∼ ˜x (j−1)n+i gives matrix representation T ∈ R n2 ,n 2 of T :<br />
i<br />
Ôº½¼ º<br />
Hence nested sine transforms (→ Sect. 7.2.4)<br />
for rows/columns of Y = (y kl ) n k,l=1 .<br />
Here: implementation of sine transform (7.4.1)<br />
with “wrapping”-technique.<br />
function C = sinft2d(Y)<br />
[m,n] = size(Y);<br />
C = fft([zeros(1,n); Y;...<br />
zeros(1,n);...<br />
-Y(end:-1:1,:)]);<br />
C = i*C(2:m+1,:)’/2;<br />
C = fft([zeros(1,m); C;...<br />
zeros(1,m);...<br />
Ôº½¾ º<br />
-C(end:-1:1,:)]);<br />
C= i*C(2:n+1,:)’/2;