Sie sind auf Seite 1von 10

Discrete Fourier Transform- Applications

Application 1 : Detecting periodic signals


Assume you have a long series of data
u(t)

t= 0 ,1,., N

(1)

containing an oscillating function


u(t) = A e i2pt + (t) (2)
with a non rational frequency p, i.e.
n
n 1
p
,
N
N

N N

(3)

If we take the DFT of u(t) we get


u (m)

N 1

1
N

i 2ml / N

l 0

Ae

i 2pt

(4)

we want to study the DFT of the oscillating part


u ( m; p )

A
N

N 1

i 2ml / N

e i 2 ( n ) l / N

l 0

i 2 ( n m )

N
A 1 e

l
i 2 ( n m )
N
N
1 e

When m n we can put


e

i 2 ( n m )

l
N

A
N

N 1

e
l 0

1 e i 2
l
i 2 ( n m )

N
N 1 e

i 2

1 i 2

and we get
u n ; p A

while when

i 2

1 e
i 2

(5)

mn

u n ; p O

1
.
N

Ex: compute u n ; p when = , = ,


Hint : use

1 e i 1 cos i sin

and
when is small.

1
cos 1 2
2

sin

i 2 ( n m ) l / N

Conclusion: the presence of ei2pt in u(t) produces a rising of the amplitude of the DFT around
n
.
N

m n , i.e. around the frequency f =

Application 2 : Filtering a bounded signal


Assume we have sample data

y0n = Sn + n , n = 0 , ....N-1
(6)
where Sn is a deterministic signal and n a noise ; to fix the ideas we assume {n} to be a white
noise with a normal distribution

E
n N 0,2
n m

2
nm

(7)

Then we have

1 N 1 i 2kn / N
k n e
N n 0

Ek 0

(8)

2 N 1
2

i
2

(
k

j
)
n
/
N

E j k e
kj

N 2 n 0
N

In addition we assume to know that the signal {Sn} has a spectrum contained into a certain band of
frequencies.
For instance we assume

S 0 , k b ,
i.e. we assume that Sn can be represented as
k

Sn

b 1

S e

k b 1

i 2kn / N

, b

N
2

(9)

although we dont know exactly whether we have all S k 0 when k b.


This problem has already been analysed and solved by testing theory, after a solution via least
squares of the model (6), (9).
Here we go back to the same problem and give a simple solution to it, directly in the frequency
domain, i.e. by representing (6) in terms
of DFT

y k S k k , k = - M,0,M
(10)
Since we know for sure that
expression

Sk

= 0 when |k| > b , we can use as an estimator of 2/N the

stim

Recalling that

1
2 M b

k b M

E n2 n

22( M b )
(11)
2 M b

we can conclude that (11) is indeed an unbiased estimator of 2/N, due to (8) and the hypotheses
(7)
Whenever M

N
b , as we assume, we can even claim that the estimator (11) has a negligible
2

2
2
2
2
variance, because n 2n and then n / n 2 / n .

Even if this is not the case, we can proceed as follows.


Since
2
2
j (22 ) ,
N
even for | j | b we can always consider the hypothesis
H 0 : Sj = 0
|j| N
which can be tested by the ratio
2
1
j
2
M
1
k
2 M b k b 1

1 2
( 2)
2 2
F2, 2 ( M b )
2 ( M b ) / 2 M b

(12)

This implies that if F is the critical value of the F2,2(M-b) variable, with significance , then all y j
such that
2
2
y j 2 F
N
can be considered as pure noise, or at least we cannot refuse the simple hypothesis that they are
noise.
Accordingly we can determine a threshold L b such that
2
2
y j 2 F
j L
N
and consider all the other Fourier coefficients as pure noise, as shown in Fig.1.

y k

v2
F
N

v2

N
L

Fig.1: signal and noise spectrum with critical value to determine the maximum frequency L below
2
2
which there is signal; notice that only positive frequencies are used because y k y k
Therefore a filter adapted to Fig.1 would be obtained by setting to zero all the coefficients above
| j | >L , i.e. the filtered signal is
Sn

y e

k L

i 2kn / N

(13)

It is also interesting to observe that since (41) can be considered as the anti-DFT of the product of

yk k L

yk 1,k

0 k L

then we can claim, thanks to the convolution theorem, that the same estimator (13) can be
expressed as
N 1

S m Fm n y n

(14)

n 0

where

1
N

Fl
1

k L

L ,k

e i 2kl / N

1
N

i 2kl / N

k L

sin 2

Ll
Ll
N sin 2

cos 2

l
N
N

1 cos 2
N

(15)

Application 3 : Computing a convolution


We have a function u(t) defined on R1 and a kernel K(t-t) and we want to compute the so called
integral convolution
v (t )

K (t t ' )u (t ' ) dt '

(16)

but all what we know is a sample of u(t)


u(0), u(), u(2)..u((N-1)) .

(17)

First put T = N and approximate (16) as


v (t )

K (t n)u (n)

(18)

if K() is a function going to zero fast enough

-b

Fig.2 an example of symmetric kernel K()


so that we can assume

K() 0 , | | > b = L , L << N ,

(19)

then (18) can be written in t = m


v ( m)

m L

K (m n)u (n)

(20)

n m L

It is obvious that if L<<N we can compute (20) with the values of u(t) that we have, for every m
such that
L m N1L ,
(21)
i.e. the values
v(m)

m L

K (m n) u (n)

nm L

do coincide with (19) when m satisfies (20).

(22)

(N-1-L)

N =T

Fig.3 : the support of K() is contained in [0,T] when


moving the center of K() between L and T - (L+1)
Now take a periodic repetition of u(t) as in Fig.4; the periodization of u(t), (n), will coincide
with u(t) for (0 k N-1, t=k) , but it will be different from u(t) when k < 0 and k N.

