Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic...

36
Fourier series of periodic discrete-time signals 1

Transcript of Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic...

Page 1: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Fourier series of periodic discrete-time signals

1

Page 2: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Discrete-time signal x(n):

Defined for integer time instants n:

{x(n)} = {. . . , x(−2), x(−1), x(0), x(1), x(2), . . .}

2

Page 3: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

In analogy with continuous-time signals, discrete-

time signals can be expanded in terms of sinusoidal

components of form Ak cos(ωkn + φk)

−2 0 2 4 6 8 10 12

−1

0

1

cos(2πfn + φ), f = 0.1(Hz), φ = −2πf · 2(rad)

3

Page 4: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Consider a periodic discrete-time signal with period

N :

x(n) = x(n + N), all n

4

Page 5: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

In analogy with continuous-time case the discrete

sinusoidal signals

cos(2πk

Nn), sin(

2πk

Nn), k = 0, 1, 2, . . .

have period N .

It follows that an N -periodic signal {x(n)} can be

expanded in terms of sinusoidal signals

cos(2πk

Nn), sin(

2πk

Nn), k = 0, 1, 2, . . .

5

Page 6: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Important difference compared to continuous-time case:

We have

cos(nω) = cos(nω + 2πnl)

= cos (n(ω + 2πl)), all integers l

=⇒Frequencies ω and ω + 2πl give the same discrete-

time sequence

NOTE: works only because time n is an integer!

6

Page 7: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Hence we need only include frequency components

cos(2π1N

n), cos(2π2N

n), . . . , cos(2πN − 1

Nn)

sin(2π1N

n), sin(2π2N

n), . . . , sin(2πN − 1

Nn)

and we obtain the Fourier series

x(n) = a0 +N−1∑

k=1

ak cos(k2π

Nn) +

N−1∑

k=1

bk sin(k2π

Nn)

7

Page 8: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

As before, we can express each frequency component

in terms of complex exponentials:

x(n) =N−1∑

k=−N+1

ckej2πkn/N

As time n is an integer we can eliminate the negative

exponentials:

ej2π(−m)n/N = ej2π(−m)n/N+j2πn = ej2π(N−m)n/N

=⇒Terms with k = −m < 0 can be replaced by a term

with k = N −m > 0

8

Page 9: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

NOTE:

As c−k = c∗k, we have

c−kej2π(−k)n/N = c∗ke

j2π(N−k)n/N

Fourier series of discrete-time periodic signal

An N -periodic discrete-time signal can be expanded

as

x(n) =N−1∑

k=0

dkej2πkn/N

where dN−k = d∗k

9

Page 10: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Here the complex-valued frequency components are

given by

dk =1N

N−1∑n=0

x(n)e−j2πkn/N

Proof:

Multiply expression for x(n) with e−j2πmn/N and sum

over time n over one period:

1N

N−1∑n=0

[e−j2πmn/N ×

(x(n) =

N−1∑

k=0

dkej2πkn/N

)]

10

Page 11: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Here the right-hand side becomes

1N

N−1∑

k=0

dk

N−1∑n=0

ej2π(k−m)n/N

which vanishes if m 6= k, because

N−1∑n=0

