A1 2011 1 / 1

A1 Time-Frequency Analysis

David Murray

[email protected] www.robots.ox.ac.uk/∼dwm/Courses/2TF

Hilary 2011 A1 2011 2 / 1 Course Content

1 From Signals to Complex Fourier Series

2 From Complex Fourier Series to the

3 Convolution. The impulse response and transfer functions

4 Sampling, Aliasing

5 Power & Energy Spectra, Autocorrelation, and Spectral Densities

6 Random Processes and Signals A1 2011 3 / 1 Introduction

In this lecture we will described the mathematic operation of the convolution of two continuous functions

f (t) ∗ g(t)

Two functions are blended or folded together. We then discuss the impulse response h(t) of a system, and show how it is related to the transfer function H(s) of the system. First we define a the δ-function or unit impulse. Like the Heaviside u(t), it is a generalized function or “distribution”, and is best defined by considering another function in conjunction with it. A1 2011 4 / 1 The δ-function (1)

Consider a function g(t) 1/  1/w 0− < t < w w g(t) = 0 otherwise

0 w + As w becomes very small, w → 0 , δ (t) the function g(t) turns into a δ-function δ(t) indicated by the arrowed spike.

0 0− is a infinitesimally small amount less than zero, and 0+ is a infinitesimally small amount more than zero. A1 2011 5 / 1 The δ-function (2)

One thing of note about g(t) is that g(t) 1/ w Z w g(t)dt = 1. 0− 0 This property is retained as w → 0+, w so that δ (t) Z ∞ Z 0+ δ(t)dt = δ(t)dt = 1 −∞ 0− 0

Akin to the of the Heaviside unit step

Z t δ(t)dt = u(t) . −∞ A1 2011 6 / 1 The δ-function (3)

More formally the δ−function is δ defined in association with another f(t) (t) arbitrary function f (t), as Z ∞ f (t)δ(t)dt = f (0) . 0 −∞ Picking out values of a function is δ (t−τ ) called sifting of f (t) by δ(t). We can also see that f(t) Z ∞ f (t)δ(t − τ)dt = f (τ) t −∞ 0 τ

How? Subst p = t − τ: then Z ∞ f (p + τ)δ(p)dp = f (0 + τ) = f (τ) −∞ A1 2011 7 / 1 The δ-function (4)

Although the δ-function is infinitely A δ (t−τ ) high, very often you will see a described as the unit δ-function

This is to denote a delta-function t where τ Z ∞ 0 δ(t)dt = 1 −∞

If you see a δ-function spike with an amplitude A by it this denotes Z ∞ Aδ(t)dt = A −∞ A1 2011 8 / 1 Properties of the δ-function #1

Fourier transform of the delta function:

FT [δ(t)] = 1

Proof: Use the definition of the δ-function and sift the function f (t) = e−iωt : Z ∞ δ(t)e−iωt dt = e−iω0 = 1 . −∞ NB!! Check the minus sign is in the notes ...

This make some sense. We know from FS that describing abrupt changes requires many terms in the series — i.e. the high frequencies are important. The δ-function is the mother of all abrupt changes. A1 2011 9 / 1 Properties of the δ-function #2

Symmetry: The δ-function has even symmetry, δ(t) = δ(−t)

Proof: Consider sifting an even function E(t) with E(0)=0 and substitute p = (−t) Z ∞ E(t)δ(t)dt = E(0) −∞ Z −∞ ⇒ − E(−p)δ(−p)dp = E(0) ∞ Z ∞ ⇒ E(p)δ(−p)dp = E(0) −∞ Z ∞ ⇒ E(t)δ(−t)dt = E(0) −∞

So δ(−t) = δ(t) and δ(t) is even. A1 2011 10 / 1 Properties of the δ-function #3

Parameter Scaling:

1 δ(at) = δ(t) |a|

R ∞ Proof: Use the fundamental sifting definition −∞ f (t)δ(t)dt = f (0) The |a| again hints dealing with things in two stages ... If a ≥ 0 substitute (at) for t (no change in limits) Z ∞ Z ∞ f (at)δ(at)d(at) = a f (at)δ(at)dt = f (0) −∞ −∞ Z ∞ But f (at)δ(t)dt = f (0) ⇒a δ(at) = δ(t). −∞ A1 2011 11 / 1 Properties of the δ-function #3 /ctd

Proof: continued Now if a < 0 substitute (at) for t (but need to change limits as a negative)

Z −∞ Z ∞ f (at)δ(at)d(at) = −a f (at)δ(at)dt = f (0) ∞ −∞ Z ∞ But f (at)δ(t)dt = f (0) ⇒ − a δ(at) = δ(t). −∞ So to cover both cases: 1 δ(at) = δ(t) |a| A1 2011 12 / 1 Fourier Transforms that involve the δ-function

