0% found this document useful (0 votes)
18 views2 pages

Worksheet 3

Uploaded by

Selen Çiğdem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Worksheet 3

Uploaded by

Selen Çiğdem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Technische Universität München SS 2024

School of CIT, Department of Computer Science Worksheet 3


Univ.-Prof. Dr. M. Bader 03.05.2024
M.Sc. K. Gaddameedi
M.Sc. M. Wille

Algorithms for Scientific Computing


Discrete Cosine Transform
Exercise 1: Fourier Series
Compute the Fourier coefficients for the following three periodic functions. What is their Fourier
series?

The Fourier coefficients of a P-periodic function are given as


Z P
1 2πkx
ck = f (x)e−i P dx.
P 0

−π π x x
0 2π −π 0 π 2π
−1

a) Repeating Dirac delta. b) Odd square wave.


y

x
−π 0 π 2π

c) Repeating ramp.

1
Exercise 2: DFT and Least Square Approximation
For a given N ∈ N and A ∈ R, let ∆x = A/N .
∀n, 0 ≤ n < N , xn = n∆x and fn ∈ C form the data pair (xn , fn ). Note that the xn are the equally
spaced point of the interval [0, A − ∆x].
We want to find an approximation to the data using the N -trigonometric polynomial φN , given by
N−1
φN (x) = ∑ αk ei2πkx/A , (1)
k=0

the function φN is called a trigonometric polynomial because it is a polynomial in the quantity ei2πx/A .
The approximation should fit the least square criterion, where we minimize the discrete least squa-
res error E defined as
N−1
E= ∑ | fn − φN (xn )|2 (2)
n=0

Find the N coefficients α0 , . . . , αN−1 . Do you know an algorithm to compute them efficiently ?
Hint: use the expression for the partial derivative of the error E :
" !#
N−1 N−1
∂E
= ∑ e−i2πnk/N fn − ∑ α p ei2πnp/N , (3)
∂ αk n=0 p=0

and set these derivatives to 0.

Exercise 3: Discrete Cosine Transform


We start with a dataset ( f−N+1 , . . . , fN ) ∈ R2N , which fulfils the following symmetry constraint:
f−n = fn for n = 1, . . . , N − 1
a) Show that the corresponding Fourier coefficients
N
1 −kn
Fk = ∑ fn ω2N (4)
2N n=−N+1
are real values only and can be written as:

!
N−1  
1 1 πnk 1
Fk = f0 + ∑ fn cos + fN cos(πk) . (5)
N 2 n=1 N 2

b) Show that the Fk is symmetric too.

c) Let FFT(f,N) be a procedure that computes the coefficients Fk efficiently (according to equa-
tion (4)) from a field f which consists of 2N values fn . (The result is written back to field f)
Write a short procedure DCT(g,N) which uses procedure FFT to compute the coefficients
Fk for k = 0, . . . , N from equation (5) for the (non-symmetrical) data f0 , . . . , fN , stored in the
parameter field g.

You might also like