30
Lecture 12 Complex numbers – an alternate view The Fourier transform Convolution, correlation, filtering. NASSP Masters 5003F - Computational Astronomy - 2009

Lecture 12 •Complex numbers –an alternate view •The

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 12 •Complex numbers –an alternate view •The

Lecture 12

• Complex numbers – an alternate view

• The Fourier transform

• Convolution, correlation, filtering.

NASSP Masters 5003F - Computational Astronomy - 2009

Page 2: Lecture 12 •Complex numbers –an alternate view •The

Complex numbers

1−=i

iIRz +=

NASSP Masters 5003F - Computational Astronomy - 2009

REAL IMAGINARY

1−=i

Page 3: Lecture 12 •Complex numbers –an alternate view •The

Complex numbers

1−=i

iIRz +=

NASSP Masters 5003F - Computational Astronomy - 2009

REAL IMAGINARY

1−=i

There IS no √-1.

Page 4: Lecture 12 •Complex numbers –an alternate view •The

Let’s ‘forget’ about complex numbers for a bit...

...and talk about 2-component vectors instead.

y

vy

=

=

θθ

sin

cosv

y

xv

NASSP Masters 5003F - Computational Astronomy - 2009

xx

θ

Page 5: Lecture 12 •Complex numbers –an alternate view •The

What can we do if we have two of them?

y

v1

v2

There are lots of operations one could define, but only a few of themturn out to be interesting.

vsum

NASSP Masters 5003F - Computational Astronomy - 2009

x

+

+=⊕

21

21

21yy

xxvv

We could define something like addition:

I use a funny symbol to remind us that this is NOTaddition (which is an operationon scalars); it is just analogous to it.:

Page 6: Lecture 12 •Complex numbers –an alternate view •The

The following operation has interesting properties:

y

v1

+

−=⊗=

1221

2121

21prodyxyx

yyxxvvv

v2

But it isn’t very like scalarmultiplication except whenall ys are zero.

vprodθ2

θ

θprod=θ1+θ2

NASSP Masters 5003F - Computational Astronomy - 2009

x

[ ][ ]

+

+=

21

21

21prodsin

cos

θθθθ

vvv

It’s fairly easy to show that:

θ1

Page 7: Lecture 12 •Complex numbers –an alternate view •The

Vectors? These are just complex numbers!

vv

=

∂∂

1

0

θ

Note that:

This, plus the angle-summing properties of theproduct, leads to the following typographicalshorthand:

( )θiv exp=v

NASSP Masters 5003F - Computational Astronomy - 2009

Instead of the mysterious

1−=iwe should just note the simple identity .

0

1

1

0

1

0

−=

Page 8: Lecture 12 •Complex numbers –an alternate view •The

Notation:

iIRz +=

=I

Rz

NASSP Masters 5003F - Computational Astronomy - 2009

( )φizz exp=( )RIarctan=φ

( )φφ sincos izz +=

where

These are all just different ways of saying the same thing.

Page 9: Lecture 12 •Complex numbers –an alternate view •The

Some important reals:• Phase

• Power

( )RIarctan=φ =atan2(I,R)

22 IRzzzzP +=== ∗∗

• Amplitude, magnitude or intensity

NASSP Masters 5003F - Computational Astronomy - 2009

22 IRzzzzP +=== ∗∗

PzA ==

Page 10: Lecture 12 •Complex numbers –an alternate view •The

The lessons to learn:

• Complex numbers are just 2-vectors.• The ‘imaginary’ part is just as real as the

‘real’ part.• Don’t be fooled by the fact that the same

symbols ‘+’ and ‘x’ are used both for scalar addition/multiplication and for what turn

NASSP Masters 5003F - Computational Astronomy - 2009

addition/multiplication and for what turn out to be vector operations. This is a historical typographical laziness.– Be aware however that the notation I have

used here, although (IMO) more sensible, is not standard.

– So better go with the flow until you get to be a big shot, and stick with the silly x+iy notation.

Page 11: Lecture 12 •Complex numbers –an alternate view •The

The Fourier transform• Analyses a signal into sine and cosines:

• The result is called the spectrum of the signal.NASSP Masters 5003F - Computational Astronomy - 2009

Page 12: Lecture 12 •Complex numbers –an alternate view •The

The Fourier transform

• G in general is complex-valued.• ω is an angular frequency (units: radians per unit t).

• the transform is almost self-inverse:

{ } ( ) ( ) ( )∫∞

∞−

−== titgdtGg ωω expF

• the transform is almost self-inverse:

• But remember, these integrals are not guaranteed to converge. (This is not a problem when we ‘compute’ the FT, as will be seen.)

NASSP Masters 5003F - Computational Astronomy - 2009

{ } ( ) ( ) ( )∫∞

∞−

== tiGdtgG ωωω exp1-F

Page 13: Lecture 12 •Complex numbers –an alternate view •The

Typical transform pairs

point (delta function) � fringes.

NASSP Masters 5003F - Computational Astronomy - 2009

By the way, ‘the’ reference for the Fourier transform is Bracewell R, “TheFourier Transform and its Applications”, McGraw-Hill

Page 14: Lecture 12 •Complex numbers –an alternate view •The

Typical transform pairs

‘top hat’ � sinc function

