15.07.2014 Views

Spectral Analysis and Time Series - max planck research school ...

Spectral Analysis and Time Series - max planck research school ...

Spectral Analysis and Time Series - max planck research school ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

<strong>Spectral</strong> <strong>Analysis</strong> <strong>and</strong> <strong>Time</strong> <strong>Series</strong><br />

Andreas Lagg<br />

Part I: fundamentals<br />

on time series<br />

classification<br />

prob. density func.<br />

auto­correlation<br />

power spectral density<br />

cross­correlation<br />

applications<br />

pre­processing<br />

sampling<br />

trend removal<br />

Part II: Fourier series<br />

definition<br />

method<br />

properties<br />

convolution<br />

correlations<br />

leakage / windowing<br />

irregular grid<br />

noise removal<br />

Part III: Wavelets<br />

why wavelet<br />

transforms?<br />

fundamentals:<br />

FT, STFT <strong>and</strong><br />

resolution problems<br />

multiresolution<br />

analysis: CWT<br />

DWT<br />

Exercises


d<br />

e<br />

t<br />

e<br />

r<br />

m<br />

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Basic description of physical data<br />

deterministic: described by explicit mathematical relation<br />

xt=X cos<br />

k t t<br />

n<br />

non o deterministic: no way to predict an exact value at a future instant of time<br />

n


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Classifications of deterministic data<br />

Deterministic<br />

Periodic<br />

Nonperiodic<br />

Sinusoidal<br />

Complex Periodic<br />

Almost periodic<br />

Transient


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Sinusoidal data<br />

xt=X sin2 f 0<br />

t<br />

T =1/ f 0<br />

time history<br />

frequency spectrogram


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Complex periodic data<br />

xt=xt±nT <br />

n=1,2,3,...<br />

xt = a 0<br />

2 ∑ a n<br />

cos 2n f 1<br />

t b n<br />

sin 2 n f 1<br />

t<br />

(T = fundamental period)<br />

time history<br />

frequency spectrogram


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Almost periodic data<br />

xt=X 1<br />

sin2 t 1<br />

X 2<br />

sin3t 2<br />

X 3<br />

sin50 t 3<br />

<br />

no highest common divisor ­> infinitely long period T<br />

time history<br />

frequency spectrogram


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Transient non­periodic data<br />

all non­periodic data other than almost periodic data<br />