u(t)
u(t) = u(0)

Fig.4 : periodization and sampling of u(t)


Let us now compute
m L

K (m n) u~ (n)

~ ( m )
v

(23)

n m L

Then we have

v~(m) v(m)
~
v (m) v(m)

L m N 1 L
0 m L ; N 1 L m N 1

(24)

~ ( m )
in other words v
coincides with v(m) apart from a border of width L.
This is the so called border effect.

In order to better understand formula (23) let us agree to put


H n K ( n ) K n
~ u
~ ( n)
u
n

~ v
~ ( m )
v
m

(25)

indeed when K() is a symmetric function then basically H is the same as K , otherwise (25)
helps in visualizing (23) which now writes
~
v
m

m L

n m L

n m

~
u
n

(26)

Let us take a value m < L and split (26) into two pieces
~
v
m

m L

n m L

n 0

H nm u~n H nm u~n

(27)

since is by definition periodical, we have


n = N+n

-L n < 0 .

Likewise we define a periodized H ,

~
H n H n N
~
H n H n

Ln0
0nL

(28)

and we notice, also inspecting Fig.5,

~
Hn

Hn

-L

L
N-L
Fig.5 : the periodized Hn

that, if L < N L , 2L < N , then there is no overlapping of Hn with its replica and in the interval
between L and N L , Hn is equal to zero because of the hypothesis (19).
With such definitions, (27) can be written as
~
v
m

m L

H nmu~n
n 0

N 1

n N m L

nm

~
u
n

(29)

and, because of the above remark, we arrive at (cfr.Fig.6)


N 1
~
~
v
H nm u~n
m
n 0

(30)

If, in analogy with (28), we define a periodized K n as


~
~
K n H n

(31)

we get the final formula


N 1
~
~
v
K mn u~n
m

(32)

n 0

which can be interpreted as wrapping up equation (18) on the circle, because of the periodization of
Kn and un.
~
As we said, when (19) holds true, (32) yields v
m values which practically coincide with vm in the
central interval L < m < N L.

u~n

H nm

m-L n-m 0

~
H nm

un

N+m-L N N+m
N+n-m

Fig.6 : the wrapped convolution


Equation (32) constitutes the so called discrete convolution for periodic functions; for such an
operation a fundamental theorem in DFT theory holds.
Theorem 1 (convolution theorem):
Let fn, gn, (n=0,1,., N-1) be two regular samples of periodic functions, on the interval [0,1], and
let
hm

1 N 1
f nm g n
N n 0
m = 0, 1, N-1

(33)

be its discrete convolution product ; then the corresponding coefficients of the DFT, fk , g k , hk
satisfy the simple relation
hk fk g k

(34)

Proof: we prove (34) for the complex DFT coefficients, assuming, for the sake of simplicity, that
N = 2 M + 1.

In fact we have
N 1

1
hk
N
1

i 2km / N

m 0

n 0 N
N 1

N 1

N 1

1
N

f
n 0

mn

gn
;

i 2k ( m n ) / N

f m n e

m0

i 2kn / N

(35)

gn

Now observing that ei2k(m-n)/N and fm-n are both periodic of period N in the index m , we have
N 1

1
N

1
N

i 2k ( m n ) / N

m 0

N 1

i 2km / N

m 0

f m n

1
N

n N 1

i 2km / N

m n

f m fm

fm

so that (35) implies (34).


Corollary 1 : we can prove Parcevals identity as a corollary of the convolution theorem
Proof: in fact take in (33) (34)
fn = g-n

(36)

so that
1
fk
N

N 1

g
n 0

e i 2kn / N g k

. (37)

Then we have
1
hm
N

N 1

g
n 0

nm

gn

(38)

and on the same time (recalling (34) and (37) )


hm

e i 2km / N hk

k M

k M

2
k

e i 2km / N

(39)

By taking m = 0 in (38) (39) we conclude that


h0

1
N

N 1

n 0

gn

k M

2
k

(40)

i.e. Perceval identity.


Corollary 2 : when f, g are real functions, as we have always assumed, we might be willing to
represent the convolution theorem in terms of real DFT and real coefficients.
If we put


f
a k ibk
k
k c k id k
g

h
p k iq k
k

ak
ck
pk

Re f
k
k
Re g

Re h

bk
dk
qk

Im f
k
k
Im g

Im h

so that

N 2M 1

M
kn
kn

f n a0 2 a k cos 2 bk sin 2
N
N
k 1

and similarly for the other functions, from (34) we have directly
pk a k ck bk d k

q k a k d k bk ck

(41).

To conclude we can go back to the original problem of computing (16) on the basis of the sample
(17).
~ (t )
~
The answer is that we approximate v(t) with a periodic function v
, with samples v
m
computed as (cfr.(32))
T N 1 ~ ~
v~m
K mn u n
N n 0
so that
~ t
v

e i 2kt / T v~k T

k M

i 2kt / T

k M

~
~
.
Kku
k

(42)

and in particular
~ T
v
m

i 2km / T

k M

~
~

Kku
k

(43)

~
are exactly the DFT coefficients that we are able to compute from the
We can observe that u
k

~
can be computed as well from the analytic expression of K() after we put
sample (17) and K
k
~
K (t ) K (t ) K (T t )

t 0, T

(44)

It has to be stressed that the idea of computing the convolution (16) through a DFT becomes
extremely fruitful when we take a sample of N = 2Q points because in this case we can use the so
called Fast Fourier Transform, which is an algorithm performing the DFT and its inverse in an
extremely short time, i.e. a time of the order of O(N logN) .

Das könnte Ihnen auch gefallen