NASSP Masters 5003F - Computational Astronomy - 2009

Page 15: Lecture 12 •Complex numbers –an alternate view •The

Typical transform pairs

wider � narrower

NASSP Masters 5003F - Computational Astronomy - 2009

Page 16: Lecture 12 •Complex numbers –an alternate view •The

Typical transform pairs

gaussian � gaussian

NASSP Masters 5003F - Computational Astronomy - 2009

Page 17: Lecture 12 •Complex numbers –an alternate view •The

Typical transform pairs

Hermitian � real

NASSP Masters 5003F - Computational Astronomy - 2009

Page 18: Lecture 12 •Complex numbers –an alternate view •The

Practical use of the FT:• Periodic signals hidden in noise

• Processing of pure noise:– Correlation

– Convolution

– Filtering

• Interferometry• Interferometry

NASSP Masters 5003F - Computational Astronomy - 2009

Page 19: Lecture 12 •Complex numbers –an alternate view •The

Periodic signal hidden in noise

NASSP Masters 5003F - Computational Astronomy - 2009

The eye can’t see it… …but the transform can.

Page 20: Lecture 12 •Complex numbers –an alternate view •The

Transforming pure noise

NASSP Masters 5003F - Computational Astronomy - 2009

Uncorrelated noise The transform looks very similar.This sort of noise is called ‘white’. Why?

Page 21: Lecture 12 •Complex numbers –an alternate view •The

Power spectrum• Remember the power P of a complex

number z was defined as

• If we apply this to every complex value of a Fourier spectrum, we get the power

22* IRzzP +==

Fourier spectrum, we get the power spectrum or power spectral density.

• This is both real-valued and positive.• Just as white light contains the same amount

of all frequencies, so does white noise.• (For real data, you have to approximate the

PS by averaging.)NASSP Masters 5003F - Computational Astronomy - 2009

Page 22: Lecture 12 •Complex numbers –an alternate view •The

Red, brown or 1/f noise

NASSP Masters 5003F - Computational Astronomy - 2009

It’s fractal – looks the sameat all length scales.

Page 23: Lecture 12 •Complex numbers –an alternate view •The

Nature…?

NASSP Masters 5003F - Computational Astronomy - 2009

No, it is simulated – 1/f2 noise.

Page 24: Lecture 12 •Complex numbers –an alternate view •The

Fourier filtering of noise• Multiply a white spectrum by some band

pass:

• Back-transform:

• The noise is no longer uncorrelated. Now it is correlated noise: ie if the value in one sample is high, this increases the sample is high, this increases the probability that the next sample will also be high.

• I simulated the brown noise in the previous slides via Fourier filtering.

NASSP Masters 5003F - Computational Astronomy - 2009

Page 25: Lecture 12 •Complex numbers –an alternate view •The

Another example – bandpass filtering:

NASSP Masters 5003F - Computational Astronomy - 2009

Page 26: Lecture 12 •Complex numbers –an alternate view •The

Convolution

( ) ( ) ( )∫∞

∞−

′−′′=∗= ttgtftdgfth

• It is sort of a smearing/smoothing action.

NASSP Masters 5003F - Computational Astronomy - 2009

* =

Page 27: Lecture 12 •Complex numbers –an alternate view •The

A very important result:

• This is often a quick way to do a convolution.

{ } { } { }gfgf FFF =∗

• An example of a convolution met already:– Sliding-window linear filters used in source

detection.

NASSP Masters 5003F - Computational Astronomy - 2009

Page 28: Lecture 12 •Complex numbers –an alternate view •The

Correlation

• It is related to convolution:

( ) ( ) ( )∫∞

∞−

′+′′== ttgtftdgftR gf ,

{ } { } { }gfgf ∗= FFF

• Auto-correlation is the correlation of a function by itself.

• NOTE! For f=noise, this integral will not converge..NASSP Masters 5003F - Computational Astronomy - 2009

{ } { } { }gfgf = FFF

( ) ( ) ( )∫∞

∞−

′+′′== ttftftdfftR ff ,

Page 29: Lecture 12 •Complex numbers –an alternate view •The

How to make the autocorrelation converge for a noise signal?

• First recognize that it is often convenient to normalise by dividing by R(0):

( )( ) ( )

( )[ ]∫∫

′′

′+′′=

2tftd

ttftftdtγ

• It can be proved that γ(0)=1 and γ(>0)<1.• For ‘sensible’ fs, the following is true:

• A practical calculation estimates equation (1) via some non-infinite value of T.

NASSP Masters 5003F - Computational Astronomy - 2009

( )( ) ( )

( )[ ]∫∫

∞→ ′′

′+′′=

2

2

2

2

2lim

T

T

T

T

Ttftd

ttftftdtγ (1)

Page 30: Lecture 12 •Complex numbers –an alternate view •The

Autocorrelation and power spectrum• From slides 9 and 28, it is easy to show

that the Fourier transform of the autocorrelation of a function is the same as its power spectral density.

{ } { } { } { } ( ) 22ωFfffff === ∗

FFFF

• Again, in practice, we normalize the PSD by R(0) and estimate the result over a finite bandwidth.

NASSP Masters 5003F - Computational Astronomy - 2009

{ } { } { } { } ( )ωFfffff === FFFF