21.06.2014 Views

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Proof. Straightforward computation, see (7.2.4).<br />

✷<br />

Idea: (7.2.7) ➣ z = F −1 n diag(F n u)F n x<br />

Conclusion<br />

(from F n = nF −1 n ):<br />

C = F−1 n diag(d 1 , . ..,d n )F n . (7.2.7)<br />

Lemma 7.2.2, (7.2.7) ➣ multiplication with Fourier-matrix will be crucial operation in algorithms for<br />

circulant matrices and discrete convolutions.<br />

Therefore this operation has been given a special name:<br />

Code 7.2.6: discrete periodic convolution:<br />

straightforward implementation<br />

1 function z=pconv ( u , x )<br />

2 n = length ( x ) ; z = zeros ( n , 1 ) ;<br />

3 for i =1:n , z ( i ) =dot ( conj ( u ) ,<br />

x ( [ i : −1:1 ,n:−1: i + 1 ] ) ) ;<br />

4 end<br />

Code 7.2.8: discrete periodic convolution: DFT<br />

implementation<br />

1 function z= p c o n v f f t ( u , x )<br />

2 z = i f f t ( f f t ( u ) .∗ f f t ( x ) ) ;<br />

Definition 7.2.3 (Discrete Fourier transform (DFT)).<br />

The linear map F n : C n ↦→ C n , F n (y) := F n y, y ∈ C n , is called discrete Fourier transform<br />

(DFT), i.e. for c := F n (y)<br />

n−1 ∑<br />

c k =<br />

j=0<br />

y j<br />

Ôº º¾<br />

ωn kj , k = 0, ...,n − 1 . (7.2.8)<br />

Rem. 7.1.6:<br />

discrete convolution of n-vectors (→ Def. 7.1.1) by periodic discrete convolution of 2n−<br />

1-vectors (obtained by zero padding):<br />

Ôº º¾<br />

Recall the convention also relevant for the discussion of the DFT: vector indexes range from 0 to<br />

n − 1!<br />

Terminology: c = F n y is also called the (discrete) Fourier transform of y<br />

MATLAB-functions for discrete Fourier transform (and its inverse):<br />

Implementation of<br />

discrete convolution (→<br />

Def. 7.1.1) based on<br />

periodic discrete convolution ✄<br />

Built-in MATLAB-function:<br />

y = conv(h,x);<br />

Code 7.2.9: discrete convolutiuon: DFT implementation<br />

1 function y = myconv ( h , x )<br />

2 n = length ( h ) ;<br />

3 % Zero padding<br />

4 h = [ h ; zeros ( n−1,1) ] ; x =<br />

[ x ; zeros ( n−1,1) ] ;<br />

5 % Periodic discrete convolution of length 2n − 1<br />

6 y = p c o n v f f t ( h , x ) ;<br />

DFT: c=fft(y) ↔ inverse DFT: y=ifft(c);<br />

7.2.2 Frequency filtering via DFT<br />

7.2.1 Discrete convolution via DFT<br />

The trigonometric basis vectors, when interpreted as time-periodic signals, represent harmonic oscillations.<br />

This is illustrated when plotting some vectors of the trigonometric basis (n = 16):<br />

1<br />

Fourier−basis vector, n=16, j=1<br />

1<br />

Fourier−basis vector, n=16, j=7<br />

1<br />

Fourier−basis vector, n=16, j=15<br />

0.8<br />

0.8<br />

0.8<br />

multiplication with circulant matrix (→ Def. 7.1.3) z = Cx, C := ( ) n<br />

Ôº º¾<br />

u i−j i,j=1 .<br />

Recall discrete periodic convolution z k = n−1 ∑<br />

u k−j x j (→ Def. 7.1.2), k = 0, ...,n − 1<br />

j=0<br />

↕<br />

Value<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

−0.2<br />

−0.4<br />

−0.6<br />

Value<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

−0.2<br />

−0.4<br />

−0.6<br />

Value<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

−0.2<br />

−0.4<br />

−0.6<br />

Ôº º¾<br />

−0.8<br />

Real part<br />

Imaginary p.<br />

−0.8<br />

Real part<br />

Imaginary p.<br />

−0.8<br />

Real part<br />

Imaginary p.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!