# Discrete-Fourier-Transform

Document Sample

```					                 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 i2 pt +  (t) (2)

with a non rational frequency p, i.e.

n      n 1                                          n 
 p      ,                             p                              (3)
N       N                                            N N

If we take the DFT of u(t) we get
Ae                    
N 1
  t 
1
u ( m) 
ˆ
N
e
l 0
i 2ml / N          i 2pt
(4)

we want to study the DFT of the oscillating part

A N 1 i 2ml / N i 2 ( n  )l / N A N 1 i 2 ( n  m )l / N
u (m; p) 
ˆ                e
N l 0
e                   e
N l 0

l
i 2 ( n   m )     N
A 1 e                                    N
1  e i 2
                                A
N       i 2 ( n   m )
l
         i 2 ( n   m ) 
l
1 e                   N
N 1  e

N 

                            
When m  n we can put


l
i 2 ( n   m )      i 2
e                    N
 e N  1  i 2
N
and we get

i 2
1 e                      N
u n ; p   A
ˆ                                                            (5)
i 2

while when         mn

1
u n ; p   O  .
ˆ
N

Ex: compute u n ; p  when  = ½ ,  = ¼ ,
ˆ

Hint : use
1  e i  1  cos   i sin 
and
1
cos  1   2                            sin   
2
when  is small.

Conclusion: the presence of ei2pt in u(t) produces a rising of the amplitude of the DFT around
n
m  n , i.e. around the frequency f = .
N

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

 
 n  N 0, 2


 
;         (7)
ˆ ˆ
 E  n m   2 nm


Then we have
        1 N 1
 k   n e i 2kn / N
ˆ
       N n 0

 E ˆk   0
                                                     ;         (8)

 E j k      e i 2 ( k  j ) n / N     kj
2 N 1                        2


               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

Sk  0 , k  b ,
i.e. we assume that Sn can be represented as

b 1                                N
Sn      S e
k   b 1
k
i 2kn / N
, b 
2
(9)


although we don’t know exactly whether we have all Sk  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

yk  S k  k , k = - M,…0,…M (10)
ˆ          ˆ

Since we know for sure that S k = 0 when |k| > b , we can use as an estimator of 2/N the
expression
  2 
ˆ          1       M         2 ( M b )
2

 N   2M  b    k  2M  b  (11)

2
                   ˆ
       stim      k b  M
Recalling that
 
E n  n
2
,

we can conclude that (11) is indeed an unbiased estimator of 2/N, due to (8) and the hypotheses
(7)
N
Whenever M         b , as we assume, we can even claim that the estimator (11) has a negligible
2
variance, because  2  n   2n and then  2  n / n   2 / n .
2                        2

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
H0 : S j = 0 | j |  N                     ,

which can be tested by the ratio
1 2                          1 2
j
ˆ                             ( 2)
2                  2 2                      F2, 2 ( M b )   (12)
1        M
 2 ( M b ) / 2M  b 
 ˆk
2

2M  b  k b1

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
ˆ        N           j L
 
and consider all the other Fourier coefficients as pure noise, as shown in Fig.1.
2
ˆ
yk

 2 
ˆ
2   v  F
N 
 

  v2 
ˆ
 N 
      
      

L                        b                                          M   K

Fig.1: signal and noise spectrum with critical value to determine the maximum frequency L below
which there is signal; notice that only positive frequencies are used because yk  yk
2     2
ˆ     ˆ

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
L
Sn    y e
ˆ
k  L
k
i 2kn / 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
y k 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

L                                L
1                                1
Fl 
N
  L,k e i 2kl / N 
k  L                       N
e
k  L
i 2kl / N


                   l           
            sin 2                                                  (15)
1
 cos2
Ll
          N sin 2 Ll 
l         
N      N                      N
1  cos2
                     N         
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)
n  
;       (18)

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

-b                                   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 
m L
v ( m)      K (m  n)u (n)
nm L
(20)

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 N–1–L ,              (21)

i.e. the values
m L
v(m)          K (m  n)u (n)
nm L
(22)

do coincide with (19) when m satisfies (20).
0                LΔ                      ≤mΔ≤                 (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)

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

Let us now compute
m L
~
v (m)       K (m  n)u (n)
nm L
~             .     (23)

Then we have
~
v (m)  v(m)              L  m  N 1  L
~                                                             (24)
v (m)  v(m)              0  m  L ; N 1  L  m  N 1

~
in other words v (m) 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)         ;       (25)
~
~  v (m)
vm
indeed when K() is a symmetric function then basically H is the same as K , otherwise (25)
helps in visualizing (23) which now writes

m L
~
vm           H
nm L
nm
~
un           .         (26)

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

1                      m L
~
vm       H nm u n    H nm u n 
nm L
~               ~
n 0
;          (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
                                   Ln0
~                                                        (28)
H n  H n
                                   0n L

and we notice, also inspecting Fig.5,

Hn                                                       ~
Hn

-L                                         L                        N-L                    N

Fig.5 : the periodized H n

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

m L                         N 1
~
vm    H
n 0
nm n
~
u            H
n N  m L
nm n
~
u                (29)

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

N 1
~ ~
vm   H n  m u n 
~                                     .                 (30)
n 0

~
If, in analogy with (28), we define a periodized K n as
~    ~
Kn  H n                  (31)

we get the final formula

N 1
~ ~
vm   K m  n u n 
~                              (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.

~
un                     H nm                  un                    ~
H nm

m-L n-m 0    m                           N+m-L   N N+m                       n
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

1 N 1
hm        f nm g n
N n 0
(33)

m = 0, 1, … N-1

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

ˆ    ˆ ˆ
hk  f k gk    .        (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                         N 1
1                             1
ˆ
hk 
N
 ei 2km/ N
m 0                  N
f
n 0
mn   gn 
;          (35)
1   N 1
1         N 1


N
 N
n 0 
e
m 0
i 2k ( m  n ) / N
f mn e i 2kn / N g n


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

N 1                                              n  N 1
1                                                    1
N
 ei 2k ( mn) / N f mn 
m 0                                          N
e
mn
i 2km / N
fm 
N 1
1

N
e
m 0
i 2km / N        ˆ
fm  fm                        ,

so that (35) implies (34).

Corollary 1 : we can prove Parceval’s identity as a corollary of the convolution theorem

Proof: in fact take in (33) (34)

fn = g-n                     (36)

so that
N 1
1
ˆ
fk 
N
g
n 0
n
ˆ
e i 2kn / N  g k                   . (37)

Then we have

1 N 1
hm          g nm g n
N n 0
(38)

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

M                                    M
hm            e i 2km/ N hk 
ˆ
g               e i 2km / N
2
ˆ       k                                (39)
k  M                                 k  M

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

N 1                     M
1
h0                      gn              g
2                           2
ˆ        k                (40)
N    n 0                  k  M

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 k  ak  ibk                          ˆ
ak  Re f k                                    
ˆ
bk  Im  f k
g k  ck  id k
ˆ                               ck  Re g k
ˆ                            d k  Im g k 
ˆ
ˆ
hk  pk  iqk                            ˆ
pk  Re hk                                    
ˆ
qk  Im  hk

so that

M
                      kn 
N  2M  1           ,   f n  a0  2  ak cos 2
kn
 bk sin 2 
k 1         N             N

and similarly for the other functions, from (34) we have directly

pk  ak ck  bk d k                 qk  ak 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).
~                     ~
The answer is that we approximate v(t) with a periodic function v (t ) , with samples v m
computed as (cfr.(32))
T N 1 ~ ~
vm   K m  n u n
~
N n 0

so that
M                              M
ˆ ˆ
v t  
~ ~
~
 e i 2kt / T vk  T
k  M
ˆ
~
e
k  M
i 2kt / T
K k uk .     (42)

and in particular
M
ˆ ˆ
~ ~
~
vm  T     e
k  M
i 2km / T
K k uk             .     (43)

ˆ
~
We can observe that u k are exactly the DFT coefficients that we are able to compute from the
ˆ
~
sample (17) and K k can be computed as well from the analytic expression of K() after we put

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) .

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 85 posted: 3/2/2010 language: English pages: 10
Description: Discrete-Fourier-Transform