Fourier Transform of eiω0t Z ∞ FT eiω0t  = ei(ω0−ω)t dt −∞

= 2πδ(ω − ω0) . How could you prove this?

Fourier Transform of einω0t Z ∞ FT einω0t  = ei(nω0−ω)t dt −∞

= 2πδ(ω − nω0) . A1 2011 13 / 1 Fourier Transforms that involve the δ-function

Fourier Transform of 1

FT [1] = 2πδ(ω) .

Proof Either  iω t  put ω0 = 0 into FT e 0 = 2πδ(ω − ω0) or use the dual property

FT [δ(t)] = 1 ⇒FT [1] = 2πδ(−ω) ⇒FT [1] = 2πδ(ω)

as δ is an even function. A1 2011 14 / 1 Fourier Transforms that involve the δ-function

Fourier Transform of cos ω0t 1  FT [cos ω t] = FT eiω0t + e−iω0t  0 2

= π (δ(ω − ω0) + δ(ω + ω0)) .

Fourier Transform of sin ω0t  1  FT [sin ω t] = FT eiω0t − e−iω0t  0 2i

= −iπ (δ(ω − ω0) − δ(ω + ω0)) . A1 2011 15 / 1 Fourier Transforms that involve the δ-function

Fourier Transform of Complex Fourier Series

" n=∞ # n=∞ X inω0t X FT Cne = 2π Cnδ(ω − nω0) . n=−∞ n=−∞

If you are wondering ...

... yes, this will prove very useful! A1 2011 16 / 1 Convolution (1)

This is a key technique in signal processing The convolution of continuous functions f (t) and g(t) is defined by an The convolution integral. The value of f ∗ g at t is Z ∞ f ∗ g (t) = f (τ)g(t − τ)dτ −∞ where τ is a dummy variable. Note that one function is “reversed” ... But the process is commutative, so it doesn’t matter which: Z ∞ Z ∞ (f ∗g)(t) ≡ (g ∗f )(t) ⇒ f (τ)g(t −τ)dτ ≡ f (t −τ)g(τ)dτ −∞ −∞ A1 2011 17 / 1 ♣ Convolution Example #1

[Q] Find and sketch the convolution of f (t) = u(t)e−at with g(t) = u(t)e−bt , where both a and b are positive. [A] The “unhelpful” answer must be R ∞ −aτ −b(t−τ) f ∗ g = −∞ u(τ)e u(t − τ)e dτ . f(τ ) g(τ ) To make sense of this... Make sketches of the functions f (τ) and g(t − τ) as τ τ τ varies. 0 0 Function f (τ) looks just like g(−τ ) g(t−τ ) f (t) of course. But g(t − τ) is a reflected (“time reversed”) and shifted version of g(t). τ τ 0 0 t A1 2011 18 / 1 ♣ Convolution Example #1

