Fourier analysis. A.1 Fourier series. Start off with the identity 1 (1) a cos(x) + b sin(x) = ( ( )) b

A Fourier analysis A.1 A.1.1 Fourier series Real Start off with the identity1    p b −1 2 2 a cos(x) + b sin(x) = a + b cos x − tan a (1) wh...
Author: Darleen Woods
0 downloads 1 Views 129KB Size
A

Fourier analysis

A.1 A.1.1

Fourier series Real

Start off with the identity1    p b −1 2 2 a cos(x) + b sin(x) = a + b cos x − tan a

(1)

which says that you can represent a sinusoid with arbitrary magnitude and phase as a sum of a sine and a cosine. Consider summing harmonics of this sinusoid: f(x) =

∞ X

an cos(nx) + bn sin(nx).

(2)

n=0

Notice that n = 0 just leaves f(x) = a0 , which is a constant offset. Now consider the integral

Zπ cos(θ) cos(φ) dθ.

I=

(3)

−π

It’s basically zero for everything except φ = θ, in which case Zπ I= cos2 (θ) dθ = π.

(4)

−π

So, we can solve for an and bn by multiplying by a sinusoid and integrating: Zπ



∞ X

f(x) cos(kx) dx = −π

−π

! an cos(nx) + bn sin(nx) cos(kx) dx

(5)

n=0

= πak Z 1 π f(x) cos(kx) dx ak = π −π

(6) (7)

and similarly bk =

1 π

Zπ f(x) sin(kx) dx.

(8)

−π

Equations 7 and 8 define the Fourier series. A.1.2

Complex

Now bring in a couple of identities ejx + e−jx 2 ejx − e−jx sin(x) = , 2j

cos(x) =

1 https://en.wikipedia.org/wiki/Trig_identities

1

(9) (10)

where j =

√ −1 and 1/j = −j. This allows us to write f(x) = = =

= f(x) =

∞ X n=0 ∞ X

an cos(nx) + bn sin(nx)

1 2

ejnx + e−jnx ejnx − e−jnx + bn 2 2j

(12)

(an − jbn )ejnx + (an + jbn )e−jnx

(13)

an

n=0 ∞ X

(11)

n=0

∞ −1 1 X 1X (an − jbn )ejnx + (an + jbn )ejnx 2 2 n=−∞ n=0 ∞ X

cn ejnx

(14) (15)

n=−∞

where 1 (an − jbn ) 2 = an

cn = a−n

(16) (17)

b−n = −bn

(18)

b0 = 0.

(19)

and

Notice that it’s double sided; a single sinusoid is now split across positive and negative components. The inverse (actually forward) case follows similarly: Z 1 π 1 cn = (an − jbn ) = f(x)(cos(nx) − j sin(nx)) dx 2 2π −π  jnx  Z 1 π e + e−jnx ejnx − e−jnx = f(x) −j dx 2π −π 2 2j Zπ 1 cn = f(x)e−jnx dx. 2π −π

(20) (21) (22)

Equations 22 and 15 define respectively the complex forward and inverse Fourier series. A.1.3

Reconstruction

It’s tempting to say that the real coefficients are obvious from the complex ones; in practice it’s necessary to reconstruct them formally:

A.2 A.2.1

a0 = 2c0

(23)

an = cn + c−n

(24)

bn = j(cn − c−n )

(25)

Fourier transform Cycles

So far, x is measured in radians. Instead, specify it in, say, seconds. This amounts to a substitution Tx 2π 2πt x= T 2π dt dx = T t=

2

(26) (27) (28)

so x = π =⇒ t =

T 2

x = −π =⇒ t = − The transform is then cn =

1 T

(29) T 2

(30)

Z T/2 f(t)e−2πjtn/T dt.

(31)

−T/2

and the inverse is

∞ X

f(t) =

cn e2πjtn/T

(32)

n=−∞

One can think of n as measuring cycles, so f = n/T is cycles per second, or Hertz. Define n T n+1 n 1 ∆f = − = T T T f = lim

T →∞

(33) (34)

so the inverse transform becomes a Riemann sum f(t) =

∞ X

T cn e2πjtn/T ∆f.

(35)

n=−∞

Further, if the complex cn measures, say, energy, then the continuous function measures energy density. So, cn = lim T cn . T →∞ ∆f T →∞