xt={ Ae−at t≥0<br />

0 t0<br />

xt={ Ae−at cos bt t≥0<br />

0 t0<br />

xt={ A c≥t≥0<br />

0 ct0


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Classification of r<strong>and</strong>om data<br />

R<strong>and</strong>om Data<br />

Stationary<br />

Nonstationary<br />

Ergodic<br />

Nonergodic<br />

Special classifications<br />

of nonstationarity


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

stationary / non stationary<br />

collection of sample functions = ensemble<br />

data can be (hypothetically) described by<br />

computing ensemble averages (averaging over<br />

multiple measurements / sample functions)<br />

mean value (first moment):<br />

x<br />

t 1<br />

= lim<br />

N ∞<br />

1<br />

∑ N<br />

N k=1<br />

autocorrelation function (joint moment):<br />

R x<br />

t 1,<br />

t 1<br />

= lim<br />

N ∞<br />

x k<br />

t 1<br />

<br />

1<br />

∑ N<br />

N k=1<br />

x k<br />

t 1<br />

x k<br />

t 1<br />

<br />

stationary: x<br />

t 1<br />

= x<br />

, R x<br />

t 1,<br />

t 1<br />

=R x<br />

weakly stationary: x<br />

t 1<br />

= x<br />

, R x<br />

t 1,<br />

t 1<br />

=R x


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

ergodic / non ergodic<br />

Ergodic r<strong>and</strong>om process:<br />

properties of a stationary r<strong>and</strong>om process<br />

described by computing averages over only one<br />

single sample function in the ensemble<br />

mean value of k­th sample function:<br />

x<br />

k=lim<br />

T ∞<br />

autocorrelation function (joint moment):<br />

T<br />

1<br />

∫ T<br />

0<br />

x k<br />

tdt<br />

R x<br />

, k=lim<br />

T ∞<br />

T<br />

1<br />

∫ T<br />

0<br />

x k<br />

t x k<br />

tdt<br />

ergodic:<br />

x<br />

k= x<br />

, R x<br />

, k=R x


Basic descriptive properties of r<strong>and</strong>om data<br />

mean square values<br />

propability density function<br />

autocorrelation functions<br />

power spectral density functions<br />

(from now on: assume r<strong>and</strong>om data to be stationary <strong>and</strong> ergodic)<br />

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong>


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Mean square values<br />

(mean values <strong>and</strong> variances)<br />

describes general intensity of r<strong>and</strong>om data: 2 x<br />

= lim<br />

T ∞<br />

rout mean square value:<br />

x<br />

rms<br />

= x<br />

2<br />

T<br />

1<br />

∫ T<br />

0<br />

x 2 tdt<br />

often convenient:<br />

static component described by mean value:<br />

x<br />

= lim<br />

T ∞<br />

T<br />

1<br />

∫ T<br />

0<br />

xtdt<br />

dynamic component described by variance:<br />

x<br />

2<br />

= lim<br />

T ∞<br />

1<br />

∫ T<br />

T<br />

0<br />

[ xt− x<br />

] 2 dt<br />

2<br />

st<strong>and</strong>ard deviation: x<br />

= x<br />

= x 2 − x<br />

2


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Probability density functions<br />

describes the probability that the data will assume a value within some defined<br />

range at any instant of time<br />

for small x :<br />

Prob[ xxt≤x x] = lim<br />

T ∞<br />

Prob[ xxt≤x x] ≈ p x x<br />

probability density function<br />

px =<br />

lim<br />

x 0<br />

probability distribution function<br />

P x<br />

= Prob[xt≤x]<br />

x<br />

= ∫ pd <br />

−∞<br />

Prob[ xxt≤x x]<br />

x<br />

T x<br />

= lim<br />

x 0<br />

k<br />

T , T x = ∑<br />

i=1<br />

1<br />

x [ lim<br />

T ∞<br />

t i<br />

T x<br />

T ]


Illustration: probability density function<br />

sample time histories:<br />

sine wave (a)<br />

sine wave + r<strong>and</strong>om noise<br />

narrow­b<strong>and</strong> r<strong>and</strong>om noise<br />

wide­b<strong>and</strong> r<strong>and</strong>om noise<br />

all 4 cases: mean value x<br />

=0<br />

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong>


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Illustration: probability density function<br />

probability density function


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Autocorrelation functions<br />

describes the general dependence of the data values at one time on the<br />

values at another time.<br />

R x<br />

= lim<br />

T ∞<br />

T<br />

1<br />

∫ T<br />

0<br />

xt xtdt<br />

x<br />

= R x<br />

∞ 2 x<br />

= R x<br />

0 (not for special cases like sine waves)


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Illustration: ACF<br />

autocorrelation functions (autocorrelogram)


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Illustrations<br />

autocorrelation function of a rectangular pulse<br />

xt xt−<br />

autocorrelation function


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Power spectral density functions<br />

(also called autospectral density functions)<br />

describe the general frequency composition of the data in terms<br />

of the spectral density of its mean square value<br />

f ,<br />

f f <br />

mean square value in frequency range :<br />

x 2 f , f = lim<br />

T ∞<br />

T<br />

1<br />

∫ T<br />

0<br />

definition of power spectral density function:<br />

G x<br />

f =<br />

lim<br />

f 0<br />

x 2 f , f <br />

f<br />

xt , f , f <br />

2 dt<br />

portion of x(t) in (f,f+∆f)<br />

f)<br />

= lim<br />

f 0<br />

x 2 f , f ≈ G x<br />

f f<br />

1<br />

f [ lim<br />

T ∞<br />

T<br />

1<br />

∫ T<br />

0<br />

important property: spectral density function is related to the<br />

autocorrelation function by a Fourier transform:<br />

G x<br />

f = 2∫<br />

−∞<br />

∞<br />

R x<br />

e −i 2 f d = 4∫<br />

0<br />

∞<br />

xt , f , f 2 dt]<br />

R x<br />

cos 2 f d


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Illustration: PSD<br />

power spectral density functions<br />

Dirac delta function at f=f 0<br />

sine wave<br />

sine wave<br />

+ r<strong>and</strong>om noise<br />

narrowb<strong>and</strong><br />

noise<br />

“white” noise:<br />

spectrum is uniform over<br />

all frequencies<br />

broadb<strong>and</strong><br />

noise


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Joint properties of r<strong>and</strong>om data<br />

until now: described properties of an<br />

individual r<strong>and</strong>om process<br />

Joint probability density functions<br />

joint properties in the amplitude domain<br />

Cross­correlation functions<br />

joint properties in the time domain<br />

joint probability measurement<br />

Cross­spectral density functions<br />

joint properties in the frequency domain


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Cross­correlation function<br />

describes the general dependence of<br />

one data set to another<br />

R xy<br />

= lim<br />

T ∞<br />

T<br />

1<br />

∫ T<br />

0<br />

xt ytdt<br />

similar to autocorrelation function<br />

R xy<br />

=0<br />

functions are<br />

uncorrelated<br />

cross­correlation measurement<br />

typical cross­correlation plot (cross­correlogram):<br />

sharp peaks indicate the existence of a correlation<br />

between x(t) <strong>and</strong> y(t) for specific time displacements


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Applications<br />

Measurement of time delays<br />

2 signals:<br />

different offset<br />

different S/N<br />

time delay 4s<br />

often used:<br />

'discrete' cross correlation coefficient<br />

lag =l, for l >=0:<br />

R xy<br />

l =<br />

N −l<br />

∑<br />

k=1<br />

∑ N<br />

k=1<br />

x k<br />

−xy kl<br />

−y<br />

N<br />

x k<br />

−x 2 ∑ y k<br />

−y 2<br />

k=1


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Applications<br />

Detection <strong>and</strong> recovery from<br />

signals in noise<br />

3 signals:<br />

noise free replica of the signal<br />

(e.g. model)<br />

2 noisy signals<br />

cross correlation can be used to<br />

determine if theoretical signal is<br />

present in data


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Pre­processing Operations<br />

sampling considerations<br />

trend removal<br />

filtering methods<br />

sampling<br />

cutoff frequency (=Nyquist<br />

frequency or folding frequency)<br />

f c<br />

= 1<br />

2 h


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Trend removal<br />

often desirable before performing a<br />

spectral analysis<br />

Least­square method:<br />

time series: ut<br />

desired fit<br />

(e.g. polynomial):<br />

K<br />

u=∑<br />

k=0<br />

N<br />

Lsq­Fit: minimize Qb=∑<br />

set partial<br />

derivatives to 0:<br />

∂Q<br />

n=1<br />

∂ b l<br />

=∑<br />

n=1<br />

K<br />

K+1 equations: ∑<br />

k=0<br />

N<br />

bk nh k<br />

u n<br />

−u n<br />

2<br />

n=1,2,... , N<br />

2u n<br />

−u n<br />

[−nh l ]<br />

N<br />

b k ∑ nh kl<br />

n=1<br />

N<br />

= ∑<br />

n=1<br />

u n<br />

nh l


Digital filtering<br />

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong>


end of part I ...<br />

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong>


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

<strong>Spectral</strong> <strong>Analysis</strong> <strong>and</strong> <strong>Time</strong> <strong>Series</strong><br />

Andreas Lagg<br />

Part I: fundamentals<br />

on time series<br />

classification<br />

prob. density func.<br />

auto­correlation<br />

power spectral density<br />

cross­correlation<br />

applications<br />

pre­processing<br />

sampling<br />

trend removal<br />

Part II: Fourier series<br />

definition<br />

method<br />

properties<br />

convolution<br />

correlations<br />

leakage / windowing<br />

irregular grid<br />

noise removal<br />

Part III: Wavelets<br />

why wavelet<br />

transforms?<br />

fundamentals:<br />

FT, STFT <strong>and</strong><br />

resolution problems<br />

multiresolution<br />

analysis: CWT<br />

DWT<br />

Exercises


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Fourier <strong>Series</strong> <strong>and</strong> Fast Fourier Transforms<br />

St<strong>and</strong>ard Fourier series procedure:<br />

if a transformed sample record x(t) is periodic with a period T p<br />

(fundamental<br />

frequency f 1<br />

=1/T p<br />

), then x(t) can be represented by the Fourier series:<br />

where<br />

∞<br />

xt = a 0<br />

2 ∑ a q<br />

cos 2q f 1<br />

t b q<br />

sin 2q f 1<br />

t<br />

T<br />

q=1<br />

a q<br />

= 2 ∫ xtcos 2q f<br />

T 1<br />

t dt q=0,1,2,...<br />

0<br />

T<br />

b q<br />

= 2 T ∫ 0<br />

xtsin 2q f 1<br />

t dt<br />

q=1,2,3,...


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Fourier series procedure ­ method<br />

sample record of finite length, equally spaced sampled:<br />

x n<br />

=xnh<br />

n=1,2,... , N<br />

Fourier series passing through these N data values:<br />

xt = A 0<br />

N /2<br />

∑<br />

q=1<br />

A q<br />

cos 2q t<br />

T p<br />

<br />

N /2−1<br />

∑<br />

q=1<br />

B q<br />

sin 2qt<br />

T p<br />

Fill in particular points: t=nh , n=1,2,... , N , T p<br />

=Nh , x n<br />

=xnh = ...<br />

coefficients A q<br />

<strong>and</strong> B q<br />

: A 0<br />

= 1 ∑ N n=1<br />

N<br />

x n<br />

= x A N /2<br />

= 1 N ∑ n=1<br />

<br />

N<br />

x n<br />

cos n<br />

N<br />

A q<br />

= 2 N ∑ n=1<br />

N<br />

B q<br />

= 2 N ∑ n=1<br />

x n<br />

cos 2q n<br />

N<br />

x n<br />

sin 2q n<br />

N<br />

inefficient & slow => Fast Fourier Trafos developed<br />

q=1,2,... , N 2 −1<br />

q=1,2,... , N 2 −1


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Fourier Transforms ­ Properties<br />

Linearity<br />

DFT<br />

{x n<br />

} ⇔<br />

DFT<br />

{y n<br />

} ⇔<br />

a{x n<br />

}b{y n<br />

}<br />

DFT<br />

⇔<br />

{X k<br />

}<br />

{Y k<br />

}<br />

a{X k<br />

}b{Y k<br />

}<br />

Symmetry {X k<br />

} = {X −k<br />

R{X k<br />

} is even<br />

∗ }<br />

I{X k<br />

} is odd<br />

Circular time shift<br />

DFT<br />

{x n−n0<br />

} ⇔<br />

{e i k n DFT<br />

0<br />

y n<br />

} ⇔<br />

{e −i k n 0<br />

X k<br />

}<br />

{Y k−k0<br />

}


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Using FFT for Convolution<br />

r * s ≡ ∫<br />

−∞<br />

∞<br />

r st−d <br />

Convolution Theorem:<br />

r * s ⇔ FT R f S f <br />

Fourier transform of the convolution<br />

is product of the individual Fourier<br />

transforms<br />

discrete case:<br />

N /2<br />

r * s j<br />

≡ ∑<br />

k=−N /21<br />

Convolution Theorem:<br />

N /2<br />

∑<br />

k=−N /21<br />

s j−k<br />

r k<br />

s j−k<br />

r k<br />

⇔ FT R n<br />

S n<br />

(note how the response function for negative times is wrapped<br />

around <strong>and</strong> stored at the extreme right end of the array)<br />

constraints:<br />

duration of r <strong>and</strong> s are not the same<br />

signal is not periodic<br />

original data<br />

response function<br />

convolved data


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Treatment of end effects by zero padding<br />

constraint 1:<br />

constraint 2:<br />

simply exp<strong>and</strong> response function to length N by padding it with zeros<br />

extend data at one end with a number of zeros equal to the <strong>max</strong>.<br />

positive / negative duration of r (whichever is larger)


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

FFT for Convolution<br />

1. zero­pad data<br />

2. zero­pad response function<br />

(­> data <strong>and</strong> response function have N elements)<br />

3. calculate FFT of data <strong>and</strong> response function<br />

4. multiply FFT of data with FFT of response function<br />

5. calculate inverse FFT for this product<br />

Deconvolution<br />

­> undo smearing caused by a response function<br />

use steps (1­3), <strong>and</strong> then:<br />

4. divide FFT of convolved data with FFT of response<br />

function<br />

5. calculate inverse FFT for this product


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Correlation / Autocorrelation with FFT<br />

definition of correlation / autocorrelation see first lecture<br />

Corr g , h = g* h = ∫<br />

−∞<br />

∞<br />

Correlation Theorem:<br />

Corr g , h ⇔ FT<br />

Auto­Correlation:<br />

G f H * f <br />

Corr g , g ⇔ FT ∣G f ∣ 2<br />

discrete correlation theorem:<br />

Corr g , h j<br />

≡<br />

N −1<br />

∑<br />

k=0<br />

⇔ FT G k<br />

H k<br />

*<br />

g jk<br />

h k<br />

gthd


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Fourier Transform ­ problems<br />

spectral leakage<br />

T =nT p<br />

T ≠nT p


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

reducing leakage by windowing (1)<br />

Applying windowing (apodizing) function to data record:<br />

xt = xtwt (original data record x windowing function)<br />

x n<br />

= x n<br />

w n<br />

No Window:<br />

Bartlett Window:<br />

Hamming Window:<br />

wt=1−<br />

∣t−T /2∣<br />

T /2<br />

wt=0.540.46∗cost<br />

Blackman Window:<br />

Hann Window:<br />

Gaussian Window:<br />

wt =<br />

0.420.5∗cost<br />

0.08 cos2 t<br />

wt=cos 2 t<br />

2 wt=exp−0.5a t 2


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

reducing leakage by windowing (2)<br />

without windowing<br />

with Gaussian windowing


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

No constant sampling frequency<br />

Fourier transformation requires constant sampling (data points at<br />

equal distances)<br />

­> not the case for most physical data<br />

Solution: Interpolation<br />

linear:<br />

inear interpolation between y <strong>and</strong> y k k+1<br />

IDL> idata=interpol(data,t,t_reg)<br />

quadratic:<br />

quadratic interpolation using y k­1 , y k<br />

<strong>and</strong> y k+1<br />

IDL> idata=interpol(data,t,t_reg,/quadratic)<br />

least­square quadratic<br />

least­square quadratic fit using y k­1 , y k<br />

, y k+1 <strong>and</strong> y k+2<br />

IDL> idata=interpol(data,t,t_reg,/lsq)<br />

spline<br />

IDL> idata=interpol(data,t,t_reg,/spline)<br />

IDL> idata=spline(t,data,t_reg[,tension])<br />

important:<br />

interpolation changes<br />

sampling rate!<br />

­> careful choice of<br />

new (regular) time grid<br />

necessary!


Fourier Transorm on irregular gridded data ­ Interpolation<br />

original data: sine wave + noise<br />

FT of original data<br />

irregular sampling of data (measurement)<br />

interpolation: linear, lsq, spline, quadratic<br />

're­sampling'<br />

FT of interpolated data<br />

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong>


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Noise removal<br />

Frequency threshold (lowpass)<br />

make FT of data<br />

set high frequencies to 0<br />

transorm back to time<br />

domain


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Noise removal<br />

signal threshold for<br />

weak frequencies (dB­threshold)<br />

make FT of data<br />

set frequencies with amplitudes<br />

below a given threshold to 0<br />

transorm back to time domain


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Optimal Filtering with FFT<br />

normal situation with measured data:<br />

underlying, uncorrupted signal u(t)<br />

+ response function of measurement r(t)<br />

= smeared signal s(t)<br />

+ noise n(t)<br />

= smeared, noisy signal c(t)<br />

st = ∫<br />

−∞<br />

∞<br />

r t−ud <br />

ct = stnt<br />

estimate true signal u(t) with:<br />

U f = C f f <br />

R f <br />

f ,t = optimal filter<br />

(Wiener filter)


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Calculation of optimal filter<br />

reconstructed signal <strong>and</strong> uncorrupted signal should be close in least­square sense:<br />

­> minimize<br />

­> minimize<br />

∫−∞<br />

∞<br />

∣ ut−ut∣ 2 dt = ∫<br />

−∞<br />

∞<br />

∣ U f −U f ∣ 2 df<br />

⇒<br />

∂<br />

∣ ∂ f<br />

⇒ f =<br />

[S f N f ] f <br />

R f <br />

∣S f ∣ 2<br />

∣S f ∣ 2 ∣N f ∣ 2<br />

− S f <br />

R f ∣2<br />

= 0<br />

additional information:<br />

power spectral density can often<br />

be used to disentangle noise<br />

function N(f) from smeared<br />

signal S(f)


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Using FFT for Power Spectrum Estimation<br />

discrete Fourier transform of c(t)<br />

­> Fourier coefficients:<br />

N−1<br />

C k<br />

=∑<br />

j=0<br />

c j<br />

e 2 i j k / N<br />

k=0,... , N−1<br />

­> periodogram estimate of<br />

power spectrum:<br />

P0 = P f 0<br />

= 1 N 2 ∣C 0 ∣ 2<br />

Periodogram<br />

P f k<br />

=<br />

1<br />

N 2 [∣C k ∣ 2 ∣C N−k ∣ 2 ]<br />

P f c<br />

= P f N /2<br />

= 1 N 2 ∣C N /2 ∣ 2


end of FT<br />

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong>


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

<strong>Spectral</strong> <strong>Analysis</strong> <strong>and</strong> <strong>Time</strong> <strong>Series</strong><br />

Andreas Lagg<br />

Part I: fundamentals<br />

on time series<br />

classification<br />

prob. density func.<br />

auto­correlation<br />

power spectral density<br />

cross­correlation<br />

applications<br />

pre­processing<br />

sampling<br />

trend removal<br />

Part II: Fourier series<br />

definition<br />

method<br />

properties<br />

convolution<br />

correlations<br />

leakage / windowing<br />

irregular grid<br />

noise removal<br />

Part III: Wavelets<br />

why wavelet<br />

transforms?<br />

fundamentals:<br />

FT, STFT <strong>and</strong><br />

resolution problems<br />

multiresolution<br />

analysis: CWT<br />

DWT<br />

Exercises


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Introduction to Wavelets<br />

why wavelet transforms?<br />

fundamentals: FT, short term FT <strong>and</strong> resolution<br />

problems<br />

multiresolution analysis:<br />

continous wavelet transform<br />

multiresolution analysis:<br />

discrete wavelet transform


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Fourier: lost time information<br />

6 Hz, 4 Hz, 2 Hz, 1 Hz 6 Hz + 4 Hz + 2 Hz + 1 Hz


Solution: Short <strong>Time</strong> Fourier Transform<br />

(STFT)<br />

perform FT on 'windowed' function:<br />

example: rectangular window<br />

move window in small steps over data<br />

perform FT for every time step<br />

STFT f ,t ' = ∫[ xtt−t ']e −i 2 f t dt<br />

t<br />

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong>


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Short <strong>Time</strong> Fourier Transform<br />

STFT<br />

STFT­spectrogram shows both time <strong>and</strong><br />

frequency information!


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Short <strong>Time</strong> Fourier Transform: Problem<br />

narrow window function ­> good time resolution<br />

wide window function ­> good frequency resolution<br />

Gauss­functions as<br />

windows


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Solution: Wavelet Transformation<br />

time vs. frequency resolution is intrinsic problem (Heisenberg Uncertainty Principle)<br />

approach: analyze the signal at different frequencies with different resolutions<br />

­> multiresolution analysis (MRA)<br />

Continuous Wavelet Transform<br />

similar to STFT:<br />

signal is multiplied with a<br />

function (the wavelet)<br />

transform is calculated<br />

separately for different segments<br />

of the time domain<br />

but:<br />

the FT of the windowed signals are<br />

not taken<br />

(no negative frequencies)<br />

The width of the window is changed<br />

as the transform is computed for<br />

every single spectral component


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Continuous Wavelet Transform<br />

CWT x = x , s = 1<br />

∣s∣ ∫ t<br />

... translation parameter , s ... scale parameter<br />

t ... mother wavelet = small wave<br />

*<br />

t−<br />

<br />

xt<br />

s<br />

dt<br />

mother wavelet:<br />

finite length (compactly<br />

supported) ­>'let'<br />

oscillatory ­>'wave'<br />

functions for different<br />

regions are derived from<br />

this function ­> 'mother'<br />

scale parameter s replaces frequency in STFT


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

The Scale<br />

similar to scales used in maps:<br />

high scale = non detailed global view (of the signal)<br />

low scale = detailed view<br />

in practical applications:<br />

low scales (= high frequencies)<br />

appear usually as short bursts or<br />

spikes<br />

high scales (= low frequencies) last<br />

for entire signal<br />

scaling dilates (stretches out) or<br />

compresses a signal:<br />

s > 1 ­> dilation<br />

s < 1 ­> compression


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Computation of the CWT<br />

signal to be analyzed: x(t), mother wavelet: Morlet or Mexican Hat<br />

start with scale s=1 (lowest scale,<br />

highest frequency)<br />

­> most compressed wavelet<br />

shift wavelet in time from t 0<br />

to t 1<br />

increase s by small value<br />

shift dilated wavelet from t 0<br />

to t 1<br />

repeat steps for all scales


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

CWT ­ Example<br />

signal x(t)<br />

axes of CWT: translation <strong>and</strong><br />

scale (not time <strong>and</strong> frequency)<br />

translation ­> time<br />

scale ­> 1/frequency


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

<strong>Time</strong> <strong>and</strong> Frequency Resolution<br />

every box corresponds to a value of the wavelet<br />

transform in the time frequency plane<br />

all boxes have constant area<br />

Δf Δt t = const.<br />

low frequencies: high resolution<br />

in f, low time resolution<br />

high frequencies: good time<br />

resolution<br />

STFT: time <strong>and</strong> frequency<br />

resolution is constant (all boxes<br />

are the same)


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Wavelets: Mathematical Approach<br />

WL­transform:<br />

CWT x = x , s = 1<br />

∣s∣ ∫ t<br />

*<br />

t−<br />

<br />

xt<br />

s<br />

dt<br />

Mexican Hat wavelet:<br />

t =<br />

−t 2<br />

1<br />

s e <br />

2 2<br />

3<br />

t2<br />

2 −1 <br />

Morlet wavelet:<br />

t = e i a t e − t2<br />

2<br />

inverse WL­transform:<br />

xt =<br />

1 2 ∫∫ x<br />

, s 1<br />

c s s t−<br />

2 s<br />

d ds<br />

admissibility<br />

condition:<br />

c <br />

={2∫<br />

−∞∞<br />

∣∣ 2<br />

∣∣<br />

1/2<br />

d } ∞ with<br />

FT<br />

⇔<br />

t


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Discretization of CWT: Wavelet <strong>Series</strong><br />

­> sampling the time – frequency (or scale) plane<br />

advantage:<br />

sampling high for high frequencies (low scales)<br />

scale s <strong>and</strong> 1 rate N 1<br />

sampling rate can be decreased for low<br />

frequencies (high scales)<br />

scale s 2<br />

<strong>and</strong> rate N 2<br />

N 2<br />

= s 1<br />

s 2<br />

N 1<br />

N 2<br />

= f 2<br />

f 1<br />

N 1<br />

continuous wavelet<br />

discrete wavelet<br />

, s<br />

= 1 s t−<br />

s t = s − j/2 −<br />

j , k 0<br />

s j 0<br />

t−k 0<br />

, j , k<br />

x<br />

j , k =∫<br />

t<br />

xt = c ∑<br />

j<br />

*<br />

xt j , k<br />

tdt<br />

∑<br />

k<br />

x<br />

j , k j , k<br />

t<br />

orthonormal<br />

WL­transformation<br />

reconstruction of<br />

signal


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Discrete Wavelet Transform<br />

(DWT)<br />

discretized continuous wavelet transform is only a sampled version of the CWT<br />

The discrete wavelet transform (DWT) has significant advantages for<br />

implementation in computers.<br />

excellent tutorial:<br />

http://users.rowan.edu/~polikar/WAVELETS/WTtutorial.html<br />

IDL­Wavelet Tools:<br />

IDL> wv_applet<br />

Wavelet expert at MPS:<br />

Rajat Thomas


end of Wavelets<br />

A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong>


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Exercises<br />

Part I: Fourier <strong>Analysis</strong><br />

(Andreas Lagg)<br />

Instructions:<br />

http://www.linmpi.mpg.de/~lagg<br />

Part II: Wavelets<br />

(Rajat Thomas)<br />

Seminar room<br />

<strong>Time</strong>: 15:00


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Exercise: Galileo magnetic field<br />

data set from Galileo magnetometer<br />

(synthesized)<br />

file: gll_data.sav, contains:<br />

total magnetic field<br />

radial distance<br />

time in seconds<br />

your tasks:<br />

Which ions are present?<br />

Is the time resolution of<br />

the magnetometer<br />

sufficient to detect<br />

electrons or protons?<br />

Background:<br />

Tips:<br />

restore,'gll_data.sav'<br />

use IDL­FFT<br />

remember basic plasma<br />

physics formula for the<br />

ion cyclotron wave:<br />

gyro<br />

= q B<br />

m ,<br />

f gyro = gyro<br />

2<br />

If the density of ions is high enough they will excite ion cyclotron waves<br />

during gyration around the magnetic field lines. This gyration frequency<br />

only depends on mass per charge <strong>and</strong> on the magnitude of the magnetic<br />

field.<br />

In a low­beta plasma the magnetic field dominates over plasma effects.<br />

The magnetic field shows only very little influence from the plasma <strong>and</strong><br />

can be considered as a magnetic dipole.<br />

http://www.sciencemag.org/cgi/content/full/274/5286/396


A. Lagg – <strong>Spectral</strong> <strong>Analysis</strong><br />

Literature<br />

R<strong>and</strong>om Data: <strong>Analysis</strong> <strong>and</strong> Measurement Procedures<br />

Bendat <strong>and</strong> Piersol, Wiley Interscience, 1971<br />

The <strong>Analysis</strong> of <strong>Time</strong> <strong>Series</strong>: An Introduction<br />

Chris Chatfield, Chapman <strong>and</strong> Hall / CRC, 2004<br />

<strong>Time</strong> <strong>Series</strong> <strong>Analysis</strong> <strong>and</strong> Its Applications<br />

Shumway <strong>and</strong> Stoffer, Springer, 2000<br />

Numerical Recipies in C<br />

Cambridge University Press, 1988­1992<br />

http://www.nr.com/<br />

The Wavelet Tutorial<br />

Robi Polikar, 2001<br />

http://users.rowan.edu/~polikar/WAVELETS/WTtutorial.html

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!