ej2π(k−m)n/N ={

N, if k −m = 0,±N,±2N, . . .

0, otherwise

Hence

1N

N−1∑

k=0

dk

N−1∑n=0

ej2π(k−m)n/N = dm

11

Page 12: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

and1N

N−1∑n=0

x(n)e−j2πmn/N = dm

giving the result

12

Page 13: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

EXAMPLE: Periodic discrete-time square wave with period

N = 4:

x(0) = 1x(1) = 1x(2) = 0x(3) = 1

-5 -4 -3 -2 -1 0 1 2 3 4 5

· · · · · ·

x(n)

n

and x(n) = x(n− 4), all n

Frequency components: 0, 2π4 , 2π·2

4 , 2π·34

(Next frequency 2π·44 = 2π is equivalent to frequency

component 0)

13

Page 14: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Fourier series:

dk =14

3∑n=0

x(n)e−j2πkn/4

=14

[1 · e−j2πk·0/4 + 1 · e−j2πk·1/4 + 0 + 1 · e−j2πk·3/4

]

=14

[1 + e−jπk/2 + e−jπk·3/2

]

=14

[1 + 2 cos (πk/2)]

=⇒d0 =

34, d1 =

14, d2 = −1

4, d3 =

14

0 2ππ/2π

3π/2

dk

14

Page 15: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Hence

x(n) =3∑

k=0

dkej2πkn/4

=34

+14ej2π1·n/4 − 1

4ej2π2·n/4 +

14ej2π3·n/4

=34

+14

[cos (πn/2) + j sin (πn/2)]

−14

[cos (πn) + j sin (πn)] +14

[cos (3πn/2) + j sin (3πn/2)]

Note that as x(n) is real the imaginary components should

vanish

15

Page 16: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Here we have:

- sin(πn) = 0

- cos(πn) = (−1)n

In addition, frequency components 3π/2 and π/2 are related,

because

- sin(3πn/2)=sin(3πn/2−2πn)=sin(−πn/2)=− sin(πn/2),and

- cos(3πn/2)=cos(3πn/2− 2πn)=cos(−πn/2)=cos(πn/2)

=⇒

x(n) =34

+12

cos(

4n

)− 1

4(−1)n

16

Page 17: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

NOTE:

In above example the Fourier series coefficients dk were real.

Reason: Recall that

ak cos(2πkn/N)+bk sin(2πkn/N) = ckej2πkn/N+c∗ke−j2πkn/N

where

ck =12

(ak − jbk) , c∗k =12

(ak + jbk)

As x(n) is even, x(−n) = x(n), the sine-terms vanish so that

bk = 0 and hence ck and dk are real.

17

Page 18: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Next example illustrates a signal which is not even.

Consider the periodic signal

x̃(0) = 1

x̃(1) = 1

x̃(2) = 1

x̃(3) = 0

and x̃(n) = x̃(n− 4), all n

We see that x̃(n) = x(n− 1), all n.

18

Page 19: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Hence

x̃(n) = x(n− 1)

=3∑

k=0

dkej2πk(n−1)/4

=3∑

k=0

dke−j2πk/4ej2πkn/4

=3∑

k=0

d̃kej2πkn/4

where

d̃k = dke−j2πk/4

19

Page 20: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

or

d̃0 = d0ej·0 =34

d̃1 = d1e−jπ/2 =14· (−j)

d̃2 = d2e−jπ = −14· (−1)

d̃3 = d3e−j3π/2 =14· j

20

Page 21: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Fourier series of non-periodic discrete-timesignals

In analogy with the continuous-time case a non-periodic

discrete-time signal consists of a continuum of frequencies

(rather than a discrete set of frequencies)

But recall that

cos(nω) = cos(nω + 2πnl)

= cos (n(ω + 2πl)), all integers l

=⇒Only frequencies up to 2π make sense

21

Page 22: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Hence a discrete-time signal {x(n)} can be expanded as

x(n) =12π

∫ 2π

0

X(ω)ejωndω

where it can be shown that the Fourier transform X(ω) is given

by

X(ω) =∞∑

n=−∞x(n)e−jωn

22

Page 23: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

THE DISCRETE FOURIER TRANSFORM (DFT)

Next let’s introduce the standard definition of the discrete

Fourier transform of a sequence

{x(0), x(1), . . . , x(N − 1)}

of finite length N .

We do not make any assumptions about the signal (periodicity

etc) outside the range 0 ≤ n ≤ N − 1.

23

Page 24: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Facts:

- from N signal values x(0), x(1), . . . , x(N − 1) at most N

independent frequency components can be computed

- frequency components ≥ 2π are redundant (identical with

frequencies < 2π

- lower bound on frequency resolution is 2π/N (= frequency

corresponding to period length equal to sequence length N)

Hence it makes sense to determine the frequency components

at the N equidistant frequencies

0,1N

2π,2N

2π, . . . ,N − 1

N2π

i.e., the same frequencies contained in an N -periodic signal

24

Page 25: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

DISCRETE FOURIER TRANSFORM (DFT):

The DFT {X(k)}N−1k=0 of a sequence {x(k)}N−1

k=0 is

defined as

X(k) =N−1∑n=0

x(n)e−j2π kNn, k = 0, 1, . . . , N−1 (DFT)

and the inverse DFT (IDFT) is given by

x(n) =1N

N−1∑

k=0

X(k)ej2π kNn, n = 0, 1, . . . , N − 1

Observe similarity with Fourier transform of periodic

signal

25

Page 26: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

EXAMPLE

Show that the Discrete Fourier Transform of the

sequence

{x(n)} = {1, 0, 0, 1}is given by

{X(k)} = {2, 1 + j, 0, 1− j}

26

Page 27: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

PROPERTIES OF DFT

• Symmetry property.

For a real sequence {x(n)}, the DFT satisfies

X(N − k) = X(k)∗ (complex conjugate)

i.e.,

Re[X(N − k)] = Re[X(k)]

Im[X(N − k)] =−Im[X(k)], k = 1, . . . , N − 1

27

Page 28: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Follows from the fact that in the definition of X(N − k),

x(n)e−j2πN−kN n = x(n)ej2π k

N n−j2π

= x(n)ej2π kN n

=(x(n)e−j2π k

N n)∗

• DC component.

For k = 0 we have

X(0) =N−1∑n=0

x(n)e−j2π 0Nn

= x(0) + x(1) + · · ·+ x(N − 1)

Hence X(0) is real if x(n) are real and the

28

Page 29: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

contribution of X(0) to x(n) is

1N

X(0)e0 =1N

X(0)

i.e., a constant component (usually called the DC

component).

• Oscillating component.For even values of N , we have for k = N/2

X(N/2) =N−1∑n=0

x(n)e−j2πN/2N n =

N−1∑n=0

x(n)e−jπn

= x(0)− x(1) + · · · − x(N − 1)

Hence X(N/2) is real if x(n) are real and the

29

Page 30: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

contribution of X(N/2) to x(n) is

1N

X(N/2)ej2πN/2N n =

1N

X(N/2) (−1)n

i.e., an oscillating component.

• Parseval’s relation.

The energy of the signal {x(n)} defined as

Px =N−1∑n=0

x(n)2

can be computed in the frequency domain using

30

Page 31: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

Parseval’s relation,

Px =N−1∑n=0

x(n)2 =1N

N−1∑

k=0

|X(k)|2

It follows that 1N |X(k)|2 can be interpreted as the

contribution to the total energy of the signal from

frequency component 2πk/N .

Note: important in signal compression!

• DFT of a δ function.

The δ function,

δ(n) ={

1, n = 00, n 6= 0

31

Page 32: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

has DFT X(k) = 1, k = 0, 1, . . . , N − 1.

Hence it consists of equal amounts of all

frequencies!

32

Page 33: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

DIRECT COMPUTATION OF DFT SUM ISNOT ADVISABLE IN PRACTICE:

- HIGH COMPUTATIONAL BURDEN:

Computation of sequence X(k) requires N 2

complex additions and multiplications (a lot for

long sequences)

- Numerical round-off errors add up when evaluation

long sum

33

Page 34: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

EFFICIENT ALGORITHM FOR SOLUTION:Fast Fourier Transform (FFT)

- FFT: N log2 N complex additions and

(N/2) log2 N complex multiplications (compare

N 2 using direct evaluation)

- Each element X(k) is obtained by only log2 N

complex additions (compare with N using direct

evaluation) ⇒ significantly smaller round-off errors

34

Page 35: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

FFT uses the fact that the discrete Fourier transformX(k) of a sequence {x(0), x(1), . . . , x(N − 1)} withN even can be determined as

X(k) = X11(k) + W kNX12(k), k = 0, 1, . . . , N/2− 1

X(k + N/2) = X11(k)−W kNX12(k), k = 0, 1, . . . , N/2− 1

where WN = e−j2π/N ,

{X11(k)} is the Fourier transform of the ’even

subsequence’ {x(0), x(2), . . . , x(N − 2)}, and

X12(k)} is the Fourier transform of the ’odd

subsequence’ {x(1), x(3), . . . , x(N − 1)}.

35

Page 36: Fourier series of periodic discrete-time · PDF fileFourier series of non-periodic discrete-time signals In analogy with the continuous-time case a non-periodic discrete-time ... EFFICIENT

INTERPRETATION OF FOURIER TRANSFORMCOMPONENTS

0

X(0)

X(1)

1

· · ·

X(k)

k

· · ·

X(N/2)

N/2

· · ·

X(N-k)=X(k)∗

N-k

· · ·X(N-1)=X(1)∗

N-1 N

Normalized frequency 0 1N

kN

12

N−kN

N−1N 1 (Hz)

Actual frequency

Sampling frequency fs = 1/Ts0 1

Nfs

kN

fs12fs

N−kN

fsN−1

Nfs fs (Hz)

Matlab indexing X(1) X(2) X(k+1) X(N/2+1) X(N-k+1) X(N)

36