F(f) = lim

Consolidating the above reasoning and letting ∆f → df, Z∞ f(t)e−2πjtf dt F(f) = Z−∞ ∞ F(f)e2πjtf df. f(t) =

(36)

(37) (38)

−∞

Equations 37 and 38 define respectively the Fourier and inverse Fourier transforms. A.2.2

Angular frequency

It is possible to change variable from f in Hz (cycles per second) to ω in radians per second. So, if ω = 2πf ω f= 2π 1 df = dω 2π

(39) (40) (41)

gives Z∞

f(t)e−jωt dt Z 1 ∞ f(t) = F(ω)ejωt dω. 2π −∞

F(ω) =

(42)

−∞

This is the one that makes sense in the context of Laplace and z-transforms.

3

(43)

A.3

Discrete time Fourier transform

In the context of sampling, time becomes discrete. If the sampling frequency is Fs , 1 Fs t = nT

(44)

T=

(45)

xn = T f(nT )

(46)

so we can write f(t) =

∞ X

xn δ(t − nT ),

(47)

n=−∞

and substituting, ∞ X

F(ω) =

xn e−jωnT dt

n=−∞ Z∞

xn =

T 2π

F(ω)ejωnT dω.

(48) (49)

−∞

Now redefine ω to lie in the range −π to π ω 0 = 2π

f = 2πfT = ωT Fs

ω0 T 1 dω = dω 0 T

(50) (51)

ω=

(52)

This leads to: F(ω) =

∞ X

xn e−jωn

(53)

n=−∞ Zπ

xn =

1 2π

F(ω)ejωn dω.

(54)

−π

Equations 53 and 54 define respectively the Discrete Time Fourier and inverse Discrete Time Fourier transforms.

A.4 A.4.1

Discrete Fourier transform From Fourier series

Recall the complex Fourier series, but with k replacing n for the discrete frequency points: Z 1 π ck = f(x)e−jkx dx 2π −π ∞ X f(x) = ck ejkx

(55) (56)

k=−∞

It is already discrete in frequency; to make it discrete in time too, make a similar substitution as before. First change the period of x (2π) into something that can be discretised: N x 2π 2π x= t N 2π dx = dt N t=

N 2 N x = π =⇒ t = 2

x = −π =⇒ t = −

4

(57) (58) (59) (60) (61)

Substituting, Z 1 N/2 f(t)e−j2πkt/N dt N −N/2 ∞ X f(t) = ck ej2πkt/N ck =

(62) (63)

k=−∞

Now discretise; note that ck is now periodic so the range changes (64)

t=n X

N/2

f(t) =

f(t)δ(t − n)

(65)

xn δ(t − n)

(66)

n=−N/2+1

X

N/2

=

n=−N/2+1

so,

ck =

1 N

X

N/2

xn e−j2πkn/N

(67)

n=−N/2+1

X

N/2

xn =

ck ej2πkn/N

(68)

k=−N/2+1

A.4.2

From discrete time Fourier transform

The DTFT is already discrete in time; now make it discrete in frequency. N ω 2π 2π f ω= N 2π dω = df N f=

N 2 N ω = π =⇒ f = 2

ω = −π =⇒ f = −

(69) (70) (71) (72) (73)

Substituting, ∞ X

F(f) =

xn e−j2πfn/N

(74)

n=−∞

1 xn = N

Z N/2 F(f)ej2πfn/N df.

(75)

−N/2

Now discretise; note that xn is now periodic so the range changes (76)

f=k X

N/2

F(f) =

F(f)δ(f − k)

(77)

fk δ(t − n)

(78)

n=−N/2+1

X

N/2

=

n=−N/2+1

5

so, X

N/2

fk =

xn e−j2πkn/N

(79)

fk ej2πkn/N

(80)

n=−N/2+1

1 xn = N

X

N/2

k=−N/2+1

i.e., the normaliser is on the inverse transform instead of the forward transform as it would be for the series based derivation. A.4.3

Convention

The discrete Fourier transform pair is normally defined as fk =

N−1 X

xn e−j2πkn/N

(81)

k=0

xn =

N−1 1 X fk ej2πkn/N , N k=0

i.e., the one based on DTFT. It’s time shifted too, in the sense of matlab or numpy’s fftshift().

6

(82)