Now multiply the two τ ) τ ) functions g(t−τ ) f( g(t−τ ) f(

BUT we must worry τ τ about the fact that t is t 0 0 t a variable. f(τ )g(t−τ ) f(τ )g(t−τ )

t <0 t >0 In this case there are two different regimes, τ τ one when t < 0 and 0 t 0 t the other when t ≥ 0. A1 2011 19 / 1 ♣ Convolution Example #1

For t < 0, the function to be g(t−τ ) f(τ ) integrated is everywhere zero, and the result is zero. For t ≥ 0 τ 0 t Z ∞ −aτ −b(t−τ) u(τ)e u(t − τ)e dτ f(τ )g(t−τ ) −∞ Z t t >0 = e−bt e(b−a)τ dτ 0 τ e−bt   0 t = e(b−a)t − 1 b − a So  e−at − e−bt  /(b − a) for t ≥ 0 f ∗g(t) = 0 for t < 0 A1 2011 20 / 1 ♣ Convolution Example #1

Important to realize that the convolution function is the integral evaluated for the complete range of t values.

 e−at − e−bt  /(b − a) for t ≥ 0 f ∗ g(t) = 0 for t < 0 This shows the t > 0 part of the convolution for b = 2 and a = 1.

0.25 (exp(-x)-exp(-2*x))

0.2

0.15

0.1

0.05

0 0 1 2 3 4 5 6 A1 2011 21 / 1 ♣ Convolution Example #2 [Q] Derive an expression for the convolution of an arbitrary signal f with the function g shown in the figure. Determine the convolution when f (t) = A, a constant, and when f (t) = A + (B − A) u(t). g(t) f(t) g(t− τ ) f(t) 1 a t 1 −a t t−a t τ −1 t t+a −1 [A] Function f (τ) looks exactly like f (t), but g(t − τ) is reflected and shifted. Multiply and integrate over τ from −∞ to ∞. Because g only has finite range, we can pinch in the limits of integration, and the convolution becomes

Z t Z t+a f ∗ g(t) = − f (τ)dτ + f (τ)dτ t−a t A1 2011 22 / 1 ♣ Convolution Example #2 ctd Z t Z t+a f ∗ g(t) = − f (τ)dτ + f (τ)dτ t−a t

When f (t) = A, f ∗ g(t) = 0 for all t. When f (t) = A + (B − A) u(t) we have to be careful because there is a discontinuity at t = 0. g(t− τ ) f(τ ) f(τ ) g(t− τ ) B

A τ τ τ −2a −a 0 0 −a 0 a 1:t<−a 2: t=−a3: −aa The convolution is zero for all t < −a and all t > a (Diagram positions 1,2,5). A1 2011 23 / 1 ♣ Convolution Example #2 ctd

g(t− τ ) f(τ ) f(τ ) g(t− τ ) B f * g a(B−A) A τ τ τ t −2a −a 0 0 −a 0 a −a a 1:t<−a 2: t=−a3: −aa

The maximum value is when t = 0 (Posn 4). By inspection, or using the above, (f ∗ g)(t = 0) = a(B − A). For −a < t < 0, (Position 3) Z t Z 0 Z t+a f ∗ g = − (A)dτ + Adτ + Bdτ t−a t 0 = −aA + −tA + (t + a)B = (a + t)(B − A)

showing that the increase in convolution is linear. Symmetry fills in 0 < t < a. A1 2011 24 / 1 The Impulse Response Function (1)

You are so used to describing systems using the transfer function in the frequency domain Y (ω) = H(ω)X(ω) ...

... that you may have forgotten to wonder Why can’t we describe a system’s response in the time domain?

The answer is You can, but you didn’t know about convolution until now.

In the time domain, a system is described by its Impulse Response Function h(t).

This function describes the response of system at time t to an unit impulse or δ-function input administered at time t = 0. A1 2011 25 / 1 The Impulse Response Function (2)

Suppose that “now” is time t, and you administered an impulse Response at time τ in the past — at t is that is t − τ ago. δ input h(t −τ ) The response now is at time τ y(t) = h(t − τ). If you administer n impulses with different strengths x(τn) at different times τn, the response now (i.e. at time t) would be X y(t) = x(τn)h(t − τn) . Now make the impulses closen to one another, creating a time-continuous input signal x. The response now is:

Z t y(t) = x(τ)h(t − τ)dτ , τ ≤ t . −∞ A1 2011 26 / 1 The Impulse Response Function (3) Z t y(t) = x(τ)h(t − τ)dτ , τ ≤ t . −∞

Now suppose that h is causal. This means h(t) = 0 for t < 0 Equivalently, h(t − τ) = 0 for all τ > t.

Then we can allow the upper limit to go to ∞, and

The time response y(t) to an input x(t) is Z ∞ y(t) = x(τ)h(t − τ)dτ = x ∗ h (t) . −∞

The temporal output y(t) of a system is the temporal input x(t) CONVOLVED with the Impulse Response h(t) A1 2011 27 / 1 How do we connect stuff up ... ?

Can we reconcile the following things about systems and signals? The temporal output is the temporal input CONVOLVED with the Impulse Response Function. The frequency domain output is the frequency domain input MULTIPLIED by the Transfer Function. The frequency domain signal is the Fourier Transform of the temporal signal So we can conjecture that:

y(t) = x(t) ∗ h(t) ↓ ↓ FTFT ↓ ↓ Y (ω) = X(ω)H(ω) A1 2011 28 / 1 Proof: The Fourier Transform of a Convolution Find the Fourier Transform of a convolution ... Z ∞ FT [x ∗ h] = [(x ∗ h)(t)] e−iωt dt t=−∞ Z ∞ Z ∞ = x(τ)h(t − τ) dτ e−iωt dt t=−∞ τ=−∞ Switch the order of integration, then write t = τ + p. In the inner integral τ is a constant, so that dt = dp. Z ∞ Z ∞ FT [x ∗ h] = x(τ)h(t − τ)e−iωt dtdτ τ=−∞ t=−∞ Z ∞ Z ∞ = x(τ)h(p)e−iωτ e−iωpdpdτ τ=−∞ p=−∞ Z ∞ Z ∞ = x(τ)e−iωτ dτ h(p)e−iωpdp τ=−∞ p=−∞ = FT [x] FT [h] = X(ω) H(ω) A1 2011 29 / 1 The modulation/convolution properties

We’ve just derived ...

The time-modulation/frequency-convolution property

f (t) ∗ g(t) ⇔ F(ω)G(ω)

A corollary is .... The frequency-modulation/time-convolution property

1 f (t)g(t) ⇔ F(ω) ∗ G(ω) 2π A1 2011 30 / 1 Impulse response and Transfer Function

The second important connection is that The FT of the Impulse Response is the Transfer Function

h(t) ⇔ H(ω) or FT [h(t)] = H(ω)

x(t)*h(t) y(t)

X( ω ))H( ωY( ω ) A1 2011 31 / 1 ♣ Example #1

[Q1] Show the sifting property δ(t) ∗ f (t) = f (t). R ∞ [A1] One way would be by writing −∞ f (τ)δ(t − τ)dτ, etc, but a quicker way is to argue that

FT [δ(t) ∗ f (t)] = FT [δ(t)] FT [f (t)] = FT [f (t)] ⇒δ(t) ∗ f (t) = f (t) We could also show that f (t) ∗ δ(t ± α) = f (t ± α) .

Both of these are manifestations of the ...

Sifting property of δ-functions

f (t) ∗ δ(t ± α) = f (t ± α)

Previously this was expressed as an integral — but we now recognize that integral as the convolution integral! A1 2011 32 / 1 ♣ Example #2

[Q] Convolve the two top hat functions f (t) and g(t), and plot the resulting convolved signal r(t). Find its Fourier Transform R(ω). f(t) g(t) 2 1

−a a −a/2 a/2 A1 2011 33 / 1 ♣ Example #2 ctd

[A] Plot f (τ) and the reversed and shifted g(t − τ) ... for all t < −3a/2, the product fg is zero, so the convolution integral is zero. τ g(t− ) f(τ ) fg

a 1 2 τ τ t −a a Z t+a/2  3a For −3a/2 < t < −a/2 the integral is 2dτ = 2 t + . −a 2 τ g(t− ) f(τ ) fg a 2 1 τ

t −at+a/2 −a t+a/2 A1 2011 34 / 1 ♣ Example #2 ctd

At t = −a/2 there is complete overlap, at which point the integral is 2a. τ g(t− ) f(τ ) fg

1 τ

−at a −a 0 It will continue constant at 2a until t = 0. The convolution has even symmetry. Result is f(t) g(t) * 2a

−3a/2−a/2 0 a/2 3a/2 A1 2011 35 / 1 ♣ Example #2 ctd

For the Fourier transform, use f ∗ g ⇔ F(ω)G(ω). Function f (t) is a top hat of height 1, halfwidth a. Use

1  ω  If p(t) ⇔ P(ω) then FT [p(St)] = P |S| S The scaling is S = 1/2 (looks fatter ⇒S < 1) ...

1 2 2ωa 2 ωa ⇒F(ω) = sin = sin (ωa) = 2a sinc 1/2 2ω 2 ω π Function g(t) is a top hat of height 2 and half-width a/2.

4 ωa ωa ⇒G(ω) = 2Π(ω) = sin = 2a sinc . ω 2 2π So the Fourier Transform of the convolution is 8 ωa ωa ωa FT [f ∗ g] = sin sin (ωa) = 4a2sinc sinc . ω2 2 2π π A1 2011 36 / 1 ♣ More examples

[Q3] A signal f (t) is amplitude modulated by cos ω0t into a signal y(t). Find the resulting Fourier Transform Y (ω) in terms of F(ω). [A3] We’ve done this another way in Lecture 2. Instead, let’s use the property from this Lecture: 1 f (t)g(t) ⇔ F(ω) ∗ G(ω)   2π 1 iω0t −iω0t cos ω0t = e + e Hence 2

FT [cos ω0t] = FT [f (t) cos ω t] 0 π (δ(ω + ω ) + δ(ω − ω )) . 1 0 0 = F(ω) ∗ π [δ(ω + ω0)+ δ(ω+ω ) δ(ω−ω ) 2π 0 0 δ(ω − ω0)] π π

1 ω = (F(ω + ω0) + F(ω − ω0)) 2 −ω 0ω 0 A1 2011 37 / 1 ♣ Example ctd

So suppose f (t) had a amplitude spectrum as sketched below.

F( ω ) Cosine F( ω ) Modulation

ω −ω ω ω 0 0 0 0

After amplitude modulation, the amplitude spectrum splits into two parts.

This is a really important result which we will use again and again. A1 2011 38 / 1 Summary of Topic 3

We have defined the δ-function, and discovered its sifting R ∞ property −∞ f (t)δ(t − τ)dt = f (τ). We later realized that sifting was nothing other than a convolution f (t) ∗ δ(t ± α) = f (t ± α)

We defined the convolution integral f ∗ g, and saw how to evaluate such integrals by sketching f (τ) and g(t − τ) and considering any different regimes as t varied. We proved the convolution and modulation properties of Fourier Transforms

We defined the impules response function h(t), and realized that h(t) ⇔ H(ω). The temporal output is the input convolved with the impulse response.

We looked at a number of examples, with one introducing the spectrum for an amplitude modulated signal.